@spectrum-web-components/action-bar 0.39.3 → 0.40.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/action-bar",
3
- "version": "0.39.3",
3
+ "version": "0.40.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -57,11 +57,11 @@
57
57
  "lit-html"
58
58
  ],
59
59
  "dependencies": {
60
- "@spectrum-web-components/action-group": "^0.39.3",
61
- "@spectrum-web-components/base": "^0.39.3",
62
- "@spectrum-web-components/button": "^0.39.3",
63
- "@spectrum-web-components/field-label": "^0.39.3",
64
- "@spectrum-web-components/popover": "^0.39.3"
60
+ "@spectrum-web-components/action-group": "^0.40.0",
61
+ "@spectrum-web-components/base": "^0.40.0",
62
+ "@spectrum-web-components/button": "^0.40.0",
63
+ "@spectrum-web-components/field-label": "^0.40.0",
64
+ "@spectrum-web-components/popover": "^0.40.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@spectrum-css/actionbar": "^7.0.1"
@@ -72,5 +72,5 @@
72
72
  "./sp-*.js",
73
73
  "./**/*.dev.js"
74
74
  ],
75
- "gitHead": "d7840b3a9b99db4de62c44e3fb91b69dec7319af"
75
+ "gitHead": "24d5569a839da94892ecfd125428779587ffb1f5"
76
76
  }
