@spectrum-web-components/tray 0.4.0-devmode.0 → 0.4.1

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-devmode.0+7b0ea531e",
3
+ "version": "0.4.1",
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/base": "^0.6.0",
61
- "@spectrum-web-components/modal": "^0.7.0-devmode.0+7b0ea531e",
62
- "@spectrum-web-components/reactive-controllers": "^0.2.5",
63
- "@spectrum-web-components/shared": "^0.15.0-devmode.0+7b0ea531e",
64
- "@spectrum-web-components/underlay": "^0.9.0-devmode.0+7b0ea531e",
60
+ "@spectrum-web-components/base": "^0.7.0",
61
+ "@spectrum-web-components/modal": "^0.7.1",
62
+ "@spectrum-web-components/reactive-controllers": "^0.3.0",
63
+ "@spectrum-web-components/shared": "^0.15.0",
64
+ "@spectrum-web-components/underlay": "^0.9.0",
65
65
  "tslib": "^2.0.0"
66
66
  },
67
67
  "devDependencies": {
@@ -73,5 +73,5 @@
73
73
  "./sp-*.js",
74
74
  "./**/*.dev.js"
75
75
  ],
76
- "gitHead": "7b0ea531e9c7225c8964c5429bc5fd005618b80e"
76
+ "gitHead": "60b2d3b7d9020d72f9ae930568670321a1918e6f"
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,3 +1,2 @@
1
- import { Tray } from "./src/Tray.js";
2
- customElements.define("sp-tray", Tray);
1
+ "use strict";import{Tray as e}from"./src/Tray.js";customElements.define("sp-tray",e);
3
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;AAEA,eAAe,OAAO,WAAW,IAAI;",
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,WA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;AAAA;AAAA,wBAES,KAAK;AAAA,yBACJ,KAAK;AAAA,iCACG,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKL,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlC;AAAA,EAUA,MAAyB,oBAAsC;AAC3D,UAAM,WAAY,MAAM,MAAM,kBAAkB;AAChD,UAAM,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,83 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
10
- return result;
11
- };
12
- import {
13
- html,
14
- SpectrumElement
15
- } from "@spectrum-web-components/base";
16
- import {
17
- property,
18
- query
19
- } from "@spectrum-web-components/base/src/decorators.js";
20
- import "@spectrum-web-components/underlay/sp-underlay.js";
21
- import { firstFocusableIn } from "@spectrum-web-components/shared/src/first-focusable-in.js";
22
- import { MatchMediaController } from "@spectrum-web-components/reactive-controllers/src/MatchMedia.js";
23
- import modalStyles from "@spectrum-web-components/modal/src/modal.css.js";
24
- import styles from "./tray.css.js";
25
- export class Tray extends SpectrumElement {
26
- constructor() {
27
- super(...arguments);
28
- this.open = false;
29
- this.prefersMotion = new MatchMediaController(this, "(prefers-reduced-motion: no-preference)");
30
- this.transitionPromise = Promise.resolve();
31
- }
32
- static get styles() {
33
- return [modalStyles, styles];
34
- }
35
- focus() {
36
- const firstFocusable = firstFocusableIn(this);
37
- if (firstFocusable) {
38
- firstFocusable.focus();
39
- } else if (this.children.length === 1) {
40
- this.tray.focus();
41
- } else {
42
- super.focus();
43
- }
44
- }
45
- overlayWillCloseCallback() {
46
- if (!this.open)
47
- return false;
48
- this.close();
49
- return true;
50
- }
51
- close() {
52
- this.open = false;
53
- if (!this.prefersMotion.matches) {
54
- this.dispatchClosed();
55
- }
56
- }
57
- dispatchClosed() {
58
- this.dispatchEvent(new Event("close", {
59
- bubbles: true
60
- }));
61
- }
62
- handleUnderlayTransitionend() {
63
- if (!this.open) {
64
- this.dispatchClosed();
65
- this.resolveTransitionPromise();
66
- }
67
- }
68
- handleTrayTransitionend() {
69
- if (this.open) {
70
- this.resolveTransitionPromise();
71
- }
72
- }
73
- update(changes) {
74
- if (changes.has("open") && changes.get("open") !== void 0 && this.prefersMotion.matches) {
75
- this.transitionPromise = new Promise((res) => this.resolveTransitionPromise = res);
76
- }
77
- super.update(changes);
78
- }
79
- render() {
80
- return html`
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`
81
2
  <sp-underlay
82
3
  ?open=${this.open}
83
4
  @click=${this.close}
@@ -90,18 +11,5 @@ export class Tray extends SpectrumElement {
90
11
  >
91
12
  <slot></slot>
92
13
  </div>
93
- `;
94
- }
95
- async getUpdateComplete() {
96
- const complete = await super.getUpdateComplete();
97
- await this.transitionPromise;
98
- return complete;
99
- }
100
- }
101
- __decorateClass([
102
- property({ type: Boolean, reflect: true })
103
- ], Tray.prototype, "open", 2);
104
- __decorateClass([
105
- query(".tray")
106
- ], Tray.prototype, "tray", 2);
14
+ `}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this.transitionPromise,e}}l([h({type:Boolean,reflect:!0})],Tray.prototype,"open",2),l([m(".tray")],Tray.prototype,"tray",2);
107
15
  //# sourceMappingURL=Tray.js.map
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": ";;;;;;;;;;;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,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,CAACC,EAAaC,CAAM,CAC/B,CAiBgB,OAAc,CAC1B,MAAMC,EAAiBJ,EAAiB,IAAI,EACxCI,EACAA,EAAe,MAAM,EACd,KAAK,SAAS,SAAW,EAChC,KAAK,KAAK,MAAM,EAEhB,MAAM,MAAM,CAEpB,CAEO,0BAAoC,CACvC,OAAK,KAAK,MACV,KAAK,MAAM,EACJ,IAFgB,EAG3B,CAEO,OAAc,CACjB,KAAK,KAAO,GACP,KAAK,cAAc,SACpB,KAAK,eAAe,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,6 +1,4 @@
1
- import { css } from "@spectrum-web-components/base";
2
- const styles = css`
1
+ "use strict";import{css as t}from"@spectrum-web-components/base";const r=t`
3
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)}}
4
- `;
5
- export default styles;
3
+ `;export default r;
6
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;AACA,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
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,5 +1,4 @@
1
- import { css } from "@spectrum-web-components/base";
2
- const styles = css`
1
+ "use strict";import{css as a}from"@spectrum-web-components/base";const r=a`
3
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(
4
3
  --spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
5
4
  ) var(
@@ -24,6 +23,5 @@ var(--spectrum-global-animation-duration-100)
24
23
  ) cubic-bezier(0,0,.4,1) var(
25
24
  --spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)
