@spectrum-web-components/tray 1.1.0 → 1.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/sp-tray.d.ts +6 -0
- package/sp-tray.dev.js +5 -0
- package/sp-tray.dev.js.map +7 -0
- package/sp-tray.js +2 -0
- package/sp-tray.js.map +7 -0
- package/src/Tray.d.ts +36 -0
- package/src/Tray.dev.js +128 -0
- package/src/Tray.dev.js.map +7 -0
- package/src/Tray.js +15 -0
- package/src/Tray.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-tray-wrapper.css.d.ts +2 -0
- package/src/spectrum-tray-wrapper.css.dev.js +7 -0
- package/src/spectrum-tray-wrapper.css.dev.js.map +7 -0
- package/src/spectrum-tray-wrapper.css.js +4 -0
- package/src/spectrum-tray-wrapper.css.js.map +7 -0
- package/src/spectrum-tray.css.d.ts +2 -0
- package/src/spectrum-tray.css.dev.js +7 -0
- package/src/spectrum-tray.css.dev.js.map +7 -0
- package/src/spectrum-tray.css.js +4 -0
- package/src/spectrum-tray.css.js.map +7 -0
- package/src/tray-overrides.css.d.ts +2 -0
- package/src/tray-overrides.css.dev.js +7 -0
- package/src/tray-overrides.css.dev.js.map +7 -0
- package/src/tray-overrides.css.js +4 -0
- package/src/tray-overrides.css.js.map +7 -0
- package/src/tray-wrapper-overrides.css.d.ts +2 -0
- package/src/tray-wrapper-overrides.css.dev.js +7 -0
- package/src/tray-wrapper-overrides.css.dev.js.map +7 -0
- package/src/tray-wrapper-overrides.css.js +4 -0
- package/src/tray-wrapper-overrides.css.js.map +7 -0
- package/src/tray.css.d.ts +2 -0
- package/src/tray.css.dev.js +7 -0
- package/src/tray.css.dev.js.map +7 -0
- package/src/tray.css.js +4 -0
- package/src/tray.css.js.map +7 -0
- package/stories/tray.stories.js +54 -0
- package/stories/tray.stories.js.map +7 -0
- package/test/benchmark/basic-test.js +14 -0
- package/test/benchmark/basic-test.js.map +7 -0
- package/test/tray-memory.test.js +8 -0
- package/test/tray-memory.test.js.map +7 -0
- package/test/tray.test-vrt.js +5 -0
- package/test/tray.test-vrt.js.map +7 -0
- package/test/tray.test.js +77 -0
- package/test/tray.test.js.map +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/tray",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-beta.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"lit-html"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@spectrum-web-components/base": "^1.
|
|
62
|
-
"@spectrum-web-components/modal": "^1.
|
|
63
|
-
"@spectrum-web-components/reactive-controllers": "^1.
|
|
64
|
-
"@spectrum-web-components/shared": "^1.
|
|
65
|
-
"@spectrum-web-components/underlay": "^1.
|
|
61
|
+
"@spectrum-web-components/base": "^1.2.0-beta.0",
|
|
62
|
+
"@spectrum-web-components/modal": "^1.2.0-beta.0",
|
|
63
|
+
"@spectrum-web-components/reactive-controllers": "^1.2.0-beta.0",
|
|
64
|
+
"@spectrum-web-components/shared": "^1.2.0-beta.0",
|
|
65
|
+
"@spectrum-web-components/underlay": "^1.2.0-beta.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@spectrum-css/tray": "4.0.0-s2-foundations.15"
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"./sp-*.js",
|
|
74
74
|
"./**/*.dev.js"
|
|
75
75
|
],
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "809bd734313fe289067108bf1dea2a48cc103a9f"
|
|
77
77
|
}
|
package/sp-tray.d.ts
ADDED
package/sp-tray.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-tray.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Tray } from './src/Tray.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-tray', Tray);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tray': Tray;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAE9B,cAAc,WAAW,IAAI;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-tray.js
ADDED
package/sp-tray.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-tray.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Tray } from './src/Tray.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-tray', Tray);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tray': Tray;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAYA,OAAS,QAAAA,MAAY,gBACrB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,UAAWD,CAAI",
|
|
6
|
+
"names": ["Tray", "defineElement"]
|
|
7
|
+
}
|
package/src/Tray.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import '@spectrum-web-components/underlay/sp-underlay.js';
|
|
3
|
+
import { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';
|
|
4
|
+
/**
|
|
5
|
+
* @element sp-tray
|
|
6
|
+
*
|
|
7
|
+
* @slot - content to display within the Tray
|
|
8
|
+
*
|
|
9
|
+
* @fires close - Announces that the Tray has been closed.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Tray extends SpectrumElement {
|
|
12
|
+
static get styles(): CSSResultArray;
|
|
13
|
+
open: boolean;
|
|
14
|
+
protected prefersMotion: MatchMediaController;
|
|
15
|
+
private transitionPromise;
|
|
16
|
+
private resolveTransitionPromise;
|
|
17
|
+
private tray;
|
|
18
|
+
focus(): void;
|
|
19
|
+
private animating;
|
|
20
|
+
overlayWillCloseCallback(): boolean;
|
|
21
|
+
close(): void;
|
|
22
|
+
private dispatchClosed;
|
|
23
|
+
protected handleUnderlayTransitionend(): void;
|
|
24
|
+
protected handleTrayTransitionend(): void;
|
|
25
|
+
protected update(changes: PropertyValues<this>): void;
|
|
26
|
+
protected render(): TemplateResult;
|
|
27
|
+
/**
|
|
28
|
+
* Bind the open/close transition into the update complete lifecycle so
|
|
29
|
+
* that the overlay system can wait for it to be "visibly ready" before
|
|
30
|
+
* attempting to throw focus into the content contained herein. Not
|
|
31
|
+
* waiting for this can cause small amounts of page scroll to happen
|
|
32
|
+
* while opening the Tray when focusable content is included: e.g. Menu
|
|
33
|
+
* elements whose selected Menu Item is not the first Menu Item.
|
|
34
|
+
*/
|
|
35
|
+
protected getUpdateComplete(): Promise<boolean>;
|
|
36
|
+
}
|
package/src/Tray.dev.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
SpectrumElement
|
|
15
|
+
} from "@spectrum-web-components/base";
|
|
16
|
+
import {
|
|
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(
|
|
30
|
+
this,
|
|
31
|
+
"(prefers-reduced-motion: no-preference)"
|
|
32
|
+
);
|
|
33
|
+
this.transitionPromise = Promise.resolve();
|
|
34
|
+
this.resolveTransitionPromise = () => {
|
|
35
|
+
};
|
|
36
|
+
this.animating = false;
|
|
37
|
+
}
|
|
38
|
+
static get styles() {
|
|
39
|
+
return [modalStyles, styles];
|
|
40
|
+
}
|
|
41
|
+
focus() {
|
|
42
|
+
const firstFocusable = firstFocusableIn(this);
|
|
43
|
+
if (firstFocusable) {
|
|
44
|
+
firstFocusable.focus();
|
|
45
|
+
} else if (this.children.length === 1) {
|
|
46
|
+
this.tray.focus();
|
|
47
|
+
} else {
|
|
48
|
+
super.focus();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
overlayWillCloseCallback() {
|
|
52
|
+
if (!this.open) return this.animating;
|
|
53
|
+
this.close();
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
close() {
|
|
57
|
+
this.open = false;
|
|
58
|
+
if (!this.prefersMotion.matches) {
|
|
59
|
+
this.dispatchClosed();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
dispatchClosed() {
|
|
63
|
+
this.dispatchEvent(
|
|
64
|
+
new Event("close", {
|
|
65
|
+
bubbles: true
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
handleUnderlayTransitionend() {
|
|
70
|
+
if (!this.open) {
|
|
71
|
+
this.resolveTransitionPromise();
|
|
72
|
+
this.dispatchClosed();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
handleTrayTransitionend() {
|
|
76
|
+
if (this.open) {
|
|
77
|
+
this.resolveTransitionPromise();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
update(changes) {
|
|
81
|
+
if (changes.has("open") && changes.get("open") !== void 0 && this.prefersMotion.matches) {
|
|
82
|
+
this.animating = true;
|
|
83
|
+
this.transitionPromise = new Promise((res) => {
|
|
84
|
+
this.resolveTransitionPromise = () => {
|
|
85
|
+
this.animating = false;
|
|
86
|
+
res();
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
super.update(changes);
|
|
91
|
+
}
|
|
92
|
+
render() {
|
|
93
|
+
return html`
|
|
94
|
+
<sp-underlay
|
|
95
|
+
?open=${this.open}
|
|
96
|
+
@close=${this.close}
|
|
97
|
+
@transitionend=${this.handleUnderlayTransitionend}
|
|
98
|
+
></sp-underlay>
|
|
99
|
+
<div
|
|
100
|
+
class="tray modal"
|
|
101
|
+
tabindex="-1"
|
|
102
|
+
@transitionend=${this.handleTrayTransitionend}
|
|
103
|
+
>
|
|
104
|
+
<slot></slot>
|
|
105
|
+
</div>
|
|
106
|
+
`;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Bind the open/close transition into the update complete lifecycle so
|
|
110
|
+
* that the overlay system can wait for it to be "visibly ready" before
|
|
111
|
+
* attempting to throw focus into the content contained herein. Not
|
|
112
|
+
* waiting for this can cause small amounts of page scroll to happen
|
|
113
|
+
* while opening the Tray when focusable content is included: e.g. Menu
|
|
114
|
+
* elements whose selected Menu Item is not the first Menu Item.
|
|
115
|
+
*/
|
|
116
|
+
async getUpdateComplete() {
|
|
117
|
+
const complete = await super.getUpdateComplete();
|
|
118
|
+
await this.transitionPromise;
|
|
119
|
+
return complete;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
__decorateClass([
|
|
123
|
+
property({ type: Boolean, reflect: true })
|
|
124
|
+
], Tray.prototype, "open", 2);
|
|
125
|
+
__decorateClass([
|
|
126
|
+
query(".tray")
|
|
127
|
+
], Tray.prototype, "tray", 2);
|
|
128
|
+
//# sourceMappingURL=Tray.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Tray.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n 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 = () => {};\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 private animating = false;\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return this.animating;\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.resolveTransitionPromise();\n this.dispatchClosed();\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.animating = true;\n this.transitionPromise = new Promise((res) => {\n this.resolveTransitionPromise = () => {\n this.animating = false;\n res();\n };\n });\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-underlay\n ?open=${this.open}\n @close=${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,EAEI;AAAA,EAEA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,OAAO;AACP,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AAErC,OAAO,iBAAiB;AACxB,OAAO,YAAY;AASZ,aAAM,aAAa,gBAAgB;AAAA,EAAnC;AAAA;AAMH,SAAO,OAAO;AAEd,SAAU,gBAAgB,IAAI;AAAA,MAC1B;AAAA,MACA;AAAA,IACJ;AAEA,SAAQ,oBAAoB,QAAQ,QAAQ;AAE5C,SAAQ,2BAA2B,MAAM;AAAA,IAAC;AAgB1C,SAAQ,YAAY;AAAA;AAAA,EA9BpB,WAA2B,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,EAIO,2BAAoC;AACvC,QAAI,CAAC,KAAK,KAAM,QAAO,KAAK;AAC5B,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;AAAA,MACD,IAAI,MAAM,SAAS;AAAA,QACf,SAAS;AAAA,MACb,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEU,8BAAoC;AAC1C,QAAI,CAAC,KAAK,MAAM;AACZ,WAAK,yBAAyB;AAC9B,WAAK,eAAe;AAAA,IACxB;AAAA,EACJ;AAAA,EAEU,0BAAgC;AACtC,QAAI,KAAK,MAAM;AACX,WAAK,yBAAyB;AAAA,IAClC;AAAA,EACJ;AAAA,EAEmB,OAAO,SAAqC;AAC3D,QACI,QAAQ,IAAI,MAAM,KAClB,QAAQ,IAAI,MAAM,MAAM,UACxB,KAAK,cAAc,SACrB;AACE,WAAK,YAAY;AACjB,WAAK,oBAAoB,IAAI,QAAQ,CAAC,QAAQ;AAC1C,aAAK,2BAA2B,MAAM;AAClC,eAAK,YAAY;AACjB,cAAI;AAAA,QACR;AAAA,MACJ,CAAC;AAAA,IACL;AACA,UAAM,OAAO,OAAO;AAAA,EACxB;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA,wBAES,KAAK,IAAI;AAAA,yBACR,KAAK,KAAK;AAAA,iCACF,KAAK,2BAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKhC,KAAK,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAyB,oBAAsC;AAC3D,UAAM,WAAY,MAAM,MAAM,kBAAkB;AAChD,UAAM,KAAK;AACX,WAAO;AAAA,EACX;AACJ;AA5GW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GALjC,KAMF;AAYC;AAAA,EADP,MAAM,OAAO;AAAA,GAjBL,KAkBD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/Tray.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var a=(s,r,e,i)=>{for(var t=i>1?void 0:i?p(r,e):r,o=s.length-1,n;o>=0;o--)(n=s[o])&&(t=(i?n(r,e,t):n(t))||t);return i&&t&&l(r,e,t),t};import{html as d,SpectrumElement as m}from"@spectrum-web-components/base";import{property as c,query as h}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 m{constructor(){super(...arguments);this.open=!1;this.prefersMotion=new f(this,"(prefers-reduced-motion: no-preference)");this.transitionPromise=Promise.resolve();this.resolveTransitionPromise=()=>{};this.animating=!1}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):this.animating}close(){this.open=!1,this.prefersMotion.matches||this.dispatchClosed()}dispatchClosed(){this.dispatchEvent(new Event("close",{bubbles:!0}))}handleUnderlayTransitionend(){this.open||(this.resolveTransitionPromise(),this.dispatchClosed())}handleTrayTransitionend(){this.open&&this.resolveTransitionPromise()}update(e){e.has("open")&&e.get("open")!==void 0&&this.prefersMotion.matches&&(this.animating=!0,this.transitionPromise=new Promise(i=>{this.resolveTransitionPromise=()=>{this.animating=!1,i()}})),super.update(e)}render(){return d`
|
|
2
|
+
<sp-underlay
|
|
3
|
+
?open=${this.open}
|
|
4
|
+
@close=${this.close}
|
|
5
|
+
@transitionend=${this.handleUnderlayTransitionend}
|
|
6
|
+
></sp-underlay>
|
|
7
|
+
<div
|
|
8
|
+
class="tray modal"
|
|
9
|
+
tabindex="-1"
|
|
10
|
+
@transitionend=${this.handleTrayTransitionend}
|
|
11
|
+
>
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</div>
|
|
14
|
+
`}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this.transitionPromise,e}}a([c({type:Boolean,reflect:!0})],Tray.prototype,"open",2),a([h(".tray")],Tray.prototype,"tray",2);
|
|
15
|
+
//# sourceMappingURL=Tray.js.map
|
package/src/Tray.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Tray.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n 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 = () => {};\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 private animating = false;\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return this.animating;\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.resolveTransitionPromise();\n this.dispatchClosed();\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.animating = true;\n this.transitionPromise = new Promise((res) => {\n this.resolveTransitionPromise = () => {\n this.animating = false;\n res();\n };\n });\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-underlay\n ?open=${this.open}\n @close=${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": "qNAYA,OAEI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,MAAO,mDACP,OAAS,oBAAAC,MAAwB,4DACjC,OAAS,wBAAAC,MAA4B,kEAErC,OAAOC,MAAiB,kDACxB,OAAOC,MAAY,gBASZ,aAAM,aAAaN,CAAgB,CAAnC,kCAMH,KAAO,KAAO,GAEd,KAAU,cAAgB,IAAII,EAC1B,KACA,yCACJ,EAEA,KAAQ,kBAAoB,QAAQ,QAAQ,EAE5C,KAAQ,yBAA2B,IAAM,CAAC,EAgB1C,KAAQ,UAAY,GA9BpB,WAA2B,QAAyB,CAChD,MAAO,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,CAIO,0BAAoC,CACvC,OAAK,KAAK,MACV,KAAK,MAAM,EACJ,IAFgB,KAAK,SAGhC,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,yBAAyB,EAC9B,KAAK,eAAe,EAE5B,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,UAAY,GACjB,KAAK,kBAAoB,IAAI,QAASC,GAAQ,CAC1C,KAAK,yBAA2B,IAAM,CAClC,KAAK,UAAY,GACjBA,EAAI,CACR,CACJ,CAAC,GAEL,MAAM,OAAOD,CAAO,CACxB,CAEmB,QAAyB,CACxC,OAAOT;AAAA;AAAA,wBAES,KAAK,IAAI;AAAA,yBACR,KAAK,KAAK;AAAA,iCACF,KAAK,2BAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKhC,KAAK,uBAAuB;AAAA;AAAA;AAAA;AAAA,SAKzD,CAUA,MAAyB,mBAAsC,CAC3D,MAAMW,EAAY,MAAM,MAAM,kBAAkB,EAChD,aAAM,KAAK,kBACJA,CACX,CACJ,CA5GWC,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
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tray.js';
|
package/src/index.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport * from './Tray.dev.js'\n"],
|
|
5
|
+
"mappings": ";AAYA,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 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,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{inline-size:100%;justify-content:center;display:flex;position:fixed;inset-block-end:0;inset-inline-start:0}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=spectrum-tray-wrapper.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-tray-wrapper.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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{inline-size:100%;justify-content:center;display:flex;position:fixed;inset-block-end:0;inset-inline-start:0}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-tray-wrapper.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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{inline-size:100%;justify-content:center;display:flex;position:fixed;inset-block-end:0;inset-inline-start:0}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
.tray{--mod-modal-max-width:100%;inline-size:100%;max-inline-size:100%;max-block-size:calc(100vh - var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone)));box-sizing:border-box;border-radius:0;border-radius:var(--mod-tray-corner-radius-portrait,0)var(--mod-tray-corner-radius-portrait,0)0 0;transition:opacity var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)),visibility var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))linear calc(var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)) + var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))),transform var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay));background-color:var(--highcontrast-tray-background-color,var(--mod-tray-background-color,var(--spectrum-tray-background-color)));outline:none;margin-block-start:var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone));padding-block-start:var(--mod-tray-top-to-content-area,var(--spectrum-tray-top-to-content-area));padding-block-end:var(--mod-tray-bottom-to-content-area,var(--spectrum-tray-top-to-content-area));overflow:auto;transform:translateY(100%)}:host([open]) .tray{transition:transform var(--mod-tray-entry-animation-duration,var(--spectrum-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay)),opacity var(--spectrum-tray-entry-animation-duration,var(--mod-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay));transform:translateY(0)}@media screen and (orientation:landscape){.tray{max-inline-size:var(--mod-tray-max-inline-size,var(--spectrum-tray-max-inline-size));border-start-start-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius));border-start-end-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius))}}@media (forced-colors:active){.tray{--highcontrast-tray-background-color:Canvas;border:solid}.tray ::slotted(*){border:none}}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=spectrum-tray.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-tray.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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{--mod-modal-max-width:100%;inline-size:100%;max-inline-size:100%;max-block-size:calc(100vh - var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone)));box-sizing:border-box;border-radius:0;border-radius:var(--mod-tray-corner-radius-portrait,0)var(--mod-tray-corner-radius-portrait,0)0 0;transition:opacity var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)),visibility var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))linear calc(var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)) + var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))),transform var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay));background-color:var(--highcontrast-tray-background-color,var(--mod-tray-background-color,var(--spectrum-tray-background-color)));outline:none;margin-block-start:var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone));padding-block-start:var(--mod-tray-top-to-content-area,var(--spectrum-tray-top-to-content-area));padding-block-end:var(--mod-tray-bottom-to-content-area,var(--spectrum-tray-top-to-content-area));overflow:auto;transform:translateY(100%)}:host([open]) .tray{transition:transform var(--mod-tray-entry-animation-duration,var(--spectrum-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay)),opacity var(--spectrum-tray-entry-animation-duration,var(--mod-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay));transform:translateY(0)}@media screen and (orientation:landscape){.tray{max-inline-size:var(--mod-tray-max-inline-size,var(--spectrum-tray-max-inline-size));border-start-start-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius));border-start-end-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius))}}@media (forced-colors:active){.tray{--highcontrast-tray-background-color:Canvas;border:solid}.tray ::slotted(*){border:none}}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as a}from"@spectrum-web-components/base";const r=a`
|
|
2
|
+
.tray{--mod-modal-max-width:100%;inline-size:100%;max-inline-size:100%;max-block-size:calc(100vh - var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone)));box-sizing:border-box;border-radius:0;border-radius:var(--mod-tray-corner-radius-portrait,0)var(--mod-tray-corner-radius-portrait,0)0 0;transition:opacity var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)),visibility var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))linear calc(var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)) + var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))),transform var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay));background-color:var(--highcontrast-tray-background-color,var(--mod-tray-background-color,var(--spectrum-tray-background-color)));outline:none;margin-block-start:var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone));padding-block-start:var(--mod-tray-top-to-content-area,var(--spectrum-tray-top-to-content-area));padding-block-end:var(--mod-tray-bottom-to-content-area,var(--spectrum-tray-top-to-content-area));overflow:auto;transform:translateY(100%)}:host([open]) .tray{transition:transform var(--mod-tray-entry-animation-duration,var(--spectrum-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay)),opacity var(--spectrum-tray-entry-animation-duration,var(--mod-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay));transform:translateY(0)}@media screen and (orientation:landscape){.tray{max-inline-size:var(--mod-tray-max-inline-size,var(--spectrum-tray-max-inline-size));border-start-start-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius));border-start-end-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius))}}@media (forced-colors:active){.tray{--highcontrast-tray-background-color:Canvas;border:solid}.tray ::slotted(*){border:none}}
|
|
3
|
+
`;export default r;
|
|
4
|
+
//# sourceMappingURL=spectrum-tray.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-tray.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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{--mod-modal-max-width:100%;inline-size:100%;max-inline-size:100%;max-block-size:calc(100vh - var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone)));box-sizing:border-box;border-radius:0;border-radius:var(--mod-tray-corner-radius-portrait,0)var(--mod-tray-corner-radius-portrait,0)0 0;transition:opacity var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)),visibility var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))linear calc(var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)) + var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))),transform var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay));background-color:var(--highcontrast-tray-background-color,var(--mod-tray-background-color,var(--spectrum-tray-background-color)));outline:none;margin-block-start:var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone));padding-block-start:var(--mod-tray-top-to-content-area,var(--spectrum-tray-top-to-content-area));padding-block-end:var(--mod-tray-bottom-to-content-area,var(--spectrum-tray-top-to-content-area));overflow:auto;transform:translateY(100%)}:host([open]) .tray{transition:transform var(--mod-tray-entry-animation-duration,var(--spectrum-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay)),opacity var(--spectrum-tray-entry-animation-duration,var(--mod-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay));transform:translateY(0)}@media screen and (orientation:landscape){.tray{max-inline-size:var(--mod-tray-max-inline-size,var(--spectrum-tray-max-inline-size));border-start-start-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius));border-start-end-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius))}}@media (forced-colors:active){.tray{--highcontrast-tray-background-color:Canvas;border:solid}.tray ::slotted(*){border:none}}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{--spectrum-tray-exit-animation-delay:var(--system-tray-exit-animation-delay);--spectrum-tray-entry-animation-delay:var(--system-tray-entry-animation-delay);--spectrum-tray-max-inline-size:var(--system-tray-max-inline-size);--spectrum-tray-spacing-edge-to-tray-safe-zone:var(--system-tray-spacing-edge-to-safe-zone);--spectrum-tray-entry-animation-duration:var(--system-tray-entry-animation-duration);--spectrum-tray-exit-animation-duration:var(--system-tray-exit-animation-duration);--spectrum-tray-corner-radius:var(--system-tray-corner-radius);--spectrum-tray-background-color:var(--system-tray-background-color)}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=tray-overrides.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-tray-exit-animation-delay:var(--system-tray-exit-animation-delay);--spectrum-tray-entry-animation-delay:var(--system-tray-entry-animation-delay);--spectrum-tray-max-inline-size:var(--system-tray-max-inline-size);--spectrum-tray-spacing-edge-to-tray-safe-zone:var(--system-tray-spacing-edge-to-safe-zone);--spectrum-tray-entry-animation-duration:var(--system-tray-entry-animation-duration);--spectrum-tray-exit-animation-duration:var(--system-tray-exit-animation-duration);--spectrum-tray-corner-radius:var(--system-tray-corner-radius);--spectrum-tray-background-color:var(--system-tray-background-color)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as t}from"@spectrum-web-components/base";const a=t`
|
|
2
|
+
:host{--spectrum-tray-exit-animation-delay:var(--system-tray-exit-animation-delay);--spectrum-tray-entry-animation-delay:var(--system-tray-entry-animation-delay);--spectrum-tray-max-inline-size:var(--system-tray-max-inline-size);--spectrum-tray-spacing-edge-to-tray-safe-zone:var(--system-tray-spacing-edge-to-safe-zone);--spectrum-tray-entry-animation-duration:var(--system-tray-entry-animation-duration);--spectrum-tray-exit-animation-duration:var(--system-tray-exit-animation-duration);--spectrum-tray-corner-radius:var(--system-tray-corner-radius);--spectrum-tray-background-color:var(--system-tray-background-color)}
|
|
3
|
+
`;export default a;
|
|
4
|
+
//# sourceMappingURL=tray-overrides.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-tray-exit-animation-delay:var(--system-tray-exit-animation-delay);--spectrum-tray-entry-animation-delay:var(--system-tray-entry-animation-delay);--spectrum-tray-max-inline-size:var(--system-tray-max-inline-size);--spectrum-tray-spacing-edge-to-tray-safe-zone:var(--system-tray-spacing-edge-to-safe-zone);--spectrum-tray-entry-animation-duration:var(--system-tray-entry-animation-duration);--spectrum-tray-exit-animation-duration:var(--system-tray-exit-animation-duration);--spectrum-tray-corner-radius:var(--system-tray-corner-radius);--spectrum-tray-background-color:var(--system-tray-background-color)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray-wrapper-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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 \n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray-wrapper-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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 \n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{inline-size:100%;justify-content:center;display:flex;position:fixed;inset-block-end:0;inset-inline-start:0}.tray{--mod-modal-max-width:100%;inline-size:100%;max-inline-size:100%;max-block-size:calc(100vh - var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone)));box-sizing:border-box;border-radius:0;border-radius:var(--mod-tray-corner-radius-portrait,0)var(--mod-tray-corner-radius-portrait,0)0 0;transition:opacity var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)),visibility var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))linear calc(var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)) + var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))),transform var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay));background-color:var(--highcontrast-tray-background-color,var(--mod-tray-background-color,var(--spectrum-tray-background-color)));outline:none;margin-block-start:var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone));padding-block-start:var(--mod-tray-top-to-content-area,var(--spectrum-tray-top-to-content-area));padding-block-end:var(--mod-tray-bottom-to-content-area,var(--spectrum-tray-top-to-content-area));overflow:auto;transform:translateY(100%)}:host([open]) .tray{transition:transform var(--mod-tray-entry-animation-duration,var(--spectrum-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay)),opacity var(--spectrum-tray-entry-animation-duration,var(--mod-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay));transform:translateY(0)}@media screen and (orientation:landscape){.tray{max-inline-size:var(--mod-tray-max-inline-size,var(--spectrum-tray-max-inline-size));border-start-start-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius));border-start-end-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius))}}@media (forced-colors:active){.tray{--highcontrast-tray-background-color:Canvas;border:solid}.tray ::slotted(*){border:none}}:host{--spectrum-tray-exit-animation-delay:var(--system-tray-exit-animation-delay);--spectrum-tray-entry-animation-delay:var(--system-tray-entry-animation-delay);--spectrum-tray-max-inline-size:var(--system-tray-max-inline-size);--spectrum-tray-spacing-edge-to-tray-safe-zone:var(--system-tray-spacing-edge-to-safe-zone);--spectrum-tray-entry-animation-duration:var(--system-tray-entry-animation-duration);--spectrum-tray-exit-animation-duration:var(--system-tray-exit-animation-duration);--spectrum-tray-corner-radius:var(--system-tray-corner-radius);--spectrum-tray-background-color:var(--system-tray-background-color)}:host{max-height:100vh;max-height:100dvh;align-items:flex-end;position:fixed!important}sp-underlay{touch-action:none}.tray{overscroll-behavior:contain;display:inline-flex}::slotted(.visually-hidden){clip:rect(0,0,0,0);clip-path:inset(50%);height:1px;width:1px;white-space:nowrap;border:0;margin:0 -1px -1px 0;padding:0;position:absolute;overflow:hidden}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=tray.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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{inline-size:100%;justify-content:center;display:flex;position:fixed;inset-block-end:0;inset-inline-start:0}.tray{--mod-modal-max-width:100%;inline-size:100%;max-inline-size:100%;max-block-size:calc(100vh - var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone)));box-sizing:border-box;border-radius:0;border-radius:var(--mod-tray-corner-radius-portrait,0)var(--mod-tray-corner-radius-portrait,0)0 0;transition:opacity var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)),visibility var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))linear calc(var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)) + var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))),transform var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay));background-color:var(--highcontrast-tray-background-color,var(--mod-tray-background-color,var(--spectrum-tray-background-color)));outline:none;margin-block-start:var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone));padding-block-start:var(--mod-tray-top-to-content-area,var(--spectrum-tray-top-to-content-area));padding-block-end:var(--mod-tray-bottom-to-content-area,var(--spectrum-tray-top-to-content-area));overflow:auto;transform:translateY(100%)}:host([open]) .tray{transition:transform var(--mod-tray-entry-animation-duration,var(--spectrum-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay)),opacity var(--spectrum-tray-entry-animation-duration,var(--mod-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay));transform:translateY(0)}@media screen and (orientation:landscape){.tray{max-inline-size:var(--mod-tray-max-inline-size,var(--spectrum-tray-max-inline-size));border-start-start-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius));border-start-end-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius))}}@media (forced-colors:active){.tray{--highcontrast-tray-background-color:Canvas;border:solid}.tray ::slotted(*){border:none}}:host{--spectrum-tray-exit-animation-delay:var(--system-tray-exit-animation-delay);--spectrum-tray-entry-animation-delay:var(--system-tray-entry-animation-delay);--spectrum-tray-max-inline-size:var(--system-tray-max-inline-size);--spectrum-tray-spacing-edge-to-tray-safe-zone:var(--system-tray-spacing-edge-to-safe-zone);--spectrum-tray-entry-animation-duration:var(--system-tray-entry-animation-duration);--spectrum-tray-exit-animation-duration:var(--system-tray-exit-animation-duration);--spectrum-tray-corner-radius:var(--system-tray-corner-radius);--spectrum-tray-background-color:var(--system-tray-background-color)}:host{max-height:100vh;max-height:100dvh;align-items:flex-end;position:fixed!important}sp-underlay{touch-action:none}.tray{overscroll-behavior:contain;display:inline-flex}::slotted(.visually-hidden){clip:rect(0,0,0,0);clip-path:inset(50%);height:1px;width:1px;white-space:nowrap;border:0;margin:0 -1px -1px 0;padding:0;position:absolute;overflow:hidden}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/tray.css.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as a}from"@spectrum-web-components/base";const r=a`
|
|
2
|
+
:host{inline-size:100%;justify-content:center;display:flex;position:fixed;inset-block-end:0;inset-inline-start:0}.tray{--mod-modal-max-width:100%;inline-size:100%;max-inline-size:100%;max-block-size:calc(100vh - var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone)));box-sizing:border-box;border-radius:0;border-radius:var(--mod-tray-corner-radius-portrait,0)var(--mod-tray-corner-radius-portrait,0)0 0;transition:opacity var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)),visibility var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))linear calc(var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)) + var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))),transform var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay));background-color:var(--highcontrast-tray-background-color,var(--mod-tray-background-color,var(--spectrum-tray-background-color)));outline:none;margin-block-start:var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone));padding-block-start:var(--mod-tray-top-to-content-area,var(--spectrum-tray-top-to-content-area));padding-block-end:var(--mod-tray-bottom-to-content-area,var(--spectrum-tray-top-to-content-area));overflow:auto;transform:translateY(100%)}:host([open]) .tray{transition:transform var(--mod-tray-entry-animation-duration,var(--spectrum-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay)),opacity var(--spectrum-tray-entry-animation-duration,var(--mod-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay));transform:translateY(0)}@media screen and (orientation:landscape){.tray{max-inline-size:var(--mod-tray-max-inline-size,var(--spectrum-tray-max-inline-size));border-start-start-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius));border-start-end-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius))}}@media (forced-colors:active){.tray{--highcontrast-tray-background-color:Canvas;border:solid}.tray ::slotted(*){border:none}}:host{--spectrum-tray-exit-animation-delay:var(--system-tray-exit-animation-delay);--spectrum-tray-entry-animation-delay:var(--system-tray-entry-animation-delay);--spectrum-tray-max-inline-size:var(--system-tray-max-inline-size);--spectrum-tray-spacing-edge-to-tray-safe-zone:var(--system-tray-spacing-edge-to-safe-zone);--spectrum-tray-entry-animation-duration:var(--system-tray-entry-animation-duration);--spectrum-tray-exit-animation-duration:var(--system-tray-exit-animation-duration);--spectrum-tray-corner-radius:var(--system-tray-corner-radius);--spectrum-tray-background-color:var(--system-tray-background-color)}:host{max-height:100vh;max-height:100dvh;align-items:flex-end;position:fixed!important}sp-underlay{touch-action:none}.tray{overscroll-behavior:contain;display:inline-flex}::slotted(.visually-hidden){clip:rect(0,0,0,0);clip-path:inset(50%);height:1px;width:1px;white-space:nowrap;border:0;margin:0 -1px -1px 0;padding:0;position:absolute;overflow:hidden}
|
|
3
|
+
`;export default r;
|
|
4
|
+
//# sourceMappingURL=tray.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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{inline-size:100%;justify-content:center;display:flex;position:fixed;inset-block-end:0;inset-inline-start:0}.tray{--mod-modal-max-width:100%;inline-size:100%;max-inline-size:100%;max-block-size:calc(100vh - var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone)));box-sizing:border-box;border-radius:0;border-radius:var(--mod-tray-corner-radius-portrait,0)var(--mod-tray-corner-radius-portrait,0)0 0;transition:opacity var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)),visibility var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))linear calc(var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay)) + var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))),transform var(--mod-tray-exit-animation-duration,var(--spectrum-tray-exit-animation-duration))cubic-bezier(.5,0,1,1)var(--mod-tray-exit-animation-delay,var(--spectrum-tray-exit-animation-delay));background-color:var(--highcontrast-tray-background-color,var(--mod-tray-background-color,var(--spectrum-tray-background-color)));outline:none;margin-block-start:var(--mod-tray-spacing-edge-to-tray-safe-zone,var(--spectrum-tray-spacing-edge-to-tray-safe-zone));padding-block-start:var(--mod-tray-top-to-content-area,var(--spectrum-tray-top-to-content-area));padding-block-end:var(--mod-tray-bottom-to-content-area,var(--spectrum-tray-top-to-content-area));overflow:auto;transform:translateY(100%)}:host([open]) .tray{transition:transform var(--mod-tray-entry-animation-duration,var(--spectrum-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay)),opacity var(--spectrum-tray-entry-animation-duration,var(--mod-tray-entry-animation-duration))cubic-bezier(0,0,.4,1)var(--mod-tray-entry-animation-delay,var(--spectrum-tray-entry-animation-delay));transform:translateY(0)}@media screen and (orientation:landscape){.tray{max-inline-size:var(--mod-tray-max-inline-size,var(--spectrum-tray-max-inline-size));border-start-start-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius));border-start-end-radius:var(--mod-tray-corner-radius,var(--spectrum-tray-corner-radius))}}@media (forced-colors:active){.tray{--highcontrast-tray-background-color:Canvas;border:solid}.tray ::slotted(*){border:none}}:host{--spectrum-tray-exit-animation-delay:var(--system-tray-exit-animation-delay);--spectrum-tray-entry-animation-delay:var(--system-tray-entry-animation-delay);--spectrum-tray-max-inline-size:var(--system-tray-max-inline-size);--spectrum-tray-spacing-edge-to-tray-safe-zone:var(--system-tray-spacing-edge-to-safe-zone);--spectrum-tray-entry-animation-duration:var(--system-tray-entry-animation-duration);--spectrum-tray-exit-animation-duration:var(--system-tray-exit-animation-duration);--spectrum-tray-corner-radius:var(--system-tray-corner-radius);--spectrum-tray-background-color:var(--system-tray-background-color)}:host{max-height:100vh;max-height:100dvh;align-items:flex-end;position:fixed!important}sp-underlay{touch-action:none}.tray{overscroll-behavior:contain;display:inline-flex}::slotted(.visually-hidden){clip:rect(0,0,0,0);clip-path:inset(50%);height:1px;width:1px;white-space:nowrap;border:0;margin:0 -1px -1px 0;padding:0;position:absolute;overflow:hidden}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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}>
|
|
32
|
+
<sp-dialog size="s">
|
|
33
|
+
<h2 slot="heading">New Messages</h2>
|
|
34
|
+
You have 5 new messages.
|
|
35
|
+
</sp-dialog>
|
|
36
|
+
</sp-tray>
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
export const menu = (args) => {
|
|
40
|
+
return html`
|
|
41
|
+
<sp-tray ?open=${args.open}>
|
|
42
|
+
<sp-menu style="width: 100%">
|
|
43
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
44
|
+
<sp-menu-item selected>Select Inverse</sp-menu-item>
|
|
45
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
46
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
47
|
+
<sp-menu-divider></sp-menu-divider>
|
|
48
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
49
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
50
|
+
</sp-menu>
|
|
51
|
+
</sp-tray>
|
|
52
|
+
`;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=tray.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray.stories.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { 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,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,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOlC;AAEO,aAAM,OAAO,CAAC,SAAoC;AACrD,SAAO;AAAA,yBACc,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYlC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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`
|
|
7
|
+
<sp-tray open>
|
|
8
|
+
<sp-dialog size="s">
|
|
9
|
+
<h2 slot="heading">New Messages</h2>
|
|
10
|
+
You have 5 new messages.
|
|
11
|
+
</sp-dialog>
|
|
12
|
+
</sp-tray>
|
|
13
|
+
`);
|
|
14
|
+
//# sourceMappingURL=basic-test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["basic-test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@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,OAAO;AACP,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAOtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@open-wc/testing";
|
|
3
|
+
import "@spectrum-web-components/tray/sp-tray.js";
|
|
4
|
+
import { testForMemoryLeaks } from "../../../test/testing-helpers.js";
|
|
5
|
+
testForMemoryLeaks(html`
|
|
6
|
+
<sp-tray></sp-tray>
|
|
7
|
+
`);
|
|
8
|
+
//# sourceMappingURL=tray-memory.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray-memory.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 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\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 } from '@open-wc/testing';\nimport '@spectrum-web-components/tray/sp-tray.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\ntestForMemoryLeaks(html`\n <sp-tray></sp-tray>\n`);\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAAY;AACrB,OAAO;AACP,SAAS,0BAA0B;AAEnC,mBAAmB;AAAA;AAAA,CAElB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/tray.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('TrayStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,eAAe,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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(html`
|
|
17
|
+
<sp-tray></sp-tray>
|
|
18
|
+
`)
|
|
19
|
+
);
|
|
20
|
+
it("loads default tray accessibly", async () => {
|
|
21
|
+
const el = await fixture(html`
|
|
22
|
+
<sp-tray></sp-tray>
|
|
23
|
+
`);
|
|
24
|
+
await elementUpdated(el);
|
|
25
|
+
await expect(el).to.be.accessible();
|
|
26
|
+
});
|
|
27
|
+
it("focuses focusable light DOM element", async () => {
|
|
28
|
+
const el = await fixture(html`
|
|
29
|
+
<sp-tray open>
|
|
30
|
+
<div>
|
|
31
|
+
<a href="#">Test element</a>
|
|
32
|
+
</div>
|
|
33
|
+
</sp-tray>
|
|
34
|
+
`);
|
|
35
|
+
const anchor = el.querySelector("a");
|
|
36
|
+
await elementUpdated(el);
|
|
37
|
+
el.focus();
|
|
38
|
+
await elementUpdated(el);
|
|
39
|
+
expect(document.activeElement).to.equal(anchor);
|
|
40
|
+
});
|
|
41
|
+
it('focuses "tray"', async () => {
|
|
42
|
+
const el = await fixture(html`
|
|
43
|
+
<sp-tray open>
|
|
44
|
+
<div></div>
|
|
45
|
+
</sp-tray>
|
|
46
|
+
`);
|
|
47
|
+
await elementUpdated(el);
|
|
48
|
+
el.focus();
|
|
49
|
+
await elementUpdated(el);
|
|
50
|
+
expect(document.activeElement).to.equal(el);
|
|
51
|
+
expect(el.shadowRoot.activeElement).to.equal(
|
|
52
|
+
el.tray
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
it("closes", async () => {
|
|
56
|
+
const test = await fixture(html`
|
|
57
|
+
<sp-theme system="spectrum" scale="medium" color="dark">
|
|
58
|
+
<sp-tray></sp-tray>
|
|
59
|
+
</sp-theme>
|
|
60
|
+
`);
|
|
61
|
+
const el = test.querySelector("sp-tray");
|
|
62
|
+
await nextFrame();
|
|
63
|
+
await nextFrame();
|
|
64
|
+
expect(el.open).to.be.false;
|
|
65
|
+
el.open = true;
|
|
66
|
+
await elementUpdated(el);
|
|
67
|
+
expect(el.open).to.be.true;
|
|
68
|
+
const closed = oneEvent(el, "close");
|
|
69
|
+
const overlay = el.shadowRoot.querySelector(
|
|
70
|
+
"sp-underlay"
|
|
71
|
+
);
|
|
72
|
+
overlay.click();
|
|
73
|
+
await closed;
|
|
74
|
+
expect(el.open).to.be.false;
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=tray.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\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>(html`\n <sp-tray></sp-tray>\n `)\n );\n it('loads default tray accessibly', async () => {\n const el = await fixture<Tray>(html`\n <sp-tray></sp-tray>\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>(html`\n <sp-tray open>\n <div>\n <a href=\"#\">Test element</a>\n </div>\n </sp-tray>\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>(html`\n <sp-tray open>\n <div></div>\n </sp-tray>\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>(html`\n <sp-theme system=\"spectrum\" scale=\"medium\" color=\"dark\">\n <sp-tray></sp-tray>\n </sp-theme>\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,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AAEP,OAAO;AACP,OAAO;AACP,SAAS,6BAA6B;AAEtC,SAAS,QAAQ,MAAM;AACnB;AAAA,IACI,YACI,MAAM,QAAc;AAAA;AAAA,aAEnB;AAAA,EACT;AACA,KAAG,iCAAiC,YAAY;AAC5C,UAAM,KAAK,MAAM,QAAc;AAAA;AAAA,SAE9B;AAED,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,uCAAuC,YAAY;AAClD,UAAM,KAAK,MAAM,QAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAM9B;AACD,UAAM,SAAS,GAAG,cAAc,GAAG;AACnC,UAAM,eAAe,EAAE;AAEvB,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,aAAa,EAAE,GAAG,MAAM,MAAM;AAAA,EAClD,CAAC;AACD,KAAG,kBAAkB,YAAY;AAC7B,UAAM,KAAK,MAAM,QAAc;AAAA;AAAA;AAAA;AAAA,SAI9B;AACD,UAAM,eAAe,EAAE;AAEvB,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,aAAa,EAAE,GAAG,MAAM,EAAE;AAC1C,WAAO,GAAG,WAAW,aAAa,EAAE,GAAG;AAAA,MAClC,GAA2C;AAAA,IAChD;AAAA,EACJ,CAAC;AACD,KAAG,UAAU,YAAY;AACrB,UAAM,OAAO,MAAM,QAAqB;AAAA;AAAA;AAAA;AAAA,SAIvC;AAED,UAAM,KAAK,KAAK,cAAc,SAAS;AAGvC,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAEtB,OAAG,OAAO;AACV,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,UAAM,SAAS,SAAS,IAAI,OAAO;AACnC,UAAM,UAAU,GAAG,WAAW;AAAA,MAC1B;AAAA,IACJ;AACA,YAAQ,MAAM;AACd,UAAM;AAEN,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAAA,EAC1B,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|