@spectrum-web-components/tray 0.4.0 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/tray",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -58,8 +58,8 @@
58
58
  ],
59
59
  "dependencies": {
60
60
  "@spectrum-web-components/base": "^0.7.0",
61
- "@spectrum-web-components/modal": "^0.7.0",
62
- "@spectrum-web-components/reactive-controllers": "^0.3.0",
61
+ "@spectrum-web-components/modal": "^0.7.1",
62
+ "@spectrum-web-components/reactive-controllers": "^0.3.1",
63
63
  "@spectrum-web-components/shared": "^0.15.0",
64
64
  "@spectrum-web-components/underlay": "^0.9.0",
65
65
  "tslib": "^2.0.0"
@@ -73,5 +73,5 @@
73
73
  "./sp-*.js",
74
74
  "./**/*.dev.js"
75
75
  ],
76
- "gitHead": "05c81318844160db3f8156144106e643507fef97"
76
+ "gitHead": "15588c72c774b17cfac605b20ac52a27d123bd03"
77
77
  }
package/sp-tray.dev.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import { Tray } from "./src/Tray.dev.js";
2
3
  customElements.define("sp-tray", Tray);
3
4
  //# sourceMappingURL=sp-tray.dev.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["sp-tray.ts"],
4
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 { Tray } from './src/Tray.dev.js'\n\ncustomElements.define('sp-tray', Tray);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tray': Tray;\n }\n}\n"],
5
- "mappings": "AAYA;AAEA,eAAe,OAAO,WAAW,IAAI;",
5
+ "mappings": ";AAYA,SAAS,YAAY;AAErB,eAAe,OAAO,WAAW,IAAI;",
6
6
  "names": []
7
7
  }
package/sp-tray.js CHANGED
@@ -1,2 +1,2 @@
1
- import{Tray as e}from"./src/Tray.js";customElements.define("sp-tray",e);
1
+ "use strict";import{Tray as e}from"./src/Tray.js";customElements.define("sp-tray",e);
2
2
  //# sourceMappingURL=sp-tray.js.map
package/sp-tray.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["sp-tray.ts"],
4
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 { Tray } from './src/Tray.js';\n\ncustomElements.define('sp-tray', Tray);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tray': Tray;\n }\n}\n"],
5
- "mappings": "AAYA,qCAEA,eAAe,OAAO,UAAW,CAAI",
6
- "names": []
5
+ "mappings": "aAYA,OAAS,QAAAA,MAAY,gBAErB,eAAe,OAAO,UAAWA,CAAI",
6
+ "names": ["Tray"]
7
7
  }
package/src/Tray.dev.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __decorateClass = (decorators, target, key, kind) => {
@@ -26,7 +27,10 @@ export class Tray extends SpectrumElement {
26
27
  constructor() {
27
28
  super(...arguments);
28
29
  this.open = false;
29
- this.prefersMotion = new MatchMediaController(this, "(prefers-reduced-motion: no-preference)");
30
+ this.prefersMotion = new MatchMediaController(
31
+ this,
32
+ "(prefers-reduced-motion: no-preference)"
33
+ );
30
34
  this.transitionPromise = Promise.resolve();
31
35
  }
32
36
  static get styles() {
@@ -55,9 +59,11 @@ export class Tray extends SpectrumElement {
55
59
  }
56
60
  }
57
61
  dispatchClosed() {
58
- this.dispatchEvent(new Event("close", {
59
- bubbles: true
60
- }));
62
+ this.dispatchEvent(
63
+ new Event("close", {
64
+ bubbles: true
65
+ })
66
+ );
61
67
  }
62
68
  handleUnderlayTransitionend() {
63
69
  if (!this.open) {
@@ -72,7 +78,9 @@ export class Tray extends SpectrumElement {
72
78
  }
73
79
  update(changes) {
74
80
  if (changes.has("open") && changes.get("open") !== void 0 && this.prefersMotion.matches) {
75
- this.transitionPromise = new Promise((res) => this.resolveTransitionPromise = res);
81
+ this.transitionPromise = new Promise(
82
+ (res) => this.resolveTransitionPromise = res
83
+ );
76
84
  }
77
85
  super.update(changes);
78
86
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["Tray.ts"],
4
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 PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\nimport { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';\n\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport styles from './tray.css.js';\n\n/**\n * @element sp-tray\n *\n * @slot - content to display within the Tray\n *\n * @fires close - Announces that the Tray has been closed.\n */\nexport class Tray extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [modalStyles, styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n protected prefersMotion = new MatchMediaController(\n this,\n '(prefers-reduced-motion: no-preference)'\n );\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise!: () => void;\n\n @query('.tray')\n private tray!: HTMLDivElement;\n\n public override focus(): void {\n const firstFocusable = firstFocusableIn(this);\n if (firstFocusable) {\n firstFocusable.focus();\n } else if (this.children.length === 1) {\n this.tray.focus();\n } else {\n super.focus();\n }\n }\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return false;\n this.close();\n return true;\n }\n\n public close(): void {\n this.open = false;\n if (!this.prefersMotion.matches) {\n this.dispatchClosed();\n }\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected handleUnderlayTransitionend(): void {\n if (!this.open) {\n this.dispatchClosed();\n this.resolveTransitionPromise();\n }\n }\n\n protected handleTrayTransitionend(): void {\n if (this.open) {\n this.resolveTransitionPromise();\n }\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (\n changes.has('open') &&\n changes.get('open') !== undefined &&\n this.prefersMotion.matches\n ) {\n this.transitionPromise = new Promise(\n (res) => (this.resolveTransitionPromise = res)\n );\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.close}\n @transitionend=${this.handleUnderlayTransitionend}\n ></sp-underlay>\n <div\n class=\"tray modal\"\n tabindex=\"-1\"\n @transitionend=${this.handleTrayTransitionend}\n >\n <slot></slot>\n </div>\n `;\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;AAEA;AACA;AASO,aAAM,aAAa,gBAAgB;AAAA,EAAnC;AAAA;AAMI,gBAAO;AAEJ,yBAAgB,IAAI,qBAC1B,MACA,yCACJ;AAEQ,6BAAoB,QAAQ,QAAQ;AAAA;AAAA,aAZjB,SAAyB;AAChD,WAAO,CAAC,aAAa,MAAM;AAAA,EAC/B;AAAA,EAiBgB,QAAc;AAC1B,UAAM,iBAAiB,iBAAiB,IAAI;AAC5C,QAAI,gBAAgB;AAChB,qBAAe,MAAM;AAAA,IACzB,WAAW,KAAK,SAAS,WAAW,GAAG;AACnC,WAAK,KAAK,MAAM;AAAA,IACpB,OAAO;AACH,YAAM,MAAM;AAAA,IAChB;AAAA,EACJ;AAAA,EAEO,2BAAoC;AACvC,QAAI,CAAC,KAAK;AAAM,aAAO;AACvB,SAAK,MAAM;AACX,WAAO;AAAA,EACX;AAAA,EAEO,QAAc;AACjB,SAAK,OAAO;AACZ,QAAI,CAAC,KAAK,cAAc,SAAS;AAC7B,WAAK,eAAe;AAAA,IACxB;AAAA,EACJ;AAAA,EAEQ,iBAAuB;AAC3B,SAAK,cACD,IAAI,MAAM,SAAS;AAAA,MACf,SAAS;AAAA,IACb,CAAC,CACL;AAAA,EACJ;AAAA,EAEU,8BAAoC;AAC1C,QAAI,CAAC,KAAK,MAAM;AACZ,WAAK,eAAe;AACpB,WAA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,KAAK;AACX,WAAO;AAAA,EACX;AACJ;AAtGW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GALjC,KAMF;AAYC;AAAA,EADP,MAAM,OAAO;AAAA,GAjBL,KAkBD;",
6
6
  "names": []
7
7
  }
package/src/Tray.js CHANGED
@@ -1,4 +1,4 @@
1
- var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var l=(o,e,r,i)=>{for(var t=i>1?void 0:i?p(e,r):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(t=(i?n(e,r,t):n(t))||t);return i&&t&&a(e,r,t),t};import{html as d,SpectrumElement as c}from"@spectrum-web-components/base";import{property as h,query as m}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/underlay/sp-underlay.js";import{firstFocusableIn as u}from"@spectrum-web-components/shared/src/first-focusable-in.js";import{MatchMediaController as f}from"@spectrum-web-components/reactive-controllers/src/MatchMedia.js";import v from"@spectrum-web-components/modal/src/modal.css.js";import y from"./tray.css.js";export class Tray extends c{constructor(){super(...arguments);this.open=!1;this.prefersMotion=new f(this,"(prefers-reduced-motion: no-preference)");this.transitionPromise=Promise.resolve()}static get styles(){return[v,y]}focus(){const e=u(this);e?e.focus():this.children.length===1?this.tray.focus():super.focus()}overlayWillCloseCallback(){return this.open?(this.close(),!0):!1}close(){this.open=!1,this.prefersMotion.matches||this.dispatchClosed()}dispatchClosed(){this.dispatchEvent(new Event("close",{bubbles:!0}))}handleUnderlayTransitionend(){this.open||(this.dispatchClosed(),this.resolveTransitionPromise())}handleTrayTransitionend(){this.open&&this.resolveTransitionPromise()}update(e){e.has("open")&&e.get("open")!==void 0&&this.prefersMotion.matches&&(this.transitionPromise=new Promise(r=>this.resolveTransitionPromise=r)),super.update(e)}render(){return d`
1
+ "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var l=(o,i,e,r)=>{for(var t=r>1?void 0:r?p(i,e):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(t=(r?n(i,e,t):n(t))||t);return r&&t&&a(i,e,t),t};import{html as d,SpectrumElement as c}from"@spectrum-web-components/base";import{property as h,query as m}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/underlay/sp-underlay.js";import{firstFocusableIn as u}from"@spectrum-web-components/shared/src/first-focusable-in.js";import{MatchMediaController as f}from"@spectrum-web-components/reactive-controllers/src/MatchMedia.js";import v from"@spectrum-web-components/modal/src/modal.css.js";import y from"./tray.css.js";export class Tray extends c{constructor(){super(...arguments);this.open=!1;this.prefersMotion=new f(this,"(prefers-reduced-motion: no-preference)");this.transitionPromise=Promise.resolve()}static get styles(){return[v,y]}focus(){const e=u(this);e?e.focus():this.children.length===1?this.tray.focus():super.focus()}overlayWillCloseCallback(){return this.open?(this.close(),!0):!1}close(){this.open=!1,this.prefersMotion.matches||this.dispatchClosed()}dispatchClosed(){this.dispatchEvent(new Event("close",{bubbles:!0}))}handleUnderlayTransitionend(){this.open||(this.dispatchClosed(),this.resolveTransitionPromise())}handleTrayTransitionend(){this.open&&this.resolveTransitionPromise()}update(e){e.has("open")&&e.get("open")!==void 0&&this.prefersMotion.matches&&(this.transitionPromise=new Promise(r=>this.resolveTransitionPromise=r)),super.update(e)}render(){return d`
2
2
  <sp-underlay
3
3
  ?open=${this.open}
4
4
  @click=${this.close}
package/src/Tray.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["Tray.ts"],
4
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 PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\nimport { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';\n\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport styles from './tray.css.js';\n\n/**\n * @element sp-tray\n *\n * @slot - content to display within the Tray\n *\n * @fires close - Announces that the Tray has been closed.\n */\nexport class Tray extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [modalStyles, styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n protected prefersMotion = new MatchMediaController(\n this,\n '(prefers-reduced-motion: no-preference)'\n );\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise!: () => void;\n\n @query('.tray')\n private tray!: HTMLDivElement;\n\n public override focus(): void {\n const firstFocusable = firstFocusableIn(this);\n if (firstFocusable) {\n firstFocusable.focus();\n } else if (this.children.length === 1) {\n this.tray.focus();\n } else {\n super.focus();\n }\n }\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return false;\n this.close();\n return true;\n }\n\n public close(): void {\n this.open = false;\n if (!this.prefersMotion.matches) {\n this.dispatchClosed();\n }\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected handleUnderlayTransitionend(): void {\n if (!this.open) {\n this.dispatchClosed();\n this.resolveTransitionPromise();\n }\n }\n\n protected handleTrayTransitionend(): void {\n if (this.open) {\n this.resolveTransitionPromise();\n }\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (\n changes.has('open') &&\n changes.get('open') !== undefined &&\n this.prefersMotion.matches\n ) {\n this.transitionPromise = new Promise(\n (res) => (this.resolveTransitionPromise = res)\n );\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.close}\n @transitionend=${this.handleUnderlayTransitionend}\n ></sp-underlay>\n <div\n class=\"tray modal\"\n tabindex=\"-1\"\n @transitionend=${this.handleTrayTransitionend}\n >\n <slot></slot>\n </div>\n `;\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
5
- "mappings": "wMAYA,0EAOA,sFAIA,yDACA,6FACA,uGAEA,+DACA,6BASO,aAAM,YAAa,EAAgB,CAAnC,kCAMI,UAAO,GAEJ,mBAAgB,GAAI,GAC1B,KACA,yCACJ,EAEQ,uBAAoB,QAAQ,QAAQ,YAZjB,SAAyB,CAChD,MAAO,CAAC,EAAa,CAAM,CAC/B,CAiBgB,OAAc,CAC1B,KAAM,GAAiB,EAAiB,IAAI,EAC5C,AAAI,EACA,EAAe,MAAM,EAClB,AAAI,KAAK,SAAS,SAAW,EAChC,KAAK,KAAK,MAAM,EAEhB,MAAM,MAAM,CAEpB,CAEO,0BAAoC,CACvC,MAAK,MAAK,KACV,MAAK,MAAM,EACJ,IAFgB,EAG3B,CAEO,OAAc,CACjB,KAAK,KAAO,GACP,KAAK,cAAc,SACpB,KAAK,eAAe,CAE5B,CAEQ,gBAAuB,CAC3B,KAAK,cACD,GAAI,OAAM,QAAS,CACf,QAAS,EACb,CAAC,CACL,CACJ,CAEU,6BAAoC,CAC1C,AAAK,KAAK,MACN,MAAK,eAAe,EACpB,KAAK,yBAAyB,EAEtC,CAEU,yBAAgC,CACtC,AAAI,KAAK,MACL,KAAK,yBAAyB,CAEtC,CAEmB,OAAO,EAAqC,CAC3D,AACI,EAAQ,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CAE5B,CAEQ,gBAAuB,CAC3B,KAAK,cACD,IAAI,MAAM,QAAS,CACf,QAAS,EACb,CAAC,CACL,CACJ,CAEU,6BAAoC,CACrC,KAAK,OACN,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAEtC,CAEU,yBAAgC,CAClC,KAAK,MACL,KAAK,yBAAyB,CAEtC,CAEmB,OAAOC,EAAqC,CAEvDA,EAAQ,IAAI,MAAM,GAClBA,EAAQ,IAAI,MAAM,IAAM,QACxB,KAAK,cAAc,UAEnB,KAAK,kBAAoB,IAAI,QACxBC,GAAS,KAAK,yBAA2BA,CAC9C,GAEJ,MAAM,OAAOD,CAAO,CACxB,CAEmB,QAAyB,CACxC,OAAOT;AAAA;AAAA,wBAES,KAAK;AAAA,yBACJ,KAAK;AAAA,iCACG,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKL,KAAK;AAAA;AAAA;AAAA;AAAA,SAKlC,CAUA,MAAyB,mBAAsC,CAC3D,MAAMW,EAAY,MAAM,MAAM,kBAAkB,EAChD,aAAM,KAAK,kBACJA,CACX,CACJ,CAtGWC,EAAA,CADNV,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GALjC,KAMF,oBAYCU,EAAA,CADPT,EAAM,OAAO,GAjBL,KAkBD",
6
+ "names": ["html", "SpectrumElement", "property", "query", "firstFocusableIn", "MatchMediaController", "modalStyles", "styles", "firstFocusable", "changes", "res", "complete", "__decorateClass"]
7
7
  }
package/src/index.dev.js CHANGED
@@ -1,2 +1,3 @@
1
+ "use strict";
1
2
  export * from "./Tray.dev.js";
2
3
  //# sourceMappingURL=index.dev.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
4
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\nexport * from './Tray.dev.js'\n"],
5
- "mappings": "AAYA;",
5
+ "mappings": ";AAYA,cAAc;",
6
6
  "names": []
7
7
  }
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export*from"./Tray.js";
1
+ "use strict";export*from"./Tray.js";
2
2
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
4
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\nexport * from './Tray.js';\n"],
5
- "mappings": "AAYA",
5
+ "mappings": "aAYA,WAAc",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import { css } from "@spectrum-web-components/base";
2
3
  const styles = css`
3
4
  :host([dir=ltr]){left:0}:host([dir=rtl]){right:0}:host{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}@media (max-width:375px){.spectrum-Tray{border-radius:var(--spectrum-tray-border-radius,0)}}
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["spectrum-tray-wrapper.css.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2022 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([dir=ltr]){left:0}:host([dir=rtl]){right:0}:host{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}@media (max-width:375px){.spectrum-Tray{border-radius:var(--spectrum-tray-border-radius,0)}}\n`;\nexport default styles;"],
5
- "mappings": "AAWA;AACA,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
5
+ "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import{css as t}from"@spectrum-web-components/base";const r=t`
1
+ "use strict";import{css as t}from"@spectrum-web-components/base";const r=t`
2
2
  :host([dir=ltr]){left:0}:host([dir=rtl]){right:0}:host{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}@media (max-width:375px){.spectrum-Tray{border-radius:var(--spectrum-tray-border-radius,0)}}
3
3
  `;export default r;
4
4
  //# sourceMappingURL=spectrum-tray-wrapper.css.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["spectrum-tray-wrapper.css.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2022 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([dir=ltr]){left:0}:host([dir=rtl]){right:0}:host{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}@media (max-width:375px){.spectrum-Tray{border-radius:var(--spectrum-tray-border-radius,0)}}\n`;\nexport default styles;"],
5
- "mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA,EAGf,cAAe",
6
- "names": []
5
+ "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
6
+ "names": ["css", "styles"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import { css } from "@spectrum-web-components/base";
2
3
  const styles = css`
3
4
  .tray{opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]) .tray{opacity:1;pointer-events:auto;transition-delay:0ms;visibility:visible}:host{--spectrum-dialog-confirm-exit-animation-delay:0ms;--spectrum-tray-margin-top:64px}:host([dir=ltr]) .spectrum-Tray-wrapper{left:0}:host([dir=rtl]) .spectrum-Tray-wrapper{right:0}.spectrum-Tray-wrapper{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}.tray{border-radius:var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["spectrum-tray.css.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2022 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.tray{opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]) .tray{opacity:1;pointer-events:auto;transition-delay:0ms;visibility:visible}:host{--spectrum-dialog-confirm-exit-animation-delay:0ms;--spectrum-tray-margin-top:64px}:host([dir=ltr]) .spectrum-Tray-wrapper{left:0}:host([dir=rtl]) .spectrum-Tray-wrapper{right:0}.spectrum-Tray-wrapper{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}.tray{border-radius:var(\n--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)\n) var(\n--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)\n) var(--spectrum-tray-border-radius,0) var(--spectrum-tray-border-radius,0);max-height:calc(100vh - var(--spectrum-tray-margin-top));max-width:var(--spectrum-tray-max-width,375px);min-height:var(\n--spectrum-tray-min-height,var(--spectrum-global-dimension-static-size-800)\n);outline:none;overflow:auto;padding:var(--spectrum-tray-padding-y,0) var(\n--spectrum-tray-padding-x,var(--spectrum-global-dimension-static-size-100)\n);transform:translateY(100%);transition:opacity var(\n--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)\n) cubic-bezier(.5,0,1,1) var(--spectrum-dialog-confirm-exit-animation-delay,0ms),visibility 0ms linear calc(var(--spectrum-dialog-confirm-exit-animation-delay, 0ms) + var(\n--spectrum-dialog-confirm-exit-animation-duration,\nvar(--spectrum-global-animation-duration-100)\n)),transform var(\n--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)\n) cubic-bezier(.5,0,1,1) var(--spectrum-dialog-confirm-exit-animation-delay,0ms);width:var(--spectrum-tray-width,100%)}:host([open]) .tray{transform:translateY(0);transition:transform var(\n--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)\n) cubic-bezier(0,0,.4,1) var(\n--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)\n),opacity var(\n--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)\n) cubic-bezier(0,0,.4,1) var(\n--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)\n)}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}\n`;\nexport default styles;"],
5
- "mappings": "AAWA;AACA,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0Bf,eAAe;",
5
+ "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0Bf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import{css as a}from"@spectrum-web-components/base";const r=a`
1
+ "use strict";import{css as a}from"@spectrum-web-components/base";const r=a`
2
2
  .tray{opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]) .tray{opacity:1;pointer-events:auto;transition-delay:0ms;visibility:visible}:host{--spectrum-dialog-confirm-exit-animation-delay:0ms;--spectrum-tray-margin-top:64px}:host([dir=ltr]) .spectrum-Tray-wrapper{left:0}:host([dir=rtl]) .spectrum-Tray-wrapper{right:0}.spectrum-Tray-wrapper{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}.tray{border-radius:var(
3
3
  --spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
4
4
  ) var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["spectrum-tray.css.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2022 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.tray{opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]) .tray{opacity:1;pointer-events:auto;transition-delay:0ms;visibility:visible}:host{--spectrum-dialog-confirm-exit-animation-delay:0ms;--spectrum-tray-margin-top:64px}:host([dir=ltr]) .spectrum-Tray-wrapper{left:0}:host([dir=rtl]) .spectrum-Tray-wrapper{right:0}.spectrum-Tray-wrapper{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}.tray{border-radius:var(\n--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)\n) var(\n--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)\n) var(--spectrum-tray-border-radius,0) var(--spectrum-tray-border-radius,0);max-height:calc(100vh - var(--spectrum-tray-margin-top));max-width:var(--spectrum-tray-max-width,375px);min-height:var(\n--spectrum-tray-min-height,var(--spectrum-global-dimension-static-size-800)\n);outline:none;overflow:auto;padding:var(--spectrum-tray-padding-y,0) var(\n--spectrum-tray-padding-x,var(--spectrum-global-dimension-static-size-100)\n);transform:translateY(100%);transition:opacity var(\n--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)\n) cubic-bezier(.5,0,1,1) var(--spectrum-dialog-confirm-exit-animation-delay,0ms),visibility 0ms linear calc(var(--spectrum-dialog-confirm-exit-animation-delay, 0ms) + var(\n--spectrum-dialog-confirm-exit-animation-duration,\nvar(--spectrum-global-animation-duration-100)\n)),transform var(\n--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)\n) cubic-bezier(.5,0,1,1) var(--spectrum-dialog-confirm-exit-animation-delay,0ms);width:var(--spectrum-tray-width,100%)}:host([open]) .tray{transform:translateY(0);transition:transform var(\n--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)\n) cubic-bezier(0,0,.4,1) var(\n--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)\n),opacity var(\n--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)\n) cubic-bezier(0,0,.4,1) var(\n--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)\n)}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}\n`;\nexport default styles;"],
5
- "mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Bf,cAAe",
6
- "names": []
5
+ "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Bf,eAAeC",
6
+ "names": ["css", "styles"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import { css } from "@spectrum-web-components/base";
2
3
  const styles = css`
3
4
  :host([dir=ltr]){left:0}:host([dir=rtl]){right:0}:host{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}@media (max-width:375px){.spectrum-Tray{border-radius:var(--spectrum-tray-border-radius,0)}}.tray{opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]) .tray{opacity:1;pointer-events:auto;transition-delay:0ms;visibility:visible}:host{--spectrum-dialog-confirm-exit-animation-delay:0ms;--spectrum-tray-margin-top:64px}:host([dir=ltr]) .spectrum-Tray-wrapper{left:0}:host([dir=rtl]) .spectrum-Tray-wrapper{right:0}.spectrum-Tray-wrapper{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}.tray{border-radius:var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["tray.css.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2022 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([dir=ltr]){left:0}:host([dir=rtl]){right:0}:host{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}@media (max-width:375px){.spectrum-Tray{border-radius:var(--spectrum-tray-border-radius,0)}}.tray{opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]) .tray{opacity:1;pointer-events:auto;transition-delay:0ms;visibility:visible}:host{--spectrum-dialog-confirm-exit-animation-delay:0ms;--spectrum-tray-margin-top:64px}:host([dir=ltr]) .spectrum-Tray-wrapper{left:0}:host([dir=rtl]) .spectrum-Tray-wrapper{right:0}.spectrum-Tray-wrapper{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}.tray{border-radius:var(\n--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)\n) var(\n--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)\n) var(--spectrum-tray-border-radius,0) var(--spectrum-tray-border-radius,0);max-height:calc(100vh - var(--spectrum-tray-margin-top));max-width:var(--spectrum-tray-max-width,375px);min-height:var(\n--spectrum-tray-min-height,var(--spectrum-global-dimension-static-size-800)\n);outline:none;overflow:auto;padding:var(--spectrum-tray-padding-y,0) var(\n--spectrum-tray-padding-x,var(--spectrum-global-dimension-static-size-100)\n);transform:translateY(100%);transition:opacity var(\n--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)\n) cubic-bezier(.5,0,1,1) var(--spectrum-dialog-confirm-exit-animation-delay,0ms),visibility 0ms linear calc(var(--spectrum-dialog-confirm-exit-animation-delay, 0ms) + var(\n--spectrum-dialog-confirm-exit-animation-duration,\nvar(--spectrum-global-animation-duration-100)\n)),transform var(\n--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)\n) cubic-bezier(.5,0,1,1) var(--spectrum-dialog-confirm-exit-animation-delay,0ms);width:var(--spectrum-tray-width,100%)}:host([open]) .tray{transform:translateY(0);transition:transform var(\n--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)\n) cubic-bezier(0,0,.4,1) var(\n--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)\n),opacity var(\n--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)\n) cubic-bezier(0,0,.4,1) var(\n--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)\n)}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}:host{align-items:flex-end;max-height:var(--swc-visual-viewport-height);position:fixed!important}sp-underlay{touch-action:none}.tray{display:inline-flex;overscroll-behavior:contain;padding:var(--spectrum-tray-padding-y,0) var(--spectrum-tray-padding-x,0)}::slotted(.visually-hidden){clip:rect(0,0,0,0);border:0;clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}\n`;\nexport default styles;"],
5
- "mappings": "AAWA;AACA,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0Bf,eAAe;",
5
+ "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0Bf,eAAe;",
6
6
  "names": []
7
7
  }
package/src/tray.css.js CHANGED
@@ -1,4 +1,4 @@
1
- import{css as r}from"@spectrum-web-components/base";const a=r`
1
+ "use strict";import{css as r}from"@spectrum-web-components/base";const a=r`
2
2
  :host([dir=ltr]){left:0}:host([dir=rtl]){right:0}:host{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}@media (max-width:375px){.spectrum-Tray{border-radius:var(--spectrum-tray-border-radius,0)}}.tray{opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]) .tray{opacity:1;pointer-events:auto;transition-delay:0ms;visibility:visible}:host{--spectrum-dialog-confirm-exit-animation-delay:0ms;--spectrum-tray-margin-top:64px}:host([dir=ltr]) .spectrum-Tray-wrapper{left:0}:host([dir=rtl]) .spectrum-Tray-wrapper{right:0}.spectrum-Tray-wrapper{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}.tray{border-radius:var(
3
3
  --spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
4
4
  ) var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["tray.css.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2022 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([dir=ltr]){left:0}:host([dir=rtl]){right:0}:host{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}@media (max-width:375px){.spectrum-Tray{border-radius:var(--spectrum-tray-border-radius,0)}}.tray{opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0ms linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]) .tray{opacity:1;pointer-events:auto;transition-delay:0ms;visibility:visible}:host{--spectrum-dialog-confirm-exit-animation-delay:0ms;--spectrum-tray-margin-top:64px}:host([dir=ltr]) .spectrum-Tray-wrapper{left:0}:host([dir=rtl]) .spectrum-Tray-wrapper{right:0}.spectrum-Tray-wrapper{bottom:0;display:flex;justify-content:center;position:fixed;width:100%;z-index:2}.tray{border-radius:var(\n--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)\n) var(\n--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)\n) var(--spectrum-tray-border-radius,0) var(--spectrum-tray-border-radius,0);max-height:calc(100vh - var(--spectrum-tray-margin-top));max-width:var(--spectrum-tray-max-width,375px);min-height:var(\n--spectrum-tray-min-height,var(--spectrum-global-dimension-static-size-800)\n);outline:none;overflow:auto;padding:var(--spectrum-tray-padding-y,0) var(\n--spectrum-tray-padding-x,var(--spectrum-global-dimension-static-size-100)\n);transform:translateY(100%);transition:opacity var(\n--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)\n) cubic-bezier(.5,0,1,1) var(--spectrum-dialog-confirm-exit-animation-delay,0ms),visibility 0ms linear calc(var(--spectrum-dialog-confirm-exit-animation-delay, 0ms) + var(\n--spectrum-dialog-confirm-exit-animation-duration,\nvar(--spectrum-global-animation-duration-100)\n)),transform var(\n--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)\n) cubic-bezier(.5,0,1,1) var(--spectrum-dialog-confirm-exit-animation-delay,0ms);width:var(--spectrum-tray-width,100%)}:host([open]) .tray{transform:translateY(0);transition:transform var(\n--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)\n) cubic-bezier(0,0,.4,1) var(\n--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)\n),opacity var(\n--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)\n) cubic-bezier(0,0,.4,1) var(\n--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)\n)}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}:host{align-items:flex-end;max-height:var(--swc-visual-viewport-height);position:fixed!important}sp-underlay{touch-action:none}.tray{display:inline-flex;overscroll-behavior:contain;padding:var(--spectrum-tray-padding-y,0) var(--spectrum-tray-padding-x,0)}::slotted(.visually-hidden){clip:rect(0,0,0,0);border:0;clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}\n`;\nexport default styles;"],
5
- "mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Bf,cAAe",
6
- "names": []
5
+ "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Bf,eAAeC",
6
+ "names": ["css", "styles"]
7
7
  }
@@ -1,12 +1,44 @@
1
- import{html as t}from"@spectrum-web-components/base";import"@spectrum-web-components/dialog/sp-dialog.js";import"@spectrum-web-components/menu/sp-menu.js";import"@spectrum-web-components/menu/sp-menu-item.js";import"@spectrum-web-components/menu/sp-menu-divider.js";import"@spectrum-web-components/tray/sp-tray.js";export default{title:"Tray",component:"sp-tray",args:{open:!0},argTypes:{open:{name:"open",type:{name:"boolean",required:!1},description:"Whether the tray is open.",table:{type:{summary:"boolean"},defaultValue:{summary:!1}},control:{type:"boolean"}}}};export const Default=e=>t`
2
- <sp-tray ?open=${e.open}>
1
+ "use strict";
2
+ import { html } from "@spectrum-web-components/base";
3
+ import "@spectrum-web-components/dialog/sp-dialog.js";
4
+ import "@spectrum-web-components/menu/sp-menu.js";
5
+ import "@spectrum-web-components/menu/sp-menu-item.js";
6
+ import "@spectrum-web-components/menu/sp-menu-divider.js";
7
+ import "@spectrum-web-components/tray/sp-tray.js";
8
+ export default {
9
+ title: "Tray",
10
+ component: "sp-tray",
11
+ args: {
12
+ open: true
13
+ },
14
+ argTypes: {
15
+ open: {
16
+ name: "open",
17
+ type: { name: "boolean", required: false },
18
+ description: "Whether the tray is open.",
19
+ table: {
20
+ type: { summary: "boolean" },
21
+ defaultValue: { summary: false }
22
+ },
23
+ control: {
24
+ type: "boolean"
25
+ }
26
+ }
27
+ }
28
+ };
29
+ export const Default = (args) => {
30
+ return html`
31
+ <sp-tray ?open=${args.open}>
3
32
  <sp-dialog size="s">
4
33
  <h2 slot="heading">New Messages</h2>
5
34
  You have 5 new messages.
6
35
  </sp-dialog>
7
36
  </sp-tray>
8
- `,menu=e=>t`
9
- <sp-tray ?open=${e.open}>
37
+ `;
38
+ };
39
+ export const menu = (args) => {
40
+ return html`
41
+ <sp-tray ?open=${args.open}>
10
42
  <sp-menu style="width: 100%">
11
43
  <sp-menu-item>Deselect</sp-menu-item>
12
44
  <sp-menu-item selected>Select Inverse</sp-menu-item>
@@ -18,4 +50,5 @@ import{html as t}from"@spectrum-web-components/base";import"@spectrum-web-compon
18
50
  </sp-menu>
19
51
  </sp-tray>
20
52
  `;
53
+ };
21
54
  //# sourceMappingURL=tray.stories.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["tray.stories.ts"],
4
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 { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/dialog/sp-dialog.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/tray/sp-tray.js';\n\nexport default {\n title: 'Tray',\n component: 'sp-tray',\n args: {\n open: true,\n },\n argTypes: {\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the tray is open.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n },\n};\n\ntype StoryArgs = {\n open?: boolean;\n};\n\nexport const Default = (args: StoryArgs): TemplateResult => {\n return html`\n <sp-tray ?open=${args.open}>\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">New Messages</h2>\n You have 5 new messages.\n </sp-dialog>\n </sp-tray>\n `;\n};\n\nexport const menu = (args: StoryArgs): TemplateResult => {\n return html`\n <sp-tray ?open=${args.open}>\n <sp-menu style=\"width: 100%\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item selected>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-menu>\n </sp-tray>\n `;\n};\n"],
5
- "mappings": "AAYA,qDAEA,qDACA,iDACA,sDACA,yDACA,iDAEA,cAAe,CACX,MAAO,OACP,UAAW,UACX,KAAM,CACF,KAAM,EACV,EACA,SAAU,CACN,KAAM,CACF,KAAM,OACN,KAAM,CAAE,KAAM,UAAW,SAAU,EAAM,EACzC,YAAa,4BACb,MAAO,CACH,KAAM,CAAE,QAAS,SAAU,EAC3B,aAAc,CAAE,QAAS,EAAM,CACnC,EACA,QAAS,CACL,KAAM,SACV,CACJ,CACJ,CACJ,EAMO,YAAM,SAAU,AAAC,GACb;AAAA,yBACc,EAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MASjB,KAAO,AAAC,GACV;AAAA,yBACc,EAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
5
+ "mappings": ";AAYA,SAAS,YAA4B;AAErC,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,IACF,MAAM;AAAA,EACV;AAAA,EACA,UAAU;AAAA,IACN,MAAM;AAAA,MACF,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,MACzC,aAAa;AAAA,MACb,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,UAAU;AAAA,QAC3B,cAAc,EAAE,SAAS,MAAM;AAAA,MACnC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AACJ;AAMO,aAAM,UAAU,CAAC,SAAoC;AACxD,SAAO;AAAA,yBACc,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9B;AAEO,aAAM,OAAO,CAAC,SAAoC;AACrD,SAAO;AAAA,yBACc,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY9B;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,9 @@
1
- import"@spectrum-web-components/dialog/sp-dialog.js";import"@spectrum-web-components/tray/sp-tray.js";import{html as e}from"lit";import{measureFixtureCreation as s}from"../../../../test/benchmark/helpers.js";s(e`
1
+ "use strict";
2
+ import "@spectrum-web-components/dialog/sp-dialog.js";
3
+ import "@spectrum-web-components/tray/sp-tray.js";
4
+ import { html } from "lit";
5
+ import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
6
+ measureFixtureCreation(html`
2
7
  <sp-tray open>
3
8
  <sp-dialog size="s">
4
9
  <h2 slot="heading">New Messages</h2>
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["basic-test.ts"],
4
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 '@spectrum-web-components/dialog/sp-dialog.js';\nimport '@spectrum-web-components/tray/sp-tray.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-tray open>\n <sp-dialog size=\"s\">\n <h2 slot=\"heading\">New Messages</h2>\n You have 5 new messages.\n </sp-dialog>\n </sp-tray>\n`);\n"],
5
- "mappings": "AAYA,qDACA,iDACA,2BACA,+EAEA,EAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAOtB",
5
+ "mappings": ";AAYA,OAAO;AACP,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAOtB;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,5 @@
1
- import*as r from"../stories/tray.stories.js";import{regressVisuals as s}from"../../../test/visual/test.js";s("TrayStories",r);
1
+ "use strict";
2
+ import * as stories from "../stories/tray.stories.js";
3
+ import { regressVisuals } from "../../../test/visual/test.js";
4
+ regressVisuals("TrayStories", stories);
2
5
  //# sourceMappingURL=tray.test-vrt.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["tray.test-vrt.ts"],
4
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 * as stories from '../stories/tray.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('TrayStories', stories);\n"],
5
- "mappings": "AAYA,6CACA,8DAEA,EAAe,cAAe,CAAO",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,eAAe,OAAO;",
6
6
  "names": []
7
7
  }
package/test/tray.test.js CHANGED
@@ -1,20 +1,87 @@
1
- import{elementUpdated as s,expect as a,fixture as o,html as r,nextFrame as i,oneEvent as n}from"@open-wc/testing";import"@spectrum-web-components/tray/sp-tray.js";import"@spectrum-web-components/theme/sp-theme.js";import"@spectrum-web-components/theme/src/themes.js";import{testForLitDevWarnings as l}from"../../../test/testing-helpers.js";describe("Tray",()=>{l(async()=>await o(r`
1
+ "use strict";
2
+ import {
3
+ elementUpdated,
4
+ expect,
5
+ fixture,
6
+ html,
7
+ nextFrame,
8
+ oneEvent
9
+ } from "@open-wc/testing";
10
+ import "@spectrum-web-components/tray/sp-tray.js";
11
+ import "@spectrum-web-components/theme/sp-theme.js";
12
+ import "@spectrum-web-components/theme/src/themes.js";
13
+ import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
14
+ describe("Tray", () => {
15
+ testForLitDevWarnings(
16
+ async () => await fixture(
17
+ html`
2
18
  <sp-tray></sp-tray>
3
- `)),it("loads default tray accessibly",async()=>{const t=await o(r`
19
+ `
20
+ )
21
+ );
22
+ it("loads default tray accessibly", async () => {
23
+ const el = await fixture(
24
+ html`
4
25
  <sp-tray></sp-tray>
5
- `);await s(t),await a(t).to.be.accessible()}),it("focuses focusable light DOM element",async()=>{const t=await o(r`
26
+ `
27
+ );
28
+ await elementUpdated(el);
29
+ await expect(el).to.be.accessible();
30
+ });
31
+ it("focuses focusable light DOM element", async () => {
32
+ const el = await fixture(
33
+ html`
6
34
  <sp-tray open>
7
35
  <div>
8
36
  <a href="#">Test element</a>
9
37
  </div>
10
38
  </sp-tray>
11
- `),e=t.querySelector("a");await s(t),t.focus(),await s(t),a(document.activeElement).to.equal(e)}),it('focuses "tray"',async()=>{const t=await o(r`
39
+ `
40
+ );
41
+ const anchor = el.querySelector("a");
42
+ await elementUpdated(el);
43
+ el.focus();
44
+ await elementUpdated(el);
45
+ expect(document.activeElement).to.equal(anchor);
46
+ });
47
+ it('focuses "tray"', async () => {
48
+ const el = await fixture(
49
+ html`
12
50
  <sp-tray open>
13
51
  <div></div>
14
52
  </sp-tray>
15
- `);await s(t),t.focus(),await s(t),a(document.activeElement).to.equal(t),a(t.shadowRoot.activeElement).to.equal(t.tray)}),it("closes",async()=>{const e=(await o(r`
53
+ `
54
+ );
55
+ await elementUpdated(el);
56
+ el.focus();
57
+ await elementUpdated(el);
58
+ expect(document.activeElement).to.equal(el);
59
+ expect(el.shadowRoot.activeElement).to.equal(
60
+ el.tray
61
+ );
62
+ });
63
+ it("closes", async () => {
64
+ const test = await fixture(
65
+ html`
16
66
  <sp-theme theme="classic" scale="medium" color="dark">
17
67
  <sp-tray></sp-tray>
18
68
  </sp-theme>
19
- `)).querySelector("sp-tray");await i(),await i(),a(e.open).to.be.false,e.open=!0,await s(e),a(e.open).to.be.true;const c=n(e,"close");e.shadowRoot.querySelector("sp-underlay").click(),await c,a(e.open).to.be.false})});
69
+ `
70
+ );
71
+ const el = test.querySelector("sp-tray");
72
+ await nextFrame();
73
+ await nextFrame();
74
+ expect(el.open).to.be.false;
75
+ el.open = true;
76
+ await elementUpdated(el);
77
+ expect(el.open).to.be.true;
78
+ const closed = oneEvent(el, "close");
79
+ const overlay = el.shadowRoot.querySelector(
80
+ "sp-underlay"
81
+ );
82
+ overlay.click();
83
+ await closed;
84
+ expect(el.open).to.be.false;
85
+ });
86
+ });
20
87
  //# sourceMappingURL=tray.test.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["tray.test.ts"],
4
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 elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\n\nimport '@spectrum-web-components/tray/sp-tray.js';\nimport { Tray } from '@spectrum-web-components/tray';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Tray', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<Tray>(\n html`\n <sp-tray></sp-tray>\n `\n )\n );\n it('loads default tray accessibly', async () => {\n const el = await fixture<Tray>(\n html`\n <sp-tray></sp-tray>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('focuses focusable light DOM element', async () => {\n const el = await fixture<Tray>(\n html`\n <sp-tray open>\n <div>\n <a href=\"#\">Test element</a>\n </div>\n </sp-tray>\n `\n );\n const anchor = el.querySelector('a');\n await elementUpdated(el);\n\n el.focus();\n await elementUpdated(el);\n\n expect(document.activeElement).to.equal(anchor);\n });\n it('focuses \"tray\"', async () => {\n const el = await fixture<Tray>(\n html`\n <sp-tray open>\n <div></div>\n </sp-tray>\n `\n );\n await elementUpdated(el);\n\n el.focus();\n await elementUpdated(el);\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(\n (el as unknown as { tray: HTMLDivElement }).tray\n );\n });\n it('closes', async () => {\n const test = await fixture<HTMLElement>(\n html`\n <sp-theme theme=\"classic\" scale=\"medium\" color=\"dark\">\n <sp-tray></sp-tray>\n </sp-theme>\n `\n );\n\n const el = test.querySelector('sp-tray') as Tray;\n // Ensure closed styles are set before opening so that\n // the `transitionend` event will be met below.\n await nextFrame();\n await nextFrame();\n expect(el.open).to.be.false;\n\n el.open = true;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n const closed = oneEvent(el, 'close');\n const overlay = el.shadowRoot.querySelector(\n 'sp-underlay'\n ) as HTMLElement;\n overlay.click();\n await closed;\n\n expect(el.open).to.be.false;\n });\n});\n"],
5
- "mappings": "AAYA,kHASA,iDAEA,mDACA,qDACA,yEAEA,SAAS,OAAQ,IAAM,CACnB,EACI,SACI,KAAM,GACF;AAAA;AAAA,iBAGJ,CACR,EACA,GAAG,gCAAiC,SAAY,CAC5C,KAAM,GAAK,KAAM,GACb;AAAA;AAAA,aAGJ,EAEA,KAAM,GAAe,CAAE,EAEvB,KAAM,GAAO,CAAE,EAAE,GAAG,GAAG,WAAW,CACtC,CAAC,EACD,GAAG,sCAAuC,SAAY,CAClD,KAAM,GAAK,KAAM,GACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAOJ,EACM,EAAS,EAAG,cAAc,GAAG,EACnC,KAAM,GAAe,CAAE,EAEvB,EAAG,MAAM,EACT,KAAM,GAAe,CAAE,EAEvB,EAAO,SAAS,aAAa,EAAE,GAAG,MAAM,CAAM,CAClD,CAAC,EACD,GAAG,iBAAkB,SAAY,CAC7B,KAAM,GAAK,KAAM,GACb;AAAA;AAAA;AAAA;AAAA,aAKJ,EACA,KAAM,GAAe,CAAE,EAEvB,EAAG,MAAM,EACT,KAAM,GAAe,CAAE,EAEvB,EAAO,SAAS,aAAa,EAAE,GAAG,MAAM,CAAE,EAC1C,EAAO,EAAG,WAAW,aAAa,EAAE,GAAG,MAClC,EAA2C,IAChD,CACJ,CAAC,EACD,GAAG,SAAU,SAAY,CASrB,KAAM,GAAK,AARE,MAAM,GACf;AAAA;AAAA;AAAA;AAAA,aAKJ,GAEgB,cAAc,SAAS,EAGvC,KAA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