26
25
  )}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}
27
- `;
28
- export default styles;
26
+ `;export default r;
29
27
  //# sourceMappingURL=spectrum-tray.css.js.map
@@ -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;",
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,5 +1,4 @@
1
- import { css } from "@spectrum-web-components/base";
2
- const styles = css`
1
+ "use strict";import{css as r}from"@spectrum-web-components/base";const a=r`
3
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(
4
3
  --spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
5
4
  ) var(
@@ -24,6 +23,5 @@ var(--spectrum-global-animation-duration-100)
24
23
  ) cubic-bezier(0,0,.4,1) var(
25
24
  --spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)
26
25
  )}@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}
27
- `;
28
- export default styles;
26
+ `;export default a;
29
27
  //# sourceMappingURL=tray.css.js.map
@@ -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;",
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 { html } from "@spectrum-web-components/base";
2
3
  import "@spectrum-web-components/dialog/sp-dialog.js";
3
4
  import "@spectrum-web-components/menu/sp-menu.js";
@@ -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;AAEA;AACA;AACA;AACA;AACA;AAEA,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;",
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,3 +1,4 @@
1
+ "use strict";
1
2
  import "@spectrum-web-components/dialog/sp-dialog.js";
2
3
  import "@spectrum-web-components/tray/sp-tray.js";
