@spectrum-web-components/alert-banner 0.49.0-beta.0 → 0.49.0-beta.2

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 CHANGED
@@ -50,7 +50,7 @@ Use the action slot for the contextual action that a user can take in response t
50
50
  ```html
51
51
  <sp-alert-banner open dismissible>
52
52
  Your trial has expired
53
- <sp-button treatment="outline" static="white" slot="action">
53
+ <sp-button treatment="outline" static-color="white" slot="action">
54
54
  Buy now
55
55
  </sp-button>
56
56
  </sp-alert-banner>
@@ -63,7 +63,7 @@ Use the action slot for the contextual action that a user can take in response t
63
63
  ```html
64
64
  <sp-alert-banner open variant="info" dismissible>
65
65
  Your trial will expire in 3 days
66
- <sp-button treatment="outline" static="white" slot="action">
66
+ <sp-button treatment="outline" static-color="white" slot="action">
67
67
  Buy now
68
68
  </sp-button>
69
69
  </sp-alert-banner>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/alert-banner",
3
- "version": "0.49.0-beta.0",
3
+ "version": "0.49.0-beta.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -57,9 +57,9 @@
57
57
  "lit-html"
58
58
  ],
59
59
  "dependencies": {
60
- "@spectrum-web-components/base": "^0.49.0-beta.0",
61
- "@spectrum-web-components/button": "^0.49.0-beta.0",
62
- "@spectrum-web-components/icons-workflow": "^0.49.0-beta.0"
60
+ "@spectrum-web-components/base": "^0.49.0-beta.2",
61
+ "@spectrum-web-components/button": "^0.49.0-beta.2",
62
+ "@spectrum-web-components/icons-workflow": "^0.49.0-beta.2"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@spectrum-css/alertbanner": "^2.2.0"
@@ -70,5 +70,5 @@
70
70
  "./sp-*.js",
71
71
  "./**/*.dev.js"
72
72
  ],
73
- "gitHead": "1aa9165b6529e70339c9c632d47335a2c0894f0b"
73
+ "gitHead": "2a8752a182e31dfd71c010b72bece20b0b5d1c9e"
74
74
  }
@@ -110,7 +110,7 @@ export class AlertBanner extends SpectrumElement {
110
110
  <sp-close-button
111
111
  @click=${this.shouldClose}
112
112
  label="Close"
113
- static="white"
113
+ static-color="white"
114
114
  ></sp-close-button>
115
115
  ` : html``}
116
116
  </div>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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"],
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-color=\"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.handleK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K;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
6
  "names": []
7
7
  }
@@ -18,7 +18,7 @@
18
18
  <sp-close-button
19
19
  @click=${this.shouldClose}
20
20
  label="Close"
21
- static="white"
21
+ static-color="white"
22
22
  ></sp-close-button>
23
23
  `:i``}
24
24
  </div>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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"],
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-color=\"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
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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ACL,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
6
  "names": ["html", "SpectrumElement", "property", "styles", "VALID_VARIANTS", "variant", "oldValue", "event", "changes", "__decorateClass"]
7
7
  }
package/stories/index.js CHANGED
@@ -15,7 +15,7 @@ export const AlertBannerMarkup = ({
15
15
  ?open=${open}
16
16
  >
17
17
  ${text}
18
- <sp-button treatment="outline" static="white" slot="action">
18
+ <sp-button treatment="outline" static-color="white" slot="action">
19
19
  ${actionLabel}
20
20
  </sp-button>
21
21
  </sp-alert-banner>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport { AlertBannerVariants } from '@spectrum-web-components/alert-banner';\nimport '@spectrum-web-components/alert-banner/sp-alert-banner.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nexport const AlertBannerMarkup = ({\n text = 'Your trial has expired',\n variant = 'neutral',\n dismissible = true,\n open = false,\n actionLabel = 'Action',\n}): TemplateResult => html`\n <sp-alert-banner\n variant=${variant as AlertBannerVariants}\n ?dismissible=${dismissible}\n ?open=${open}\n >\n ${text}\n <sp-button treatment=\"outline\" static=\"white\" slot=\"action\">\n ${actionLabel}\n </sp-button>\n </sp-alert-banner>\n`;\n"],
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';\n\nimport { AlertBannerVariants } from '@spectrum-web-components/alert-banner';\nimport '@spectrum-web-components/alert-banner/sp-alert-banner.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nexport const AlertBannerMarkup = ({\n text = 'Your trial has expired',\n variant = 'neutral',\n dismissible = true,\n open = false,\n actionLabel = 'Action',\n}): TemplateResult => html`\n <sp-alert-banner\n variant=${variant as AlertBannerVariants}\n ?dismissible=${dismissible}\n ?open=${open}\n >\n ${text}\n <sp-button treatment=\"outline\" static-color=\"white\" slot=\"action\">\n ${actionLabel}\n </sp-button>\n </sp-alert-banner>\n`;\n"],
5
5
  "mappings": ";AAYA,SAAS,YAA4B;AAGrC,OAAO;AACP,OAAO;AAEA,aAAM,oBAAoB,CAAC;AAAA,EAC9B,OAAO;AAAA,EACP,UAAU;AAAA,EACV,cAAc;AAAA,EACd,OAAO;AAAA,EACP,cAAc;AAClB,MAAsB;AAAA;AAAA,kBAEJ,OAA8B;AAAA,uBACzB,WAAW;AAAA,gBAClB,IAAI;AAAA;AAAA,UAEV,IAAI;AAAA;AAAA,cAEA,WAAW;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }