@spectrum-web-components/alert-banner 0.44.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/LICENSE +201 -0
- package/README.md +99 -0
- package/custom-elements.json +262 -0
- package/package.json +74 -0
- package/sp-alert-banner.d.ts +6 -0
- package/sp-alert-banner.dev.js +5 -0
- package/sp-alert-banner.dev.js.map +7 -0
- package/sp-alert-banner.js +2 -0
- package/sp-alert-banner.js.map +7 -0
- package/src/AlertBanner.d.ts +46 -0
- package/src/AlertBanner.dev.js +139 -0
- package/src/AlertBanner.dev.js.map +7 -0
- package/src/AlertBanner.js +26 -0
- package/src/AlertBanner.js.map +7 -0
- package/src/alert-banner.css.d.ts +2 -0
- package/src/alert-banner.css.dev.js +7 -0
- package/src/alert-banner.css.dev.js.map +7 -0
- package/src/alert-banner.css.js +4 -0
- package/src/alert-banner.css.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-alert-banner.css.d.ts +2 -0
- package/src/spectrum-alert-banner.css.dev.js +7 -0
- package/src/spectrum-alert-banner.css.dev.js.map +7 -0
- package/src/spectrum-alert-banner.css.js +4 -0
- package/src/spectrum-alert-banner.css.js.map +7 -0
- package/src/spectrum-config.js +48 -0
- package/stories/alert-banner.stories.js +47 -0
- package/stories/alert-banner.stories.js.map +7 -0
- package/stories/args.js +51 -0
- package/stories/args.js.map +7 -0
- package/stories/index.js +23 -0
- package/stories/index.js.map +7 -0
- package/stories/template.js +4 -0
- package/stories/template.js.map +7 -0
- package/test/alert-banner-memory.test.js +5 -0
- package/test/alert-banner-memory.test.js.map +7 -0
- package/test/alert-banner.test-vrt.js +5 -0
- package/test/alert-banner.test-vrt.js.map +7 -0
- package/test/alert-banner.test.js +162 -0
- package/test/alert-banner.test.js.map +7 -0
- package/test/benchmark/basic-test.js +8 -0
- package/test/benchmark/basic-test.js.map +7 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import '@spectrum-web-components/button/sp-close-button.js';
|
|
3
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';
|
|
4
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-info.js';
|
|
5
|
+
declare const VALID_VARIANTS: string[];
|
|
6
|
+
export type AlertBannerVariants = (typeof VALID_VARIANTS)[number];
|
|
7
|
+
/**
|
|
8
|
+
* @element sp-alert-banner
|
|
9
|
+
*
|
|
10
|
+
* @slot - The alert banner text context
|
|
11
|
+
* @slot action - Slot for the button element that surfaces the contextual action a user can take
|
|
12
|
+
*
|
|
13
|
+
* @fires close - Announces the alert banner has been closed
|
|
14
|
+
*/
|
|
15
|
+
export declare class AlertBanner extends SpectrumElement {
|
|
16
|
+
static get styles(): CSSResultArray;
|
|
17
|
+
/**
|
|
18
|
+
* Controls the display of the alert banner
|
|
19
|
+
*
|
|
20
|
+
* @param {Boolean} open
|
|
21
|
+
*/
|
|
22
|
+
open: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to include an icon-only close button to dismiss the alert banner
|
|
25
|
+
*
|
|
26
|
+
* @param {Boolean} dismissible
|
|
27
|
+
*/
|
|
28
|
+
dismissible: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The variant applies specific styling when set to `negative` or `info`;
|
|
31
|
+
* `variant` attribute is removed when it's passed an invalid variant.
|
|
32
|
+
*
|
|
33
|
+
* @param {String} variant
|
|
34
|
+
*/
|
|
35
|
+
set variant(variant: AlertBannerVariants);
|
|
36
|
+
get variant(): AlertBannerVariants;
|
|
37
|
+
private _variant;
|
|
38
|
+
protected isValidVariant(variant: string): boolean;
|
|
39
|
+
protected renderIcon(variant: string): TemplateResult;
|
|
40
|
+
private shouldClose;
|
|
41
|
+
close(): void;
|
|
42
|
+
private handleKeydown;
|
|
43
|
+
protected render(): TemplateResult;
|
|
44
|
+
protected updated(changes: PropertyValues): void;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
html,
|
|
14
|
+
SpectrumElement
|
|
15
|
+
} from "@spectrum-web-components/base";
|
|
16
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
17
|
+
import "@spectrum-web-components/button/sp-close-button.js";
|
|
18
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";
|
|
19
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-info.js";
|
|
20
|
+
import styles from "./alert-banner.css.js";
|
|
21
|
+
const VALID_VARIANTS = ["neutral", "info", "negative"];
|
|
22
|
+
export class AlertBanner extends SpectrumElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.open = false;
|
|
26
|
+
this.dismissible = false;
|
|
27
|
+
this._variant = "";
|
|
28
|
+
}
|
|
29
|
+
static get styles() {
|
|
30
|
+
return [styles];
|
|
31
|
+
}
|
|
32
|
+
set variant(variant) {
|
|
33
|
+
if (variant === this.variant) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const oldValue = this.variant;
|
|
37
|
+
if (this.isValidVariant(variant)) {
|
|
38
|
+
this.setAttribute("variant", variant);
|
|
39
|
+
this._variant = variant;
|
|
40
|
+
} else {
|
|
41
|
+
this.removeAttribute("variant");
|
|
42
|
+
this._variant = "";
|
|
43
|
+
if (true) {
|
|
44
|
+
window.__swc.warn(
|
|
45
|
+
this,
|
|
46
|
+
`<${this.localName}> element expects the "variant" attribute to be one of the following:`,
|
|
47
|
+
"https://opensource.adobe.com/spectrum-web-components/components/alert-banner/#variants",
|
|
48
|
+
{
|
|
49
|
+
issues: [...VALID_VARIANTS]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
this.requestUpdate("variant", oldValue);
|
|
55
|
+
}
|
|
56
|
+
get variant() {
|
|
57
|
+
return this._variant;
|
|
58
|
+
}
|
|
59
|
+
isValidVariant(variant) {
|
|
60
|
+
return VALID_VARIANTS.includes(variant);
|
|
61
|
+
}
|
|
62
|
+
renderIcon(variant) {
|
|
63
|
+
switch (variant) {
|
|
64
|
+
case "info":
|
|
65
|
+
return html`
|
|
66
|
+
<sp-icon-info
|
|
67
|
+
label="Information"
|
|
68
|
+
class="type"
|
|
69
|
+
></sp-icon-info>
|
|
70
|
+
`;
|
|
71
|
+
case "negative":
|
|
72
|
+
return html`
|
|
73
|
+
<sp-icon-alert label="Error" class="type"></sp-icon-alert>
|
|
74
|
+
`;
|
|
75
|
+
default:
|
|
76
|
+
return html``;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
shouldClose() {
|
|
80
|
+
const applyDefault = this.dispatchEvent(
|
|
81
|
+
new CustomEvent("close", {
|
|
82
|
+
composed: true,
|
|
83
|
+
bubbles: true,
|
|
84
|
+
cancelable: true
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
if (applyDefault) {
|
|
88
|
+
this.close();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
close() {
|
|
92
|
+
this.open = false;
|
|
93
|
+
}
|
|
94
|
+
handleKeydown(event) {
|
|
95
|
+
if (event.code === "Escape" && this.dismissible) {
|
|
96
|
+
this.shouldClose();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
render() {
|
|
100
|
+
return html`
|
|
101
|
+
<div class="body" role="alert">
|
|
102
|
+
<div class="content">
|
|
103
|
+
${this.renderIcon(this.variant)}
|
|
104
|
+
<div class="text"><slot></slot></div>
|
|
105
|
+
</div>
|
|
106
|
+
<slot name="action"></slot>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="end">
|
|
109
|
+
${this.dismissible ? html`
|
|
110
|
+
<sp-close-button
|
|
111
|
+
@click=${this.shouldClose}
|
|
112
|
+
label="Close"
|
|
113
|
+
static="white"
|
|
114
|
+
></sp-close-button>
|
|
115
|
+
` : html``}
|
|
116
|
+
</div>
|
|
117
|
+
`;
|
|
118
|
+
}
|
|
119
|
+
updated(changes) {
|
|
120
|
+
super.updated(changes);
|
|
121
|
+
if (changes.has("open")) {
|
|
122
|
+
if (this.open) {
|
|
123
|
+
this.addEventListener("keydown", this.handleKeydown);
|
|
124
|
+
} else {
|
|
125
|
+
this.removeEventListener("keydown", this.handleKeydown);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
__decorateClass([
|
|
131
|
+
property({ type: Boolean, reflect: true })
|
|
132
|
+
], AlertBanner.prototype, "open", 2);
|
|
133
|
+
__decorateClass([
|
|
134
|
+
property({ type: Boolean, reflect: true })
|
|
135
|
+
], AlertBanner.prototype, "dismissible", 2);
|
|
136
|
+
__decorateClass([
|
|
137
|
+
property({ type: String })
|
|
138
|
+
], AlertBanner.prototype, "variant", 1);
|
|
139
|
+
//# sourceMappingURL=AlertBanner.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["AlertBanner.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\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';\nimport styles from './alert-banner.css.js';\n\nconst VALID_VARIANTS = ['neutral', 'info', 'negative'];\nexport type AlertBannerVariants = (typeof VALID_VARIANTS)[number];\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 SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n /**\n * Controls the display of the alert banner\n *\n * @param {Boolean} open\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 * @param {Boolean} dismissible\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 * @param {String} variant\n */\n @property({ type: String })\n public set variant(variant: AlertBannerVariants) {\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: [...VALID_VARIANTS],\n }\n );\n }\n }\n this.requestUpdate('variant', oldValue);\n }\n\n public get variant(): AlertBannerVariants {\n return this._variant;\n }\n\n private _variant: AlertBannerVariants = '';\n\n protected isValidVariant(variant: string): boolean {\n return VALID_VARIANTS.includes(variant);\n }\n\n protected renderIcon(variant: string): TemplateResult {\n switch (variant) {\n case 'info':\n return html`\n <sp-icon-info\n label=\"Information\"\n class=\"type\"\n ></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 private 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 private handleKeydown(event: KeyboardEvent): void {\n if (event.code === 'Escape' && this.dismissible) {\n this.shouldClose();\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=\"white\"\n ></sp-close-button>\n `\n : html``}\n </div>\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,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,YAAY;AAEnB,MAAM,iBAAiB,CAAC,WAAW,QAAQ,UAAU;AAW9C,aAAM,oBAAoB,gBAAgB;AAAA,EAA1C;AAAA;AAWH,SAAO,OAAO;AAQd,SAAO,cAAc;AAwCrB,SAAQ,WAAgC;AAAA;AAAA,EA1DxC,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAyBA,IAAW,QAAQ,SAA8B;AAC7C,QAAI,YAAY,KAAK,SAAS;AAC1B;AAAA,IACJ;AACA,UAAM,WAAW,KAAK;AAEtB,QAAI,KAAK,eAAe,OAAO,GAAG;AAC9B,WAAK,aAAa,WAAW,OAAO;AACpC,WAAK,WAAW;AAAA,IACpB,OAAO;AACH,WAAK,gBAAgB,SAAS;AAC9B,WAAK,WAAW;AAEhB,UAAI,MAAoB;AACpB,eAAO,MAAM;AAAA,UACT;AAAA,UACA,IAAI,KAAK,SAAS;AAAA,UAClB;AAAA,UACA;AAAA,YACI,QAAQ,CAAC,GAAG,cAAc;AAAA,UAC9B;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AACA,SAAK,cAAc,WAAW,QAAQ;AAAA,EAC1C;AAAA,EAEA,IAAW,UAA+B;AACtC,WAAO,KAAK;AAAA,EAChB;AAAA,EAIU,eAAe,SAA0B;AAC/C,WAAO,eAAe,SAAS,OAAO;AAAA,EAC1C;AAAA,EAEU,WAAW,SAAiC;AAClD,YAAQ,SAAS;AAAA,MACb,KAAK;AACD,eAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMX,KAAK;AACD,eAAO;AAAA;AAAA;AAAA,MAGX;AACI,eAAO;AAAA,IACf;AAAA,EACJ;AAAA,EAEQ,cAAoB;AACxB,UAAM,eAAe,KAAK;AAAA,MACtB,IAAI,YAAY,SAAS;AAAA,QACrB,UAAU;AAAA,QACV,SAAS;AAAA,QACT,YAAY;AAAA,MAChB,CAAC;AAAA,IACL;AACA,QAAI,cAAc;AACd,WAAK,MAAM;AAAA,IACf;AAAA,EACJ;AAAA,EAEO,QAAc;AACjB,SAAK,OAAO;AAAA,EAChB;AAAA,EAEQ,cAAc,OAA4B;AAC9C,QAAI,MAAM,SAAS,YAAY,KAAK,aAAa;AAC7C,WAAK,YAAY;AAAA,IACrB;AAAA,EACJ;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA;AAAA,sBAGO,KAAK,WAAW,KAAK,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAMjC,KAAK,cACD;AAAA;AAAA,uCAEiB,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA,0BAKjC,MAAM;AAAA;AAAA;AAAA,EAGxB;AAAA,EAEmB,QAAQ,SAA+B;AACtD,UAAM,QAAQ,OAAO;AAErB,QAAI,QAAQ,IAAI,MAAM,GAAG;AACrB,UAAI,KAAK,MAAM;AACX,aAAK,iBAAiB,WAAW,KAAK,aAAa;AAAA,MACvD,OAAO;AACH,aAAK,oBAAoB,WAAW,KAAK,aAAa;AAAA,MAC1D;AAAA,IACJ;AAAA,EACJ;AACJ;AAjIW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAVjC,YAWF;AAQA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAlBjC,YAmBF;AASI;AAAA,EADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA3BjB,YA4BE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var o=(a,r,e,s)=>{for(var t=s>1?void 0:s?d(r,e):r,n=a.length-1,l;n>=0;n--)(l=a[n])&&(t=(s?l(r,e,t):l(t))||t);return s&&t&&c(r,e,t),t};import{html as i,SpectrumElement as u}from"@spectrum-web-components/base";import{property as p}from"@spectrum-web-components/base/src/decorators.js";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 h from"./alert-banner.css.js";const v=["neutral","info","negative"];export class AlertBanner extends u{constructor(){super(...arguments);this.open=!1;this.dismissible=!1;this._variant=""}static get styles(){return[h]}set variant(e){if(e===this.variant)return;const s=this.variant;this.isValidVariant(e)?(this.setAttribute("variant",e),this._variant=e):(this.removeAttribute("variant"),this._variant=""),this.requestUpdate("variant",s)}get variant(){return this._variant}isValidVariant(e){return v.includes(e)}renderIcon(e){switch(e){case"info":return i`
|
|
2
|
+
<sp-icon-info
|
|
3
|
+
label="Information"
|
|
4
|
+
class="type"
|
|
5
|
+
></sp-icon-info>
|
|
6
|
+
`;case"negative":return i`
|
|
7
|
+
<sp-icon-alert label="Error" class="type"></sp-icon-alert>
|
|
8
|
+
`;default:return i``}}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()}render(){return i`
|
|
9
|
+
<div class="body" role="alert">
|
|
10
|
+
<div class="content">
|
|
11
|
+
${this.renderIcon(this.variant)}
|
|
12
|
+
<div class="text"><slot></slot></div>
|
|
13
|
+
</div>
|
|
14
|
+
<slot name="action"></slot>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="end">
|
|
17
|
+
${this.dismissible?i`
|
|
18
|
+
<sp-close-button
|
|
19
|
+
@click=${this.shouldClose}
|
|
20
|
+
label="Close"
|
|
21
|
+
static="white"
|
|
22
|
+
></sp-close-button>
|
|
23
|
+
`:i``}
|
|
24
|
+
</div>
|
|
25
|
+
`}updated(e){super.updated(e),e.has("open")&&(this.open?this.addEventListener("keydown",this.handleKeydown):this.removeEventListener("keydown",this.handleKeydown))}}o([p({type:Boolean,reflect:!0})],AlertBanner.prototype,"open",2),o([p({type:Boolean,reflect:!0})],AlertBanner.prototype,"dismissible",2),o([p({type:String})],AlertBanner.prototype,"variant",1);
|
|
26
|
+
//# sourceMappingURL=AlertBanner.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["AlertBanner.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\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';\nimport styles from './alert-banner.css.js';\n\nconst VALID_VARIANTS = ['neutral', 'info', 'negative'];\nexport type AlertBannerVariants = (typeof VALID_VARIANTS)[number];\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 SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n /**\n * Controls the display of the alert banner\n *\n * @param {Boolean} open\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 * @param {Boolean} dismissible\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 * @param {String} variant\n */\n @property({ type: String })\n public set variant(variant: AlertBannerVariants) {\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: [...VALID_VARIANTS],\n }\n );\n }\n }\n this.requestUpdate('variant', oldValue);\n }\n\n public get variant(): AlertBannerVariants {\n return this._variant;\n }\n\n private _variant: AlertBannerVariants = '';\n\n protected isValidVariant(variant: string): boolean {\n return VALID_VARIANTS.includes(variant);\n }\n\n protected renderIcon(variant: string): TemplateResult {\n switch (variant) {\n case 'info':\n return html`\n <sp-icon-info\n label=\"Information\"\n class=\"type\"\n ></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 private 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 private handleKeydown(event: KeyboardEvent): void {\n if (event.code === 'Escape' && this.dismissible) {\n this.shouldClose();\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=\"white\"\n ></sp-close-button>\n `\n : html``}\n </div>\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,OAEI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,MAAO,qDACP,MAAO,iEACP,MAAO,gEACP,OAAOC,MAAY,wBAEnB,MAAMC,EAAiB,CAAC,UAAW,OAAQ,UAAU,EAW9C,aAAM,oBAAoBH,CAAgB,CAA1C,kCAWH,KAAO,KAAO,GAQd,KAAO,YAAc,GAwCrB,KAAQ,SAAgC,GA1DxC,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAM,CAClB,CAyBA,IAAW,QAAQE,EAA8B,CAC7C,GAAIA,IAAY,KAAK,QACjB,OAEJ,MAAMC,EAAW,KAAK,QAElB,KAAK,eAAeD,CAAO,GAC3B,KAAK,aAAa,UAAWA,CAAO,EACpC,KAAK,SAAWA,IAEhB,KAAK,gBAAgB,SAAS,EAC9B,KAAK,SAAW,IAapB,KAAK,cAAc,UAAWC,CAAQ,CAC1C,CAEA,IAAW,SAA+B,CACtC,OAAO,KAAK,QAChB,CAIU,eAAeD,EAA0B,CAC/C,OAAOD,EAAe,SAASC,CAAO,CAC1C,CAEU,WAAWA,EAAiC,CAClD,OAAQA,EAAS,CACb,IAAK,OACD,OAAOL;AAAA;AAAA;AAAA;AAAA;AAAA,kBAMX,IAAK,WACD,OAAOA;AAAA;AAAA,kBAGX,QACI,OAAOA,GACf,CACJ,CAEQ,aAAoB,CACH,KAAK,cACtB,IAAI,YAAY,QAAS,CACrB,SAAU,GACV,QAAS,GACT,WAAY,EAChB,CAAC,CACL,GAEI,KAAK,MAAM,CAEnB,CAEO,OAAc,CACjB,KAAK,KAAO,EAChB,CAEQ,cAAcO,EAA4B,CAC1CA,EAAM,OAAS,UAAY,KAAK,aAChC,KAAK,YAAY,CAEzB,CAEmB,QAAyB,CACxC,OAAOP;AAAA;AAAA;AAAA,sBAGO,KAAK,WAAW,KAAK,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAMjC,KAAK,YACDA;AAAA;AAAA,uCAEiB,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA,wBAKjCA,GAAM;AAAA;AAAA,SAGxB,CAEmB,QAAQQ,EAA+B,CACtD,MAAM,QAAQA,CAAO,EAEjBA,EAAQ,IAAI,MAAM,IACd,KAAK,KACL,KAAK,iBAAiB,UAAW,KAAK,aAAa,EAEnD,KAAK,oBAAoB,UAAW,KAAK,aAAa,EAGlE,CACJ,CAjIWC,EAAA,CADNP,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAVjC,YAWF,oBAQAO,EAAA,CADNP,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAlBjC,YAmBF,2BASIO,EAAA,CADVP,EAAS,CAAE,KAAM,MAAO,CAAC,GA3BjB,YA4BE",
|
|
6
|
+
"names": ["html", "SpectrumElement", "property", "styles", "VALID_VARIANTS", "variant", "oldValue", "event", "changes", "__decorateClass"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{--spectrum-alert-banner-min-height:var(--spectrum-alert-banner-minimum-height);--spectrum-alert-banner-max-inline-size:var(--spectrum-alert-banner-width);--spectrum-alert-banner-size:auto;--spectrum-alert-banner-font-size:var(--spectrum-font-size-100);--spectrum-alert-banner-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-alert-banner-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-alert-banner-start-edge:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-button-horizontal:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-divider:var(--spectrum-spacing-300);--spectrum-alert-banner-top-icon:var(--spectrum-alert-banner-top-to-workflow-icon);--spectrum-alert-banner-top-text:var(--spectrum-alert-banner-top-to-text);--spectrum-alert-banner-bottom-text:var(--spectrum-alert-banner-bottom-to-text);--spectrum-alert-banner-informative-background:var(--spectrum-informative-background-color-default);--spectrum-alert-banner-negative-background:var(--spectrum-negative-background-color-default);--spectrum-alert-banner-font-color:var(--spectrum-white);--mod-divider-vertical-margin:var(--mod-alert-banner-edge-to-divider,var(--spectrum-alert-banner-edge-to-divider));--mod-divider-vertical-height:auto;--mod-divider-vertical-align:stretch;--mod-button-margin-block:var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button));--mod-button-margin-right:var(--mod-alert-banner-text-to-divider,var(--spectrum-alert-banner-text-to-divider));--mod-button-margin-left:auto;--mod-closebutton-margin-inline:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-margin-top:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-align-self:flex-start;inline-size:var(--mod-alert-banner-size,var(--spectrum-alert-banner-size));max-inline-size:var(--mod-alert-banner-max-inline-size,var(--spectrum-alert-banner-max-inline-size));min-block-size:var(--mod-alert-banner-min-height,var(--spectrum-alert-banner-min-height));font-size:var(--mod-alert-banner-font-size,var(--spectrum-alert-banner-font-size));color:var(--mod-alert-banner-font-color,var(--spectrum-alert-banner-font-color));background-color:var(--mod-alert-banner-netural-background,var(--spectrum-alert-banner-netural-background));border:var(--highcontrast-alert-banner-border-width,0)solid var(--highcontrast-alert-banner-border-color,transparent);justify-content:space-between;display:none}:host([open]){display:flex}:host([variant=info]){background-color:var(--mod-alert-banner-informative-background,var(--spectrum-alert-banner-informative-background))}:host([variant=negative]){background-color:var(--mod-alert-banner-negative-background,var(--spectrum-alert-banner-negative-background))}.body{gap:max(calc(var(--mod-alert-banner-text-to-button-vertical,var(--spectrum-alert-banner-text-to-button-vertical)) - var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button))),0px);flex-wrap:wrap;align-items:center;inline-size:100%;margin-inline-start:var(--mod-alert-banner-start-edge,var(--spectrum-alert-banner-start-edge));display:flex}.content{display:flex}.end{align-items:center;display:flex}.type{inline-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));block-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));flex-shrink:0;margin-block-start:var(--mod-alert-banner-top-icon,var(--spectrum-alert-banner-top-icon));margin-inline-end:var(--mod-alert-banner-icon-to-text,var(--spectrum-alert-banner-icon-to-text))}.text{margin-block-start:var(--mod-alert-banner-top-text,var(--spectrum-alert-banner-top-text));margin-block-end:var(--mod-alert-banner-bottom-text,var(--spectrum-alert-banner-bottom-text));margin-inline-end:var(--mod-alert-banner-text-to-button-horizontal,var(--spectrum-alert-banner-text-to-button-horizontal))}@media (forced-colors:active){:host{--highcontrast-alert-banner-border-color:CanvasText;--highcontrast-alert-banner-border-width:var(--spectrum-border-width-100)}}:host{--spectrum-alert-banner-netural-background:var(--system-spectrum-alertbanner-spectrum-alert-banner-netural-background)}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=alert-banner.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["alert-banner.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-alert-banner-min-height:var(--spectrum-alert-banner-minimum-height);--spectrum-alert-banner-max-inline-size:var(--spectrum-alert-banner-width);--spectrum-alert-banner-size:auto;--spectrum-alert-banner-font-size:var(--spectrum-font-size-100);--spectrum-alert-banner-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-alert-banner-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-alert-banner-start-edge:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-button-horizontal:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-divider:var(--spectrum-spacing-300);--spectrum-alert-banner-top-icon:var(--spectrum-alert-banner-top-to-workflow-icon);--spectrum-alert-banner-top-text:var(--spectrum-alert-banner-top-to-text);--spectrum-alert-banner-bottom-text:var(--spectrum-alert-banner-bottom-to-text);--spectrum-alert-banner-informative-background:var(--spectrum-informative-background-color-default);--spectrum-alert-banner-negative-background:var(--spectrum-negative-background-color-default);--spectrum-alert-banner-font-color:var(--spectrum-white);--mod-divider-vertical-margin:var(--mod-alert-banner-edge-to-divider,var(--spectrum-alert-banner-edge-to-divider));--mod-divider-vertical-height:auto;--mod-divider-vertical-align:stretch;--mod-button-margin-block:var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button));--mod-button-margin-right:var(--mod-alert-banner-text-to-divider,var(--spectrum-alert-banner-text-to-divider));--mod-button-margin-left:auto;--mod-closebutton-margin-inline:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-margin-top:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-align-self:flex-start;inline-size:var(--mod-alert-banner-size,var(--spectrum-alert-banner-size));max-inline-size:var(--mod-alert-banner-max-inline-size,var(--spectrum-alert-banner-max-inline-size));min-block-size:var(--mod-alert-banner-min-height,var(--spectrum-alert-banner-min-height));font-size:var(--mod-alert-banner-font-size,var(--spectrum-alert-banner-font-size));color:var(--mod-alert-banner-font-color,var(--spectrum-alert-banner-font-color));background-color:var(--mod-alert-banner-netural-background,var(--spectrum-alert-banner-netural-background));border:var(--highcontrast-alert-banner-border-width,0)solid var(--highcontrast-alert-banner-border-color,transparent);justify-content:space-between;display:none}:host([open]){display:flex}:host([variant=info]){background-color:var(--mod-alert-banner-informative-background,var(--spectrum-alert-banner-informative-background))}:host([variant=negative]){background-color:var(--mod-alert-banner-negative-background,var(--spectrum-alert-banner-negative-background))}.body{gap:max(calc(var(--mod-alert-banner-text-to-button-vertical,var(--spectrum-alert-banner-text-to-button-vertical)) - var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button))),0px);flex-wrap:wrap;align-items:center;inline-size:100%;margin-inline-start:var(--mod-alert-banner-start-edge,var(--spectrum-alert-banner-start-edge));display:flex}.content{display:flex}.end{align-items:center;display:flex}.type{inline-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));block-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));flex-shrink:0;margin-block-start:var(--mod-alert-banner-top-icon,var(--spectrum-alert-banner-top-icon));margin-inline-end:var(--mod-alert-banner-icon-to-text,var(--spectrum-alert-banner-icon-to-text))}.text{margin-block-start:var(--mod-alert-banner-top-text,var(--spectrum-alert-banner-top-text));margin-block-end:var(--mod-alert-banner-bottom-text,var(--spectrum-alert-banner-bottom-text));margin-inline-end:var(--mod-alert-banner-text-to-button-horizontal,var(--spectrum-alert-banner-text-to-button-horizontal))}@media (forced-colors:active){:host{--highcontrast-alert-banner-border-color:CanvasText;--highcontrast-alert-banner-border-width:var(--spectrum-border-width-100)}}:host{--spectrum-alert-banner-netural-background:var(--system-spectrum-alertbanner-spectrum-alert-banner-netural-background)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as r}from"@spectrum-web-components/base";const e=r`
|
|
2
|
+
:host{--spectrum-alert-banner-min-height:var(--spectrum-alert-banner-minimum-height);--spectrum-alert-banner-max-inline-size:var(--spectrum-alert-banner-width);--spectrum-alert-banner-size:auto;--spectrum-alert-banner-font-size:var(--spectrum-font-size-100);--spectrum-alert-banner-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-alert-banner-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-alert-banner-start-edge:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-button-horizontal:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-divider:var(--spectrum-spacing-300);--spectrum-alert-banner-top-icon:var(--spectrum-alert-banner-top-to-workflow-icon);--spectrum-alert-banner-top-text:var(--spectrum-alert-banner-top-to-text);--spectrum-alert-banner-bottom-text:var(--spectrum-alert-banner-bottom-to-text);--spectrum-alert-banner-informative-background:var(--spectrum-informative-background-color-default);--spectrum-alert-banner-negative-background:var(--spectrum-negative-background-color-default);--spectrum-alert-banner-font-color:var(--spectrum-white);--mod-divider-vertical-margin:var(--mod-alert-banner-edge-to-divider,var(--spectrum-alert-banner-edge-to-divider));--mod-divider-vertical-height:auto;--mod-divider-vertical-align:stretch;--mod-button-margin-block:var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button));--mod-button-margin-right:var(--mod-alert-banner-text-to-divider,var(--spectrum-alert-banner-text-to-divider));--mod-button-margin-left:auto;--mod-closebutton-margin-inline:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-margin-top:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-align-self:flex-start;inline-size:var(--mod-alert-banner-size,var(--spectrum-alert-banner-size));max-inline-size:var(--mod-alert-banner-max-inline-size,var(--spectrum-alert-banner-max-inline-size));min-block-size:var(--mod-alert-banner-min-height,var(--spectrum-alert-banner-min-height));font-size:var(--mod-alert-banner-font-size,var(--spectrum-alert-banner-font-size));color:var(--mod-alert-banner-font-color,var(--spectrum-alert-banner-font-color));background-color:var(--mod-alert-banner-netural-background,var(--spectrum-alert-banner-netural-background));border:var(--highcontrast-alert-banner-border-width,0)solid var(--highcontrast-alert-banner-border-color,transparent);justify-content:space-between;display:none}:host([open]){display:flex}:host([variant=info]){background-color:var(--mod-alert-banner-informative-background,var(--spectrum-alert-banner-informative-background))}:host([variant=negative]){background-color:var(--mod-alert-banner-negative-background,var(--spectrum-alert-banner-negative-background))}.body{gap:max(calc(var(--mod-alert-banner-text-to-button-vertical,var(--spectrum-alert-banner-text-to-button-vertical)) - var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button))),0px);flex-wrap:wrap;align-items:center;inline-size:100%;margin-inline-start:var(--mod-alert-banner-start-edge,var(--spectrum-alert-banner-start-edge));display:flex}.content{display:flex}.end{align-items:center;display:flex}.type{inline-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));block-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));flex-shrink:0;margin-block-start:var(--mod-alert-banner-top-icon,var(--spectrum-alert-banner-top-icon));margin-inline-end:var(--mod-alert-banner-icon-to-text,var(--spectrum-alert-banner-icon-to-text))}.text{margin-block-start:var(--mod-alert-banner-top-text,var(--spectrum-alert-banner-top-text));margin-block-end:var(--mod-alert-banner-bottom-text,var(--spectrum-alert-banner-bottom-text));margin-inline-end:var(--mod-alert-banner-text-to-button-horizontal,var(--spectrum-alert-banner-text-to-button-horizontal))}@media (forced-colors:active){:host{--highcontrast-alert-banner-border-color:CanvasText;--highcontrast-alert-banner-border-width:var(--spectrum-border-width-100)}}:host{--spectrum-alert-banner-netural-background:var(--system-spectrum-alertbanner-spectrum-alert-banner-netural-background)}
|
|
3
|
+
`;export default e;
|
|
4
|
+
//# sourceMappingURL=alert-banner.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["alert-banner.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-alert-banner-min-height:var(--spectrum-alert-banner-minimum-height);--spectrum-alert-banner-max-inline-size:var(--spectrum-alert-banner-width);--spectrum-alert-banner-size:auto;--spectrum-alert-banner-font-size:var(--spectrum-font-size-100);--spectrum-alert-banner-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-alert-banner-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-alert-banner-start-edge:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-button-horizontal:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-divider:var(--spectrum-spacing-300);--spectrum-alert-banner-top-icon:var(--spectrum-alert-banner-top-to-workflow-icon);--spectrum-alert-banner-top-text:var(--spectrum-alert-banner-top-to-text);--spectrum-alert-banner-bottom-text:var(--spectrum-alert-banner-bottom-to-text);--spectrum-alert-banner-informative-background:var(--spectrum-informative-background-color-default);--spectrum-alert-banner-negative-background:var(--spectrum-negative-background-color-default);--spectrum-alert-banner-font-color:var(--spectrum-white);--mod-divider-vertical-margin:var(--mod-alert-banner-edge-to-divider,var(--spectrum-alert-banner-edge-to-divider));--mod-divider-vertical-height:auto;--mod-divider-vertical-align:stretch;--mod-button-margin-block:var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button));--mod-button-margin-right:var(--mod-alert-banner-text-to-divider,var(--spectrum-alert-banner-text-to-divider));--mod-button-margin-left:auto;--mod-closebutton-margin-inline:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-margin-top:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-align-self:flex-start;inline-size:var(--mod-alert-banner-size,var(--spectrum-alert-banner-size));max-inline-size:var(--mod-alert-banner-max-inline-size,var(--spectrum-alert-banner-max-inline-size));min-block-size:var(--mod-alert-banner-min-height,var(--spectrum-alert-banner-min-height));font-size:var(--mod-alert-banner-font-size,var(--spectrum-alert-banner-font-size));color:var(--mod-alert-banner-font-color,var(--spectrum-alert-banner-font-color));background-color:var(--mod-alert-banner-netural-background,var(--spectrum-alert-banner-netural-background));border:var(--highcontrast-alert-banner-border-width,0)solid var(--highcontrast-alert-banner-border-color,transparent);justify-content:space-between;display:none}:host([open]){display:flex}:host([variant=info]){background-color:var(--mod-alert-banner-informative-background,var(--spectrum-alert-banner-informative-background))}:host([variant=negative]){background-color:var(--mod-alert-banner-negative-background,var(--spectrum-alert-banner-negative-background))}.body{gap:max(calc(var(--mod-alert-banner-text-to-button-vertical,var(--spectrum-alert-banner-text-to-button-vertical)) - var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button))),0px);flex-wrap:wrap;align-items:center;inline-size:100%;margin-inline-start:var(--mod-alert-banner-start-edge,var(--spectrum-alert-banner-start-edge));display:flex}.content{display:flex}.end{align-items:center;display:flex}.type{inline-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));block-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));flex-shrink:0;margin-block-start:var(--mod-alert-banner-top-icon,var(--spectrum-alert-banner-top-icon));margin-inline-end:var(--mod-alert-banner-icon-to-text,var(--spectrum-alert-banner-icon-to-text))}.text{margin-block-start:var(--mod-alert-banner-top-text,var(--spectrum-alert-banner-top-text));margin-block-end:var(--mod-alert-banner-bottom-text,var(--spectrum-alert-banner-bottom-text));margin-inline-end:var(--mod-alert-banner-text-to-button-horizontal,var(--spectrum-alert-banner-text-to-button-horizontal))}@media (forced-colors:active){:host{--highcontrast-alert-banner-border-color:CanvasText;--highcontrast-alert-banner-border-width:var(--spectrum-border-width-100)}}:host{--spectrum-alert-banner-netural-background:var(--system-spectrum-alertbanner-spectrum-alert-banner-netural-background)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AlertBanner.js';
|
package/src/index.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\nexport * from './AlertBanner.dev.js'\n"],
|
|
5
|
+
"mappings": ";AAWA,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\nexport * from './AlertBanner.js';\n"],
|
|
5
|
+
"mappings": "aAWA,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{--spectrum-alert-banner-min-height:var(--spectrum-alert-banner-minimum-height);--spectrum-alert-banner-max-inline-size:var(--spectrum-alert-banner-width);--spectrum-alert-banner-size:auto;--spectrum-alert-banner-font-size:var(--spectrum-font-size-100);--spectrum-alert-banner-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-alert-banner-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-alert-banner-start-edge:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-button-horizontal:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-divider:var(--spectrum-spacing-300);--spectrum-alert-banner-top-icon:var(--spectrum-alert-banner-top-to-workflow-icon);--spectrum-alert-banner-top-text:var(--spectrum-alert-banner-top-to-text);--spectrum-alert-banner-bottom-text:var(--spectrum-alert-banner-bottom-to-text);--spectrum-alert-banner-informative-background:var(--spectrum-informative-background-color-default);--spectrum-alert-banner-negative-background:var(--spectrum-negative-background-color-default);--spectrum-alert-banner-font-color:var(--spectrum-white);--mod-divider-vertical-margin:var(--mod-alert-banner-edge-to-divider,var(--spectrum-alert-banner-edge-to-divider));--mod-divider-vertical-height:auto;--mod-divider-vertical-align:stretch;--mod-button-margin-block:var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button));--mod-button-margin-right:var(--mod-alert-banner-text-to-divider,var(--spectrum-alert-banner-text-to-divider));--mod-button-margin-left:auto;--mod-closebutton-margin-inline:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-margin-top:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-align-self:flex-start;inline-size:var(--mod-alert-banner-size,var(--spectrum-alert-banner-size));max-inline-size:var(--mod-alert-banner-max-inline-size,var(--spectrum-alert-banner-max-inline-size));min-block-size:var(--mod-alert-banner-min-height,var(--spectrum-alert-banner-min-height));font-size:var(--mod-alert-banner-font-size,var(--spectrum-alert-banner-font-size));color:var(--mod-alert-banner-font-color,var(--spectrum-alert-banner-font-color));background-color:var(--mod-alert-banner-netural-background,var(--spectrum-alert-banner-netural-background));border:var(--highcontrast-alert-banner-border-width,0)solid var(--highcontrast-alert-banner-border-color,transparent);justify-content:space-between;display:none}:host([open]){display:flex}:host([variant=info]){background-color:var(--mod-alert-banner-informative-background,var(--spectrum-alert-banner-informative-background))}:host([variant=negative]){background-color:var(--mod-alert-banner-negative-background,var(--spectrum-alert-banner-negative-background))}.body{gap:max(calc(var(--mod-alert-banner-text-to-button-vertical,var(--spectrum-alert-banner-text-to-button-vertical)) - var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button))),0px);flex-wrap:wrap;align-items:center;inline-size:100%;margin-inline-start:var(--mod-alert-banner-start-edge,var(--spectrum-alert-banner-start-edge));display:flex}.content{display:flex}.end{align-items:center;display:flex}.type{inline-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));block-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));flex-shrink:0;margin-block-start:var(--mod-alert-banner-top-icon,var(--spectrum-alert-banner-top-icon));margin-inline-end:var(--mod-alert-banner-icon-to-text,var(--spectrum-alert-banner-icon-to-text))}.text{margin-block-start:var(--mod-alert-banner-top-text,var(--spectrum-alert-banner-top-text));margin-block-end:var(--mod-alert-banner-bottom-text,var(--spectrum-alert-banner-bottom-text));margin-inline-end:var(--mod-alert-banner-text-to-button-horizontal,var(--spectrum-alert-banner-text-to-button-horizontal))}@media (forced-colors:active){:host{--highcontrast-alert-banner-border-color:CanvasText;--highcontrast-alert-banner-border-width:var(--spectrum-border-width-100)}}:host{--spectrum-alert-banner-netural-background:var(--system-spectrum-alertbanner-spectrum-alert-banner-netural-background)}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=spectrum-alert-banner.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-alert-banner.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-alert-banner-min-height:var(--spectrum-alert-banner-minimum-height);--spectrum-alert-banner-max-inline-size:var(--spectrum-alert-banner-width);--spectrum-alert-banner-size:auto;--spectrum-alert-banner-font-size:var(--spectrum-font-size-100);--spectrum-alert-banner-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-alert-banner-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-alert-banner-start-edge:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-button-horizontal:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-divider:var(--spectrum-spacing-300);--spectrum-alert-banner-top-icon:var(--spectrum-alert-banner-top-to-workflow-icon);--spectrum-alert-banner-top-text:var(--spectrum-alert-banner-top-to-text);--spectrum-alert-banner-bottom-text:var(--spectrum-alert-banner-bottom-to-text);--spectrum-alert-banner-informative-background:var(--spectrum-informative-background-color-default);--spectrum-alert-banner-negative-background:var(--spectrum-negative-background-color-default);--spectrum-alert-banner-font-color:var(--spectrum-white);--mod-divider-vertical-margin:var(--mod-alert-banner-edge-to-divider,var(--spectrum-alert-banner-edge-to-divider));--mod-divider-vertical-height:auto;--mod-divider-vertical-align:stretch;--mod-button-margin-block:var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button));--mod-button-margin-right:var(--mod-alert-banner-text-to-divider,var(--spectrum-alert-banner-text-to-divider));--mod-button-margin-left:auto;--mod-closebutton-margin-inline:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-margin-top:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-align-self:flex-start;inline-size:var(--mod-alert-banner-size,var(--spectrum-alert-banner-size));max-inline-size:var(--mod-alert-banner-max-inline-size,var(--spectrum-alert-banner-max-inline-size));min-block-size:var(--mod-alert-banner-min-height,var(--spectrum-alert-banner-min-height));font-size:var(--mod-alert-banner-font-size,var(--spectrum-alert-banner-font-size));color:var(--mod-alert-banner-font-color,var(--spectrum-alert-banner-font-color));background-color:var(--mod-alert-banner-netural-background,var(--spectrum-alert-banner-netural-background));border:var(--highcontrast-alert-banner-border-width,0)solid var(--highcontrast-alert-banner-border-color,transparent);justify-content:space-between;display:none}:host([open]){display:flex}:host([variant=info]){background-color:var(--mod-alert-banner-informative-background,var(--spectrum-alert-banner-informative-background))}:host([variant=negative]){background-color:var(--mod-alert-banner-negative-background,var(--spectrum-alert-banner-negative-background))}.body{gap:max(calc(var(--mod-alert-banner-text-to-button-vertical,var(--spectrum-alert-banner-text-to-button-vertical)) - var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button))),0px);flex-wrap:wrap;align-items:center;inline-size:100%;margin-inline-start:var(--mod-alert-banner-start-edge,var(--spectrum-alert-banner-start-edge));display:flex}.content{display:flex}.end{align-items:center;display:flex}.type{inline-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));block-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));flex-shrink:0;margin-block-start:var(--mod-alert-banner-top-icon,var(--spectrum-alert-banner-top-icon));margin-inline-end:var(--mod-alert-banner-icon-to-text,var(--spectrum-alert-banner-icon-to-text))}.text{margin-block-start:var(--mod-alert-banner-top-text,var(--spectrum-alert-banner-top-text));margin-block-end:var(--mod-alert-banner-bottom-text,var(--spectrum-alert-banner-bottom-text));margin-inline-end:var(--mod-alert-banner-text-to-button-horizontal,var(--spectrum-alert-banner-text-to-button-horizontal))}@media (forced-colors:active){:host{--highcontrast-alert-banner-border-color:CanvasText;--highcontrast-alert-banner-border-width:var(--spectrum-border-width-100)}}:host{--spectrum-alert-banner-netural-background:var(--system-spectrum-alertbanner-spectrum-alert-banner-netural-background)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as r}from"@spectrum-web-components/base";const e=r`
|
|
2
|
+
:host{--spectrum-alert-banner-min-height:var(--spectrum-alert-banner-minimum-height);--spectrum-alert-banner-max-inline-size:var(--spectrum-alert-banner-width);--spectrum-alert-banner-size:auto;--spectrum-alert-banner-font-size:var(--spectrum-font-size-100);--spectrum-alert-banner-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-alert-banner-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-alert-banner-start-edge:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-button-horizontal:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-divider:var(--spectrum-spacing-300);--spectrum-alert-banner-top-icon:var(--spectrum-alert-banner-top-to-workflow-icon);--spectrum-alert-banner-top-text:var(--spectrum-alert-banner-top-to-text);--spectrum-alert-banner-bottom-text:var(--spectrum-alert-banner-bottom-to-text);--spectrum-alert-banner-informative-background:var(--spectrum-informative-background-color-default);--spectrum-alert-banner-negative-background:var(--spectrum-negative-background-color-default);--spectrum-alert-banner-font-color:var(--spectrum-white);--mod-divider-vertical-margin:var(--mod-alert-banner-edge-to-divider,var(--spectrum-alert-banner-edge-to-divider));--mod-divider-vertical-height:auto;--mod-divider-vertical-align:stretch;--mod-button-margin-block:var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button));--mod-button-margin-right:var(--mod-alert-banner-text-to-divider,var(--spectrum-alert-banner-text-to-divider));--mod-button-margin-left:auto;--mod-closebutton-margin-inline:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-margin-top:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-align-self:flex-start;inline-size:var(--mod-alert-banner-size,var(--spectrum-alert-banner-size));max-inline-size:var(--mod-alert-banner-max-inline-size,var(--spectrum-alert-banner-max-inline-size));min-block-size:var(--mod-alert-banner-min-height,var(--spectrum-alert-banner-min-height));font-size:var(--mod-alert-banner-font-size,var(--spectrum-alert-banner-font-size));color:var(--mod-alert-banner-font-color,var(--spectrum-alert-banner-font-color));background-color:var(--mod-alert-banner-netural-background,var(--spectrum-alert-banner-netural-background));border:var(--highcontrast-alert-banner-border-width,0)solid var(--highcontrast-alert-banner-border-color,transparent);justify-content:space-between;display:none}:host([open]){display:flex}:host([variant=info]){background-color:var(--mod-alert-banner-informative-background,var(--spectrum-alert-banner-informative-background))}:host([variant=negative]){background-color:var(--mod-alert-banner-negative-background,var(--spectrum-alert-banner-negative-background))}.body{gap:max(calc(var(--mod-alert-banner-text-to-button-vertical,var(--spectrum-alert-banner-text-to-button-vertical)) - var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button))),0px);flex-wrap:wrap;align-items:center;inline-size:100%;margin-inline-start:var(--mod-alert-banner-start-edge,var(--spectrum-alert-banner-start-edge));display:flex}.content{display:flex}.end{align-items:center;display:flex}.type{inline-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));block-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));flex-shrink:0;margin-block-start:var(--mod-alert-banner-top-icon,var(--spectrum-alert-banner-top-icon));margin-inline-end:var(--mod-alert-banner-icon-to-text,var(--spectrum-alert-banner-icon-to-text))}.text{margin-block-start:var(--mod-alert-banner-top-text,var(--spectrum-alert-banner-top-text));margin-block-end:var(--mod-alert-banner-bottom-text,var(--spectrum-alert-banner-bottom-text));margin-inline-end:var(--mod-alert-banner-text-to-button-horizontal,var(--spectrum-alert-banner-text-to-button-horizontal))}@media (forced-colors:active){:host{--highcontrast-alert-banner-border-color:CanvasText;--highcontrast-alert-banner-border-width:var(--spectrum-border-width-100)}}:host{--spectrum-alert-banner-netural-background:var(--system-spectrum-alertbanner-spectrum-alert-banner-netural-background)}
|
|
3
|
+
`;export default e;
|
|
4
|
+
//# sourceMappingURL=spectrum-alert-banner.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-alert-banner.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-alert-banner-min-height:var(--spectrum-alert-banner-minimum-height);--spectrum-alert-banner-max-inline-size:var(--spectrum-alert-banner-width);--spectrum-alert-banner-size:auto;--spectrum-alert-banner-font-size:var(--spectrum-font-size-100);--spectrum-alert-banner-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-alert-banner-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-alert-banner-start-edge:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-button-horizontal:var(--spectrum-spacing-300);--spectrum-alert-banner-text-to-divider:var(--spectrum-spacing-300);--spectrum-alert-banner-top-icon:var(--spectrum-alert-banner-top-to-workflow-icon);--spectrum-alert-banner-top-text:var(--spectrum-alert-banner-top-to-text);--spectrum-alert-banner-bottom-text:var(--spectrum-alert-banner-bottom-to-text);--spectrum-alert-banner-informative-background:var(--spectrum-informative-background-color-default);--spectrum-alert-banner-negative-background:var(--spectrum-negative-background-color-default);--spectrum-alert-banner-font-color:var(--spectrum-white);--mod-divider-vertical-margin:var(--mod-alert-banner-edge-to-divider,var(--spectrum-alert-banner-edge-to-divider));--mod-divider-vertical-height:auto;--mod-divider-vertical-align:stretch;--mod-button-margin-block:var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button));--mod-button-margin-right:var(--mod-alert-banner-text-to-divider,var(--spectrum-alert-banner-text-to-divider));--mod-button-margin-left:auto;--mod-closebutton-margin-inline:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-margin-top:var(--mod-alert-banner-close-button-spacing,var(--spectrum-alert-banner-close-button-spacing));--mod-closebutton-align-self:flex-start;inline-size:var(--mod-alert-banner-size,var(--spectrum-alert-banner-size));max-inline-size:var(--mod-alert-banner-max-inline-size,var(--spectrum-alert-banner-max-inline-size));min-block-size:var(--mod-alert-banner-min-height,var(--spectrum-alert-banner-min-height));font-size:var(--mod-alert-banner-font-size,var(--spectrum-alert-banner-font-size));color:var(--mod-alert-banner-font-color,var(--spectrum-alert-banner-font-color));background-color:var(--mod-alert-banner-netural-background,var(--spectrum-alert-banner-netural-background));border:var(--highcontrast-alert-banner-border-width,0)solid var(--highcontrast-alert-banner-border-color,transparent);justify-content:space-between;display:none}:host([open]){display:flex}:host([variant=info]){background-color:var(--mod-alert-banner-informative-background,var(--spectrum-alert-banner-informative-background))}:host([variant=negative]){background-color:var(--mod-alert-banner-negative-background,var(--spectrum-alert-banner-negative-background))}.body{gap:max(calc(var(--mod-alert-banner-text-to-button-vertical,var(--spectrum-alert-banner-text-to-button-vertical)) - var(--mod-alert-banner-edge-to-button,var(--spectrum-alert-banner-edge-to-button))),0px);flex-wrap:wrap;align-items:center;inline-size:100%;margin-inline-start:var(--mod-alert-banner-start-edge,var(--spectrum-alert-banner-start-edge));display:flex}.content{display:flex}.end{align-items:center;display:flex}.type{inline-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));block-size:var(--mod-alert-banner-icon-size,var(--spectrum-alert-banner-icon-size));flex-shrink:0;margin-block-start:var(--mod-alert-banner-top-icon,var(--spectrum-alert-banner-top-icon));margin-inline-end:var(--mod-alert-banner-icon-to-text,var(--spectrum-alert-banner-icon-to-text))}.text{margin-block-start:var(--mod-alert-banner-top-text,var(--spectrum-alert-banner-top-text));margin-block-end:var(--mod-alert-banner-bottom-text,var(--spectrum-alert-banner-bottom-text));margin-inline-end:var(--mod-alert-banner-text-to-button-horizontal,var(--spectrum-alert-banner-text-to-button-horizontal))}@media (forced-colors:active){:host{--highcontrast-alert-banner-border-color:CanvasText;--highcontrast-alert-banner-border-width:var(--spectrum-border-width-100)}}:host{--spectrum-alert-banner-netural-background:var(--system-spectrum-alertbanner-spectrum-alert-banner-netural-background)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 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
|
+
// @ts-check
|
|
13
|
+
|
|
14
|
+
import { converterFor } from '../../../tasks/process-spectrum-utils.js';
|
|
15
|
+
|
|
16
|
+
const converter = converterFor('spectrum-AlertBanner');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type { import('../../../tasks/spectrum-css-converter').SpectrumCSSConverter }
|
|
20
|
+
*/
|
|
21
|
+
const config = {
|
|
22
|
+
conversions: [
|
|
23
|
+
{
|
|
24
|
+
inPackage: '@spectrum-css/alertbanner',
|
|
25
|
+
outPackage: 'alert-banner',
|
|
26
|
+
fileName: 'alert-banner',
|
|
27
|
+
components: [
|
|
28
|
+
converter.classToHost(),
|
|
29
|
+
converter.classToAttribute('is-open', 'open'),
|
|
30
|
+
...converter.enumerateAttributes(
|
|
31
|
+
[
|
|
32
|
+
['spectrum-AlertBanner--info'],
|
|
33
|
+
['spectrum-AlertBanner--negative'],
|
|
34
|
+
],
|
|
35
|
+
'variant'
|
|
36
|
+
),
|
|
37
|
+
converter.classToClass('spectrum-AlertBanner-body'),
|
|
38
|
+
converter.classToClass('spectrum-AlertBanner-content'),
|
|
39
|
+
converter.classToClass('spectrum-AlertBanner-text'),
|
|
40
|
+
converter.classToSlotted('spectrum-Button', 'action'),
|
|
41
|
+
converter.classToClass('spectrum-AlertBanner-end'),
|
|
42
|
+
converter.classToClass('spectrum-AlertBanner-icon', 'type'),
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default config;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import { AlertBannerMarkup } from "./";
|
|
4
|
+
import { argTypes } from "./args.js";
|
|
5
|
+
export default {
|
|
6
|
+
title: "Alert Banner",
|
|
7
|
+
component: "sp-alert-banner",
|
|
8
|
+
args: {
|
|
9
|
+
text: "Your trial has expired",
|
|
10
|
+
dismissible: true,
|
|
11
|
+
open: true,
|
|
12
|
+
variant: "neutral"
|
|
13
|
+
},
|
|
14
|
+
argTypes
|
|
15
|
+
};
|
|
16
|
+
export const Default = (args) => AlertBannerMarkup(args);
|
|
17
|
+
export const Info = (args) => AlertBannerMarkup({
|
|
18
|
+
...args,
|
|
19
|
+
variant: "info",
|
|
20
|
+
text: "Your trial will expire in 3 days"
|
|
21
|
+
});
|
|
22
|
+
export const Negative = (args) => AlertBannerMarkup({
|
|
23
|
+
...args,
|
|
24
|
+
variant: "negative",
|
|
25
|
+
text: "Connection interrupted. Check your network to continue"
|
|
26
|
+
});
|
|
27
|
+
export const TextWrapping = (args) => html`
|
|
28
|
+
<div style="max-width:800px;">
|
|
29
|
+
${AlertBannerMarkup({
|
|
30
|
+
...args,
|
|
31
|
+
variant: "negative",
|
|
32
|
+
text: ` Your trial has expired. Please purchase to continue.
|
|
33
|
+
Your work has been saved and is ready for you to open again once
|
|
34
|
+
you have purchased the software.`,
|
|
35
|
+
actionLabel: "Purchase"
|
|
36
|
+
})}
|
|
37
|
+
</div>
|
|
38
|
+
`;
|
|
39
|
+
export const Multilanguage = (args) => html`
|
|
40
|
+
${AlertBannerMarkup({
|
|
41
|
+
...args,
|
|
42
|
+
variant: "info",
|
|
43
|
+
text: `\u0633\u062A\u0646\u062A\u0647\u064A \u0627\u0644\u0641\u062A\u0631\u0629 \u0627\u0644\u062A\u062C\u0631\u064A\u0628\u064A\u0629 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0641\u064A \u0627\u0644\u0623\u0633\u0628\u0648\u0639 \u0627\u0644\u0645\u0642\u0628\u0644`,
|
|
44
|
+
actionLabel: `\u0627\u0634\u062A\u0631\u064A \u0627\u0644\u0622\u0646`
|
|
45
|
+
})}
|
|
46
|
+
`;
|
|
47
|
+
//# sourceMappingURL=alert-banner.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["alert-banner.stories.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { AlertBannerVariants } from '@spectrum-web-components/alert-banner';\nimport { AlertBannerMarkup } from './';\nimport { argTypes } from './args.js';\n\ninterface Properties {\n text: string;\n variant: AlertBannerVariants;\n dismissible: boolean;\n open: boolean;\n onClose?: (event: Event) => void;\n actionLabel?: string;\n}\n\nexport default {\n title: 'Alert Banner',\n component: 'sp-alert-banner',\n args: {\n text: 'Your trial has expired',\n dismissible: true,\n open: true,\n variant: 'neutral',\n },\n argTypes,\n};\n\nexport const Default = (args: Properties): TemplateResult =>\n AlertBannerMarkup(args);\n\nexport const Info = (args: Properties): TemplateResult =>\n AlertBannerMarkup({\n ...args,\n variant: 'info',\n text: 'Your trial will expire in 3 days',\n });\n\nexport const Negative = (args: Properties): TemplateResult =>\n AlertBannerMarkup({\n ...args,\n variant: 'negative',\n text: 'Connection interrupted. Check your network to continue',\n });\n\nexport const TextWrapping = (args: Properties): TemplateResult => html`\n <div style=\"max-width:800px;\">\n ${AlertBannerMarkup({\n ...args,\n variant: 'negative',\n text: ` Your trial has expired. Please purchase to continue.\nYour work has been saved and is ready for you to open again once\nyou have purchased the software.`,\n actionLabel: 'Purchase',\n })}\n </div>\n`;\n\nexport const Multilanguage = (args: Properties): TemplateResult => html`\n ${AlertBannerMarkup({\n ...args,\n variant: 'info',\n text: `\u0633\u062A\u0646\u062A\u0647\u064A \u0627\u0644\u0641\u062A\u0631\u0629 \u0627\u0644\u062A\u062C\u0631\u064A\u0628\u064A\u0629 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0641\u064A \u0627\u0644\u0623\u0633\u0628\u0648\u0639 \u0627\u0644\u0645\u0642\u0628\u0644`,\n actionLabel: `\u0627\u0634\u062A\u0631\u064A \u0627\u0644\u0622\u0646`,\n })}\n`;\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,YAA4B;AAErC,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AAWzB,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,IACF,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,EACb;AAAA,EACA;AACJ;AAEO,aAAM,UAAU,CAAC,SACpB,kBAAkB,IAAI;AAEnB,aAAM,OAAO,CAAC,SACjB,kBAAkB;AAAA,EACd,GAAG;AAAA,EACH,SAAS;AAAA,EACT,MAAM;AACV,CAAC;AAEE,aAAM,WAAW,CAAC,SACrB,kBAAkB;AAAA,EACd,GAAG;AAAA,EACH,SAAS;AAAA,EACT,MAAM;AACV,CAAC;AAEE,aAAM,eAAe,CAAC,SAAqC;AAAA;AAAA,UAExD,kBAAkB;AAAA,EAChB,GAAG;AAAA,EACH,SAAS;AAAA,EACT,MAAM;AAAA;AAAA;AAAA,EAGN,aAAa;AACjB,CAAC,CAAC;AAAA;AAAA;AAIH,aAAM,gBAAgB,CAAC,SAAqC;AAAA,MAC7D,kBAAkB;AAAA,EAChB,GAAG;AAAA,EACH,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AACjB,CAAC,CAAC;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/stories/args.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
export const argTypes = {
|
|
3
|
+
text: {
|
|
4
|
+
name: "text",
|
|
5
|
+
type: { name: "string", required: false },
|
|
6
|
+
table: {
|
|
7
|
+
type: { summary: "string" },
|
|
8
|
+
defaultValue: { summary: "Your trial has expired" }
|
|
9
|
+
},
|
|
10
|
+
control: "text"
|
|
11
|
+
},
|
|
12
|
+
dismissible: {
|
|
13
|
+
name: "dismissible",
|
|
14
|
+
type: { name: "boolean", required: false },
|
|
15
|
+
description: "Whether to include an icon-only close button to dismiss it",
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: "boolean" },
|
|
18
|
+
defaultValue: { summary: true }
|
|
19
|
+
},
|
|
20
|
+
control: { type: "boolean" }
|
|
21
|
+
},
|
|
22
|
+
open: {
|
|
23
|
+
name: "open",
|
|
24
|
+
type: { name: "boolean", required: false },
|
|
25
|
+
description: "Whether the alert banner is open",
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: "boolean" },
|
|
28
|
+
defaultValue: { summary: true }
|
|
29
|
+
},
|
|
30
|
+
control: { type: "boolean" }
|
|
31
|
+
},
|
|
32
|
+
variant: {
|
|
33
|
+
name: "variant",
|
|
34
|
+
type: { name: "string", required: false },
|
|
35
|
+
description: "The visual variant of the alert banner",
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: "string" },
|
|
38
|
+
defaultValue: { summary: "neutral" }
|
|
39
|
+
},
|
|
40
|
+
control: {
|
|
41
|
+
labels: {
|
|
42
|
+
neutral: "Neutral",
|
|
43
|
+
info: "Info",
|
|
44
|
+
negative: "Negative"
|
|
45
|
+
},
|
|
46
|
+
type: "select"
|
|
47
|
+
},
|
|
48
|
+
options: ["neutral", "info", "negative"]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=args.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["args.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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.\n*/\n\nexport const argTypes = {\n text: {\n name: 'text',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'Your trial has expired' },\n },\n control: 'text',\n },\n dismissible: {\n name: 'dismissible',\n type: { name: 'boolean', required: false },\n description:\n 'Whether to include an icon-only close button to dismiss it',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: true },\n },\n control: { type: 'boolean' },\n },\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the alert banner is open',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: true },\n },\n control: { type: 'boolean' },\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n description: 'The visual variant of the alert banner',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'neutral' },\n },\n control: {\n labels: {\n neutral: 'Neutral',\n info: 'Info',\n negative: 'Negative',\n },\n type: 'select',\n },\n options: ['neutral', 'info', 'negative'],\n },\n};\n"],
|
|
5
|
+
"mappings": ";AAYO,aAAM,WAAW;AAAA,EACpB,MAAM;AAAA,IACF,MAAM;AAAA,IACN,MAAM,EAAE,MAAM,UAAU,UAAU,MAAM;AAAA,IACxC,OAAO;AAAA,MACH,MAAM,EAAE,SAAS,SAAS;AAAA,MAC1B,cAAc,EAAE,SAAS,yBAAyB;AAAA,IACtD;AAAA,IACA,SAAS;AAAA,EACb;AAAA,EACA,aAAa;AAAA,IACT,MAAM;AAAA,IACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,IACzC,aACI;AAAA,IACJ,OAAO;AAAA,MACH,MAAM,EAAE,SAAS,UAAU;AAAA,MAC3B,cAAc,EAAE,SAAS,KAAK;AAAA,IAClC;AAAA,IACA,SAAS,EAAE,MAAM,UAAU;AAAA,EAC/B;AAAA,EACA,MAAM;AAAA,IACF,MAAM;AAAA,IACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,IACzC,aAAa;AAAA,IACb,OAAO;AAAA,MACH,MAAM,EAAE,SAAS,UAAU;AAAA,MAC3B,cAAc,EAAE,SAAS,KAAK;AAAA,IAClC;AAAA,IACA,SAAS,EAAE,MAAM,UAAU;AAAA,EAC/B;AAAA,EACA,SAAS;AAAA,IACL,MAAM;AAAA,IACN,MAAM,EAAE,MAAM,UAAU,UAAU,MAAM;AAAA,IACxC,aAAa;AAAA,IACb,OAAO;AAAA,MACH,MAAM,EAAE,SAAS,SAAS;AAAA,MAC1B,cAAc,EAAE,SAAS,UAAU;AAAA,IACvC;AAAA,IACA,SAAS;AAAA,MACL,QAAQ;AAAA,QACJ,SAAS;AAAA,QACT,MAAM;AAAA,QACN,UAAU;AAAA,MACd;AAAA,MACA,MAAM;AAAA,IACV;AAAA,IACA,SAAS,CAAC,WAAW,QAAQ,UAAU;AAAA,EAC3C;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|