3
4
  import { html } from "lit";
@@ -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;AACA;AACA;AACA;AAEA,uBAAuB;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,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/tray.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("TrayStories", stories);
@@ -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;AACA;AAEA,eAAe,eAAe,OAAO;",
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,3 +1,4 @@
1
+ "use strict";
1
2
  import {
2
3
  elementUpdated,
3
4
  expect,
@@ -11,24 +12,32 @@ import "@spectrum-web-components/theme/sp-theme.js";
11
12
  import "@spectrum-web-components/theme/src/themes.js";
12
13
  import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
13
14
  describe("Tray", () => {
14
- testForLitDevWarnings(async () => await fixture(html`
15
+ testForLitDevWarnings(
16
+ async () => await fixture(
17
+ html`
15
18
  <sp-tray></sp-tray>
16
- `));
19
+ `
20
+ )
21
+ );
17
22
  it("loads default tray accessibly", async () => {
18
- const el = await fixture(html`
23
+ const el = await fixture(
24
+ html`
19
25
  <sp-tray></sp-tray>
20
- `);
26
+ `
27
+ );
21
28
  await elementUpdated(el);
22
29
  await expect(el).to.be.accessible();
23
30
  });
24
31
  it("focuses focusable light DOM element", async () => {
25
- const el = await fixture(html`
32
+ const el = await fixture(
33
+ html`
26
34
  <sp-tray open>
27
35
  <div>
28
36
  <a href="#">Test element</a>
29
37
  </div>
30
38
  </sp-tray>
31
- `);
39
+ `
40
+ );
32
41
  const anchor = el.querySelector("a");
33
42
  await elementUpdated(el);
34
43
  el.focus();
@@ -36,23 +45,29 @@ describe("Tray", () => {
36
45
  expect(document.activeElement).to.equal(anchor);
37
46
  });
38
47
  it('focuses "tray"', async () => {
39
- const el = await fixture(html`
48
+ const el = await fixture(
49
+ html`
40
50
  <sp-tray open>
41
51
  <div></div>
42
52
  </sp-tray>
43
- `);
53
+ `
54
+ );
44
55
  await elementUpdated(el);
45
56
  el.focus();
46
57
  await elementUpdated(el);
47
58
  expect(document.activeElement).to.equal(el);
48
- expect(el.shadowRoot.activeElement).to.equal(el.tray);
59
+ expect(el.shadowRoot.activeElement).to.equal(
60
+ el.tray
61
+ );
49
62
  });
50
63
  it("closes", async () => {
51
- const test = await fixture(html`
64
+ const test = await fixture(
65
+ html`
52
66
  <sp-theme theme="classic" scale="medium" color="dark">
53
67
  <sp-tray></sp-tray>
54
68
  </sp-theme>
55
- `);
69
+ `
70
+ );
56
71
  const el = test.querySelector("sp-tray");
57
72
  await nextFrame();
58
73
  await nextFrame();
@@ -61,7 +76,9 @@ describe("Tray", () => {
61
76
  await elementUpdated(el);
62
77
  expect(el.open).to.be.true;
63
78
  const closed = oneEvent(el, "close");
64
- const overlay = el.shadowRoot.querySelector("sp-underlay");
79
+ const overlay = el.shadowRoot.querySelector(
80
+ "sp-underlay"
81
+ );
65
82
  overlay.click();
66
83
  await closed;
67
84
  expect(el.open).to.be.false;
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA;AAEA;AACA;AACA;AAEA,SAAS,QAAQ,MAAM;AACnB,wBACI,YACI,MAAM,QACF;AAAA;AAAA,iBAGJ,CACR;AACA,KAAG,iCAAiC,YAAY;AAC5C,UAAM,KAAK,MAAM,QACb;AAAA;AAAA,aAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,uCAAuC,YAAY;AAClD,UAAM,KAAK,MAAM,QACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAOJ;AACA,UAAM,SAAS,GAAG,cAAc,GAAG;AACnC,UAAM,eAAe,EAAE;AAEvB,OAAG,MAAM;AACT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