@@ -52,7 +52,9 @@ export class ActionBar extends SpectrumElement {
52
52
  this.open = false;
53
53
  const applyDefault = this.dispatchEvent(
54
54
  new Event("close", {
55
- bubbles: true
55
+ bubbles: true,
56
+ composed: true,
57
+ cancelable: true
56
58
  })
57
59
  );
58
60
  if (!applyDefault) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["ActionBar.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 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 {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport actionBarStyles from './action-bar.css.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nexport const actionBarVariants = ['sticky', 'fixed'];\n\n/**\n * @element sp-action-bar\n * @slot - Content to display with the Action Bar\n */\nexport class ActionBar extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [actionBarStyles];\n }\n\n /**\n * Deliver the Action Bar with additional visual emphasis.\n */\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n /**\n * When `flexible` the action bar sizes itself to its content\n * rather than a specific width.\n *\n * @param {Boolean} flexible\n */\n @property({ type: Boolean, reflect: true })\n public flexible = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * The variant applies specific styling when set to `sticky` or `fixed`.\n * `variant` attribute is removed when not matching one of the above.\n *\n * @param {String} variant\n */\n @property({ type: String, reflect: true })\n public set variant(variant: string) {\n if (variant === this.variant) {\n return;\n }\n if (actionBarVariants.includes(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n return;\n }\n this.removeAttribute('variant');\n this._variant = '';\n }\n\n public get variant(): string {\n return this._variant;\n }\n\n private _variant = '';\n\n private handleClick(): void {\n this.open = false;\n\n const applyDefault = this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n\n if (!applyDefault) {\n this.open = true;\n }\n }\n\n public override render(): TemplateResult {\n return html`\n <sp-popover ?open=${this.open} id=\"popover\">\n <slot name=\"override\">\n <sp-close-button\n static=${ifDefined(\n this.emphasized ? 'white' : undefined\n )}\n class=\"close-button\"\n label=\"Clear selection\"\n @click=${this.handleClick}\n ></sp-close-button>\n <sp-field-label class=\"field-label\">\n <slot></slot>\n </sp-field-label>\n <sp-action-group\n class=\"action-group\"\n quiet\n static=${ifDefined(\n this.emphasized ? 'white' : undefined\n )}\n >\n <slot name=\"buttons\"></slot>\n </sp-action-group>\n </slot>\n </sp-popover>\n `;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,qBAAqB;AAC5B,SAAS,iBAAiB;AACnB,aAAM,oBAAoB,CAAC,UAAU,OAAO;AAM5C,aAAM,kBAAkB,gBAAgB;AAAA,EAAxC;AAAA;AASH,SAAO,aAAa;AASpB,SAAO,WAAW;AAGlB,SAAO,OAAO;AA0Bd,SAAQ,WAAW;AAAA;AAAA,EA9CnB,WAA2B,SAAyB;AAChD,WAAO,CAAC,eAAe;AAAA,EAC3B;AAAA,EA2BA,IAAW,QAAQ,SAAiB;AAChC,QAAI,YAAY,KAAK,SAAS;AAC1B;AAAA,IACJ;AACA,QAAI,kBAAkB,SAAS,OAAO,GAAG;AACrC,WAAK,aAAa,WAAW,OAAO;AACpC,WAAK,WAAW;AAChB;AAAA,IACJ;AACA,SAAK,gBAAgB,SAAS;AAC9B,SAAK,WAAW;AAAA,EACpB;AAAA,EAEA,IAAW,UAAkB;AACzB,WAAO,KAAK;AAAA,EAChB;AAAA,EAIQ,cAAoB;AACxB,SAAK,OAAO;AAEZ,UAAM,eAAe,KAAK;AAAA,MACtB,IAAI,MAAM,SAAS;AAAA,QACf,SAAS;AAAA,MACb,CAAC;AAAA,IACL;AAEA,QAAI,CAAC,cAAc;AACf,WAAK,OAAO;AAAA,IAChB;AAAA,EACJ;AAAA,EAEgB,SAAyB;AACrC,WAAO;AAAA,gCACiB,KAAK,IAAI;AAAA;AAAA;AAAA,iCAGR;AAAA,MACL,KAAK,aAAa,UAAU;AAAA,IAChC,CAAC;AAAA;AAAA;AAAA,iCAGQ,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAQhB;AAAA,MACL,KAAK,aAAa,UAAU;AAAA,IAChC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB;AACJ;AAlFW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GARjC,UASF;AASA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAjBjC,UAkBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GApBjC,UAqBF;AASI;AAAA,EADV,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GA7BhC,UA8BE;",
4
+ "sourcesContent": ["/*\nCopyright 2020 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 {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport actionBarStyles from './action-bar.css.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nexport const actionBarVariants = ['sticky', 'fixed'];\n\n/**\n * @element sp-action-bar\n * @slot - Content to display with the Action Bar\n */\nexport class ActionBar extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [actionBarStyles];\n }\n\n /**\n * Deliver the Action Bar with additional visual emphasis.\n */\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n /**\n * When `flexible` the action bar sizes itself to its content\n * rather than a specific width.\n *\n * @param {Boolean} flexible\n */\n @property({ type: Boolean, reflect: true })\n public flexible = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * The variant applies specific styling when set to `sticky` or `fixed`.\n * `variant` attribute is removed when not matching one of the above.\n *\n * @param {String} variant\n */\n @property({ type: String, reflect: true })\n public set variant(variant: string) {\n if (variant === this.variant) {\n return;\n }\n if (actionBarVariants.includes(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n return;\n }\n this.removeAttribute('variant');\n this._variant = '';\n }\n\n public get variant(): string {\n return this._variant;\n }\n\n private _variant = '';\n\n private handleClick(): void {\n this.open = false;\n\n const applyDefault = this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n if (!applyDefault) {\n this.open = true;\n }\n }\n\n public override render(): TemplateResult {\n return html`\n <sp-popover ?open=${this.open} id=\"popover\">\n <slot name=\"override\">\n <sp-close-button\n static=${ifDefined(\n this.emphasized ? 'white' : undefined\n )}\n class=\"close-button\"\n label=\"Clear selection\"\n @click=${this.handleClick}\n ></sp-close-button>\n <sp-field-label class=\"field-label\">\n <slot></slot>\n </sp-field-label>\n <sp-action-group\n class=\"action-group\"\n quiet\n static=${ifDefined(\n this.emphasized ? 'white' : undefined\n )}\n >\n <slot name=\"buttons\"></slot>\n </sp-action-group>\n </slot>\n </sp-popover>\n `;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA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N,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GARjC,UASF;AASA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAjBjC,UAkBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GApBjC,UAqBF;AASI;AAAA,EADV,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GA7BhC,UA8BE;",
6
6
  "names": []
7
7
  }
package/src/ActionBar.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var r=(o,i,e,s)=>{for(var t=s>1?void 0:s?c(i,e):i,p=o.length-1,a;p>=0;p--)(a=o[p])&&(t=(s?a(i,e,t):a(t))||t);return s&&t&&u(i,e,t),t};import{html as f,SpectrumElement as d}from"@spectrum-web-components/base";import{property as l}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/popover/sp-popover.js";import"@spectrum-web-components/action-group/sp-action-group.js";import"@spectrum-web-components/button/sp-close-button.js";import"@spectrum-web-components/field-label/sp-field-label.js";import m from"./action-bar.css.js";import{ifDefined as n}from"@spectrum-web-components/base/src/directives.js";export const actionBarVariants=["sticky","fixed"];export class ActionBar extends d{constructor(){super(...arguments);this.emphasized=!1;this.flexible=!1;this.open=!1;this._variant=""}static get styles(){return[m]}set variant(e){if(e!==this.variant){if(actionBarVariants.includes(e)){this.setAttribute("variant",e),this._variant=e;return}this.removeAttribute("variant"),this._variant=""}}get variant(){return this._variant}handleClick(){this.open=!1,this.dispatchEvent(new Event("close",{bubbles:!0}))||(this.open=!0)}render(){return f`
1
+ "use strict";var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var r=(o,i,e,s)=>{for(var t=s>1?void 0:s?c(i,e):i,p=o.length-1,a;p>=0;p--)(a=o[p])&&(t=(s?a(i,e,t):a(t))||t);return s&&t&&u(i,e,t),t};import{html as f,SpectrumElement as d}from"@spectrum-web-components/base";import{property as l}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/popover/sp-popover.js";import"@spectrum-web-components/action-group/sp-action-group.js";import"@spectrum-web-components/button/sp-close-button.js";import"@spectrum-web-components/field-label/sp-field-label.js";import m from"./action-bar.css.js";import{ifDefined as n}from"@spectrum-web-components/base/src/directives.js";export const actionBarVariants=["sticky","fixed"];export class ActionBar extends d{constructor(){super(...arguments);this.emphasized=!1;this.flexible=!1;this.open=!1;this._variant=""}static get styles(){return[m]}set variant(e){if(e!==this.variant){if(actionBarVariants.includes(e)){this.setAttribute("variant",e),this._variant=e;return}this.removeAttribute("variant"),this._variant=""}}get variant(){return this._variant}handleClick(){this.open=!1,this.dispatchEvent(new Event("close",{bubbles:!0,composed:!0,cancelable:!0}))||(this.open=!0)}render(){return f`
2
2
  <sp-popover ?open=${this.open} id="popover">
3
3
  <slot name="override">
4
4
  <sp-close-button
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["ActionBar.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 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 {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport actionBarStyles from './action-bar.css.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nexport const actionBarVariants = ['sticky', 'fixed'];\n\n/**\n * @element sp-action-bar\n * @slot - Content to display with the Action Bar\n */\nexport class ActionBar extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [actionBarStyles];\n }\n\n /**\n * Deliver the Action Bar with additional visual emphasis.\n */\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n /**\n * When `flexible` the action bar sizes itself to its content\n * rather than a specific width.\n *\n * @param {Boolean} flexible\n */\n @property({ type: Boolean, reflect: true })\n public flexible = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * The variant applies specific styling when set to `sticky` or `fixed`.\n * `variant` attribute is removed when not matching one of the above.\n *\n * @param {String} variant\n */\n @property({ type: String, reflect: true })\n public set variant(variant: string) {\n if (variant === this.variant) {\n return;\n }\n if (actionBarVariants.includes(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n return;\n }\n this.removeAttribute('variant');\n this._variant = '';\n }\n\n public get variant(): string {\n return this._variant;\n }\n\n private _variant = '';\n\n private handleClick(): void {\n this.open = false;\n\n const applyDefault = this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n\n if (!applyDefault) {\n this.open = true;\n }\n }\n\n public override render(): TemplateResult {\n return html`\n <sp-popover ?open=${this.open} id=\"popover\">\n <slot name=\"override\">\n <sp-close-button\n static=${ifDefined(\n this.emphasized ? 'white' : undefined\n )}\n class=\"close-button\"\n label=\"Clear selection\"\n @click=${this.handleClick}\n ></sp-close-button>\n <sp-field-label class=\"field-label\">\n <slot></slot>\n </sp-field-label>\n <sp-action-group\n class=\"action-group\"\n quiet\n static=${ifDefined(\n this.emphasized ? 'white' : undefined\n )}\n >\n <slot name=\"buttons\"></slot>\n </sp-action-group>\n </slot>\n </sp-popover>\n `;\n }\n}\n"],
5
- "mappings": "qNAYA,OAEI,QAAAA,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,MAAO,iDACP,MAAO,2D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AC,GA7BhC,UA8BE",
4
+ "sourcesContent": ["/*\nCopyright 2020 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 {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport actionBarStyles from './action-bar.css.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nexport const actionBarVariants = ['sticky', 'fixed'];\n\n/**\n * @element sp-action-bar\n * @slot - Content to display with the Action Bar\n */\nexport class ActionBar extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [actionBarStyles];\n }\n\n /**\n * Deliver the Action Bar with additional visual emphasis.\n */\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n /**\n * When `flexible` the action bar sizes itself to its content\n * rather than a specific width.\n *\n * @param {Boolean} flexible\n */\n @property({ type: Boolean, reflect: true })\n public flexible = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * The variant applies specific styling when set to `sticky` or `fixed`.\n * `variant` attribute is removed when not matching one of the above.\n *\n * @param {String} variant\n */\n @property({ type: String, reflect: true })\n public set variant(variant: string) {\n if (variant === this.variant) {\n return;\n }\n if (actionBarVariants.includes(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n return;\n }\n this.removeAttribute('variant');\n this._variant = '';\n }\n\n public get variant(): string {\n return this._variant;\n }\n\n private _variant = '';\n\n private handleClick(): void {\n this.open = false;\n\n const applyDefault = this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n\n if (!applyDefault) {\n this.open = true;\n }\n }\n\n public override render(): TemplateResult {\n return html`\n <sp-popover ?open=${this.open} id=\"popover\">\n <slot name=\"override\">\n <sp-close-button\n static=${ifDefined(\n this.emphasized ? 'white' : undefined\n )}\n class=\"close-button\"\n label=\"Clear selection\"\n @click=${this.handleClick}\n ></sp-close-button>\n <sp-field-label class=\"field-label\">\n <slot></slot>\n </sp-field-label>\n <sp-action-group\n class=\"action-group\"\n quiet\n static=${ifDefined(\n this.emphasized ? 'white' : undefined\n )}\n >\n <slot name=\"buttons\"></slot>\n </sp-action-group>\n </slot>\n </sp-popover>\n `;\n }\n}\n"],
5
+ "mappings": "qNAYA,OAEI,QAAAA,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,MAAO,iDACP,MAAO,2DACP,MAAO,qDACP,MAAO,yDACP,OAAOC,MAAqB,sBAC5B,OAAS,aAAAC,MAAiB,kDACnB,aAAM,kBAAoB,CAAC,SAAU,OAAO,EAM5C,aAAM,kBAAkBH,CAAgB,CAAxC,kCASH,KAAO,WAAa,GASpB,KAAO,SAAW,GAGlB,KAAO,KAAO,GA0Bd,KAAQ,SAAW,GA9CnB,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAe,CAC3B,CA2BA,IAAW,QAAQE,EAAiB,CAChC,GAAIA,IAAY,KAAK,QAGrB,IAAI,kBAAkB,SAASA,CAAO,EAAG,CACrC,KAAK,aAAa,UAAWA,CAAO,EACpC,KAAK,SAAWA,EAChB,MACJ,CACA,KAAK,gBAAgB,SAAS,EAC9B,KAAK,SAAW,GACpB,CAEA,IAAW,SAAkB,CACzB,OAAO,KAAK,QAChB,CAIQ,aAAoB,CACxB,KAAK,KAAO,GAES,KAAK,cACtB,IAAI,MAAM,QAAS,CACf,QAAS,GACT,SAAU,GACV,WAAY,EAChB,CAAC,CACL,IAGI,KAAK,KAAO,GAEpB,CAEgB,QAAyB,CACrC,OAAOL;AAAA,gCACiB,KAAK,IAAI;AAAA;AAAA;AAAA,iCAGRI,EACL,KAAK,WAAa,QAAU,MAChC,CAAC;AAAA;AAAA;AAAA,iCAGQ,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAQhBA,EACL,KAAK,WAAa,QAAU,MAChC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAOrB,CACJ,CApFWE,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARjC,UASF,0BASAI,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAjBjC,UAkBF,wBAGAI,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GApBjC,UAqBF,oBASII,EAAA,CADVJ,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GA7BhC,UA8BE",
6
6
  "names": ["html", "SpectrumElement", "property", "actionBarStyles", "ifDefined", "variant", "__decorateClass"]
7
7
  }
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
3
3
  import "@spectrum-web-components/action-bar/sp-action-bar.js";
4
- import { Default } from "../stories/action-bar.stories.js";
4
+ import { Default, emphasized } from "../stories/action-bar.stories.js";
5
5
  import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
6
+ import { spy } from "sinon";
6
7
  describe("ActionBar", () => {
7
8
  testForLitDevWarnings(async () => await fixture(Default()));
8
9
  it("loads", async () => {
@@ -51,5 +52,30 @@ describe("ActionBar", () => {
51
52
  expect(el.variant).to.equal("fixed");
52
53
  expect(el.getAttribute("variant")).to.equal("fixed");
53
54
  });
55
+ it("dispatches close event", async () => {
56
+ const el = await fixture(emphasized());
57
+ const closeSpy = spy();
58
+ el.addEventListener("close", () => closeSpy());
59
+ expect(closeSpy.callCount).to.equal(0);
60
+ expect(el.open).to.be.true;
61
+ const closeButton = el.shadowRoot.querySelector("sp-close-button");
62
+ closeButton == null ? void 0 : closeButton.click();
63
+ expect(closeSpy.callCount).to.equal(1);
64
+ expect(el.open).to.be.false;
65
+ });
66
+ it("can have close event prevented", async () => {
67
+ const el = await fixture(emphasized());
68
+ const closeSpy = spy();
69
+ el.addEventListener("close", (event) => {
70
+ event.preventDefault();
71
+ closeSpy();
72
+ });
73
+ expect(closeSpy.callCount).to.equal(0);
74
+ expect(el.open).to.be.true;
75
+ const closeButton = el.shadowRoot.querySelector("sp-close-button");
76
+ closeButton == null ? void 0 : closeButton.click();
77
+ expect(closeSpy.callCount).to.equal(1);
78
+ expect(el.open).to.be.true;
79
+ });
54
80
  });
55
81
  //# sourceMappingURL=action-bar.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["action-bar.test.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '@spectrum-web-components/action-bar/sp-action-bar.js';\nimport { ActionBar } from '@spectrum-web-components/action-bar';\nimport { Default } from '../stories/action-bar.stories.js';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('ActionBar', () => {\n testForLitDevWarnings(async () => await fixture<ActionBar>(Default()));\n it('loads', async () => {\n const el = await fixture<ActionBar>(Default());\n\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n\n it('accepts variants', async () => {\n const el = await fixture<ActionBar>(\n html`\n <sp-action-bar variant=\"sticky\">Help text.</sp-action-bar>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('sticky');\n expect(el.getAttribute('variant')).to.equal('sticky');\n\n el.variant = 'fixed';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('fixed');\n expect(el.getAttribute('variant')).to.equal('fixed');\n\n el.setAttribute('variant', 'sticky');\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('sticky');\n expect(el.getAttribute('variant')).to.equal('sticky');\n\n el.removeAttribute('variant');\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('');\n expect(el.hasAttribute('variant')).to.be.false;\n });\n it('validates variants', async () => {\n const el = await fixture<ActionBar>(\n html`\n <sp-action-bar variant=\"other\">Help text.</sp-action-bar>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('');\n expect(el.hasAttribute('variant')).to.be.false;\n\n el.variant = 'fixed';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('fixed');\n expect(el.getAttribute('variant')).to.equal('fixed');\n\n el.variant = 'fixed';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('fixed');\n expect(el.getAttribute('variant')).to.equal('fixed');\n });\n});\n"],
5
- "mappings": ";AAYA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAEtD,OAAO;AAEP,SAAS,eAAe;AACxB,SAAS,6BAA6B;AAEtC,SAAS,aAAa,MAAM;AACxB,wBAAsB,YAAY,MAAM,QAAmB,QAAQ,CAAC,CAAC;AACrE,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM,QAAmB,QAAQ,CAAC;AAE7C,UAAM,eAAe,EAAE;AAEvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AAED,KAAG,oBAAoB,YAAY;AAC/B,UAAM,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",
4
+ "sourcesContent": ["/*\nCopyright 2020 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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '@spectrum-web-components/action-bar/sp-action-bar.js';\nimport { ActionBar } from '@spectrum-web-components/action-bar';\nimport { Default, emphasized } from '../stories/action-bar.stories.js';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\nimport { spy } from 'sinon';\n\ndescribe('ActionBar', () => {\n testForLitDevWarnings(async () => await fixture<ActionBar>(Default()));\n it('loads', async () => {\n const el = await fixture<ActionBar>(Default());\n\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n\n it('accepts variants', async () => {\n const el = await fixture<ActionBar>(\n html`\n <sp-action-bar variant=\"sticky\">Help text.</sp-action-bar>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('sticky');\n expect(el.getAttribute('variant')).to.equal('sticky');\n\n el.variant = 'fixed';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('fixed');\n expect(el.getAttribute('variant')).to.equal('fixed');\n\n el.setAttribute('variant', 'sticky');\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('sticky');\n expect(el.getAttribute('variant')).to.equal('sticky');\n\n el.removeAttribute('variant');\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('');\n expect(el.hasAttribute('variant')).to.be.false;\n });\n it('validates variants', async () => {\n const el = await fixture<ActionBar>(\n html`\n <sp-action-bar variant=\"other\">Help text.</sp-action-bar>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('');\n expect(el.hasAttribute('variant')).to.be.false;\n\n el.variant = 'fixed';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('fixed');\n expect(el.getAttribute('variant')).to.equal('fixed');\n\n el.variant = 'fixed';\n\n await elementUpdated(el);\n\n expect(el.variant).to.equal('fixed');\n expect(el.getAttribute('variant')).to.equal('fixed');\n });\n it('dispatches close event', async () => {\n const el = await fixture<ActionBar>(emphasized());\n const closeSpy = spy();\n el.addEventListener('close', () => closeSpy());\n expect(closeSpy.callCount).to.equal(0);\n expect(el.open).to.be.true;\n const closeButton = el.shadowRoot.querySelector('sp-close-button');\n closeButton?.click();\n expect(closeSpy.callCount).to.equal(1);\n expect(el.open).to.be.false;\n });\n it('can have close event prevented', async () => {\n const el = await fixture<ActionBar>(emphasized());\n const closeSpy = spy();\n el.addEventListener('close', (event: Event) => {\n event.preventDefault();\n closeSpy();\n });\n expect(closeSpy.callCount).to.equal(0);\n expect(el.open).to.be.true;\n const closeButton = el.shadowRoot.querySelector('sp-close-button');\n closeButton?.click();\n expect(closeSpy.callCount).to.equal(1);\n expect(el.open).to.be.true;\n });\n});\n"],
5
+ "mappings": ";AAYA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAEtD,OAAO;AAEP,SAAS,SAAS,kBAAkB;AACpC,SAAS,6BAA6B;AACtC,SAAS,WAAW;AAEpB,SAAS,aAAa,MAAM;AACxB,wBAAsB,YAAY,MAAM,QAAmB,QAAQ,CAAC,CAAC;AACrE,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM,QAAmB,QAAQ,CAAC;AAE7C,UAAM,eAAe,EAAE;AAEvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AAED,KAAG,oBAAoB,YAAY;AAC/B,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,WA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