@spectrum-web-components/tray 0.3.11 → 0.3.12-devmode.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 +24 -11
- package/sp-tray.dev.js +3 -0
- package/sp-tray.dev.js.map +7 -0
- package/sp-tray.js +3 -14
- package/sp-tray.js.map +7 -1
- package/src/Tray.dev.js +107 -0
- package/src/Tray.dev.js.map +7 -0
- package/src/Tray.js +87 -101
- package/src/Tray.js.map +7 -1
- package/src/index.dev.js +2 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -13
- package/src/index.js.map +7 -1
- package/src/spectrum-tray-wrapper.css.dev.js +6 -0
- package/src/spectrum-tray-wrapper.css.dev.js.map +7 -0
- package/src/spectrum-tray-wrapper.css.js +3 -14
- package/src/spectrum-tray-wrapper.css.js.map +7 -1
- package/src/spectrum-tray.css.dev.js +29 -0
- package/src/spectrum-tray.css.dev.js.map +7 -0
- package/src/spectrum-tray.css.js +3 -14
- package/src/spectrum-tray.css.js.map +7 -1
- package/src/tray.css.dev.js +29 -0
- package/src/tray.css.dev.js.map +7 -0
- package/src/tray.css.js +3 -14
- package/src/tray.css.js.map +7 -1
- package/stories/tray.stories.js +28 -39
- package/stories/tray.stories.js.map +7 -1
- package/test/benchmark/basic-test.js +6 -17
- package/test/benchmark/basic-test.js.map +7 -1
- package/test/tray.test-vrt.js +4 -15
- package/test/tray.test-vrt.js.map +7 -1
- package/test/tray.test.js +49 -55
- package/test/tray.test.js.map +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/tray",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12-devmode.0+07474d44f",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,11 +20,24 @@
|
|
|
20
20
|
"module": "src/index.js",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
|
-
".":
|
|
24
|
-
|
|
23
|
+
".": {
|
|
24
|
+
"development": "./src/index.dev.js",
|
|
25
|
+
"default": "./src/index.js"
|
|
26
|
+
},
|
|
25
27
|
"./package.json": "./package.json",
|
|
26
|
-
"./
|
|
27
|
-
|
|
28
|
+
"./src/Tray.js": {
|
|
29
|
+
"development": "./src/Tray.dev.js",
|
|
30
|
+
"default": "./src/Tray.js"
|
|
31
|
+
},
|
|
32
|
+
"./src/index.js": {
|
|
33
|
+
"development": "./src/index.dev.js",
|
|
34
|
+
"default": "./src/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./src/tray.css.js": "./src/tray.css.js",
|
|
37
|
+
"./sp-tray.js": {
|
|
38
|
+
"development": "./sp-tray.dev.js",
|
|
39
|
+
"default": "./sp-tray.js"
|
|
40
|
+
}
|
|
28
41
|
},
|
|
29
42
|
"scripts": {
|
|
30
43
|
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
|
|
@@ -44,11 +57,11 @@
|
|
|
44
57
|
"lit-html"
|
|
45
58
|
],
|
|
46
59
|
"dependencies": {
|
|
47
|
-
"@spectrum-web-components/base": "^0.5.
|
|
48
|
-
"@spectrum-web-components/modal": "^0.6.
|
|
49
|
-
"@spectrum-web-components/reactive-controllers": "^0.2.
|
|
50
|
-
"@spectrum-web-components/shared": "^0.14.
|
|
51
|
-
"@spectrum-web-components/underlay": "^0.8.
|
|
60
|
+
"@spectrum-web-components/base": "^0.5.9-devmode.24+07474d44f",
|
|
61
|
+
"@spectrum-web-components/modal": "^0.6.10-devmode.0+07474d44f",
|
|
62
|
+
"@spectrum-web-components/reactive-controllers": "^0.2.5-devmode.79+07474d44f",
|
|
63
|
+
"@spectrum-web-components/shared": "^0.14.5-devmode.0+07474d44f",
|
|
64
|
+
"@spectrum-web-components/underlay": "^0.8.11-devmode.0+07474d44f",
|
|
52
65
|
"tslib": "^2.0.0"
|
|
53
66
|
},
|
|
54
67
|
"devDependencies": {
|
|
@@ -59,5 +72,5 @@
|
|
|
59
72
|
"sideEffects": [
|
|
60
73
|
"./sp-*.js"
|
|
61
74
|
],
|
|
62
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "07474d44f6cee1db241b9ccf3dc812514ffbe7fa"
|
|
63
76
|
}
|
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'\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": []
|
|
7
|
+
}
|
package/sp-tray.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { Tray } from './src/Tray.js';
|
|
13
|
-
customElements.define('sp-tray', Tray);
|
|
14
|
-
//# sourceMappingURL=sp-tray.js.map
|
|
1
|
+
import { Tray } from "./src/Tray.js";
|
|
2
|
+
customElements.define("sp-tray", Tray);
|
|
3
|
+
//# sourceMappingURL=sp-tray.js.map
|
package/sp-tray.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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';\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": []
|
|
7
|
+
}
|
package/src/Tray.dev.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
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`
|
|
81
|
+
<sp-underlay
|
|
82
|
+
?open=${this.open}
|
|
83
|
+
@click=${this.close}
|
|
84
|
+
@transitionend=${this.handleUnderlayTransitionend}
|
|
85
|
+
></sp-underlay>
|
|
86
|
+
<div
|
|
87
|
+
class="tray modal"
|
|
88
|
+
tabindex="-1"
|
|
89
|
+
@transitionend=${this.handleTrayTransitionend}
|
|
90
|
+
>
|
|
91
|
+
<slot></slot>
|
|
92
|
+
</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);
|
|
107
|
+
//# 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!: () => void;\n\n @query('.tray')\n private tray!: HTMLDivElement;\n\n public override focus(): void {\n const firstFocusable = firstFocusableIn(this);\n if (firstFocusable) {\n firstFocusable.focus();\n } else if (this.children.length === 1) {\n this.tray.focus();\n } else {\n super.focus();\n }\n }\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return false;\n this.close();\n return true;\n }\n\n public close(): void {\n this.open = false;\n if (!this.prefersMotion.matches) {\n this.dispatchClosed();\n }\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected handleUnderlayTransitionend(): void {\n if (!this.open) {\n this.dispatchClosed();\n this.resolveTransitionPromise();\n }\n }\n\n protected handleTrayTransitionend(): void {\n if (this.open) {\n this.resolveTransitionPromise();\n }\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (\n changes.has('open') &&\n changes.get('open') !== undefined &&\n this.prefersMotion.matches\n ) {\n this.transitionPromise = new Promise(\n (res) => (this.resolveTransitionPromise = res)\n );\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.close}\n @transitionend=${this.handleUnderlayTransitionend}\n ></sp-underlay>\n <div\n class=\"tray modal\"\n tabindex=\"-1\"\n @transitionend=${this.handleTrayTransitionend}\n >\n <slot></slot>\n </div>\n `;\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;AAEA;AACA;AASO,aAAM,aAAa,gBAAgB;AAAA,EAAnC;AAAA;AAMI,gBAAO;AAEJ,yBAAgB,IAAI,qBAC1B,MACA,yCACJ;AAEQ,6BAAoB,QAAQ,QAAQ;AAAA;AAAA,aAZjB,SAAyB;AAChD,WAAO,CAAC,aAAa,MAAM;AAAA,EAC/B;AAAA,EAiBgB,QAAc;AAC1B,UAAM,iBAAiB,iBAAiB,IAAI;AAC5C,QAAI,gBAAgB;AAChB,qBAAe,MAAM;AAAA,IACzB,WAAW,KAAK,SAAS,WAAW,GAAG;AACnC,WAAK,KAAK,MAAM;AAAA,IACpB,OAAO;AACH,YAAM,MAAM;AAAA,IAChB;AAAA,EACJ;AAAA,EAEO,2BAAoC;AACvC,QAAI,CAAC,KAAK;AAAM,aAAO;AACvB,SAAK,MAAM;AACX,WAAO;AAAA,EACX;AAAA,EAEO,QAAc;AACjB,SAAK,OAAO;AACZ,QAAI,CAAC,KAAK,cAAc,SAAS;AAC7B,WAAK,eAAe;AAAA,IACxB;AAAA,EACJ;AAAA,EAEQ,iBAAuB;AAC3B,SAAK,cACD,IAAI,MAAM,SAAS;AAAA,MACf,SAAS;AAAA,IACb,CAAC,CACL;AAAA,EACJ;AAAA,EAEU,8BAAoC;AAC1C,QAAI,CAAC,KAAK,MAAM;AACZ,WAAK,eAAe;AACpB,WAAK,yBAAyB;AAAA,IAClC;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,oBAAoB,IAAI,QACzB,CAAC,QAAS,KAAK,2BAA2B,GAC9C;AAAA,IACJ;AACA,UAAM,OAAO,OAAO;AAAA,EACxB;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA,wBAES,KAAK;AAAA,yBACJ,KAAK;AAAA,iCACG,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKL,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlC;AAAA,QAUyB,oBAAsC;AAC3D,UAAM,WAAY,MAAM,MAAM,kBAAkB;AAChD,UAAM,KAAK;AACX,WAAO;AAAA,EACX;AACJ;AAtGW;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AANJ,KAMI;AAYC;AAAA,EADR,AAAC,MAAM,OAAO;AAAA,GACN,AAlBL,KAkBK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/Tray.js
CHANGED
|
@@ -1,89 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @fires close - Announces that the Tray has been closed.
|
|
26
|
-
*/
|
|
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";
|
|
27
25
|
export class Tray extends SpectrumElement {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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();
|
|
33
43
|
}
|
|
34
|
-
|
|
35
|
-
|
|
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();
|
|
36
55
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
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();
|
|
48
66
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return true;
|
|
67
|
+
}
|
|
68
|
+
handleTrayTransitionend() {
|
|
69
|
+
if (this.open) {
|
|
70
|
+
this.resolveTransitionPromise();
|
|
54
71
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
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);
|
|
60
76
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
handleUnderlayTransitionend() {
|
|
67
|
-
if (!this.open) {
|
|
68
|
-
this.dispatchClosed();
|
|
69
|
-
this.resolveTransitionPromise();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
handleTrayTransitionend() {
|
|
73
|
-
if (this.open) {
|
|
74
|
-
this.resolveTransitionPromise();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
update(changes) {
|
|
78
|
-
if (changes.has('open') &&
|
|
79
|
-
changes.get('open') !== undefined &&
|
|
80
|
-
this.prefersMotion.matches) {
|
|
81
|
-
this.transitionPromise = new Promise((res) => (this.resolveTransitionPromise = res));
|
|
82
|
-
}
|
|
83
|
-
super.update(changes);
|
|
84
|
-
}
|
|
85
|
-
render() {
|
|
86
|
-
return html `
|
|
77
|
+
super.update(changes);
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
return html`
|
|
87
81
|
<sp-underlay
|
|
88
82
|
?open=${this.open}
|
|
89
83
|
@click=${this.close}
|
|
@@ -97,25 +91,17 @@ export class Tray extends SpectrumElement {
|
|
|
97
91
|
<slot></slot>
|
|
98
92
|
</div>
|
|
99
93
|
`;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
* while opening the Tray when focusable content is included: e.g. Menu
|
|
107
|
-
* elements whose selected Menu Item is not the first Menu Item.
|
|
108
|
-
*/
|
|
109
|
-
async getUpdateComplete() {
|
|
110
|
-
const complete = (await super.getUpdateComplete());
|
|
111
|
-
await this.transitionPromise;
|
|
112
|
-
return complete;
|
|
113
|
-
}
|
|
94
|
+
}
|
|
95
|
+
async getUpdateComplete() {
|
|
96
|
+
const complete = await super.getUpdateComplete();
|
|
97
|
+
await this.transitionPromise;
|
|
98
|
+
return complete;
|
|
99
|
+
}
|
|
114
100
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
], Tray.prototype, "open",
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
], Tray.prototype, "tray",
|
|
121
|
-
//# sourceMappingURL=Tray.js.map
|
|
101
|
+
__decorateClass([
|
|
102
|
+
property({ type: Boolean, reflect: true })
|
|
103
|
+
], Tray.prototype, "open", 2);
|
|
104
|
+
__decorateClass([
|
|
105
|
+
query(".tray")
|
|
106
|
+
], Tray.prototype, "tray", 2);
|
|
107
|
+
//# sourceMappingURL=Tray.js.map
|
package/src/Tray.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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!: () => void;\n\n @query('.tray')\n private tray!: HTMLDivElement;\n\n public override focus(): void {\n const firstFocusable = firstFocusableIn(this);\n if (firstFocusable) {\n firstFocusable.focus();\n } else if (this.children.length === 1) {\n this.tray.focus();\n } else {\n super.focus();\n }\n }\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return false;\n this.close();\n return true;\n }\n\n public close(): void {\n this.open = false;\n if (!this.prefersMotion.matches) {\n this.dispatchClosed();\n }\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected handleUnderlayTransitionend(): void {\n if (!this.open) {\n this.dispatchClosed();\n this.resolveTransitionPromise();\n }\n }\n\n protected handleTrayTransitionend(): void {\n if (this.open) {\n this.resolveTransitionPromise();\n }\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (\n changes.has('open') &&\n changes.get('open') !== undefined &&\n this.prefersMotion.matches\n ) {\n this.transitionPromise = new Promise(\n (res) => (this.resolveTransitionPromise = res)\n );\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.close}\n @transitionend=${this.handleUnderlayTransitionend}\n ></sp-underlay>\n <div\n class=\"tray modal\"\n tabindex=\"-1\"\n @transitionend=${this.handleTrayTransitionend}\n >\n <slot></slot>\n </div>\n `;\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;AAEA;AACA;AASO,aAAM,aAAa,gBAAgB;AAAA,EAAnC;AAAA;AAMI,gBAAO;AAEJ,yBAAgB,IAAI,qBAC1B,MACA,yCACJ;AAEQ,6BAAoB,QAAQ,QAAQ;AAAA;AAAA,aAZjB,SAAyB;AAChD,WAAO,CAAC,aAAa,MAAM;AAAA,EAC/B;AAAA,EAiBgB,QAAc;AAC1B,UAAM,iBAAiB,iBAAiB,IAAI;AAC5C,QAAI,gBAAgB;AAChB,qBAAe,MAAM;AAAA,IACzB,WAAW,KAAK,SAAS,WAAW,GAAG;AACnC,WAAK,KAAK,MAAM;AAAA,IACpB,OAAO;AACH,YAAM,MAAM;AAAA,IAChB;AAAA,EACJ;AAAA,EAEO,2BAAoC;AACvC,QAAI,CAAC,KAAK;AAAM,aAAO;AACvB,SAAK,MAAM;AACX,WAAO;AAAA,EACX;AAAA,EAEO,QAAc;AACjB,SAAK,OAAO;AACZ,QAAI,CAAC,KAAK,cAAc,SAAS;AAC7B,WAAK,eAAe;AAAA,IACxB;AAAA,EACJ;AAAA,EAEQ,iBAAuB;AAC3B,SAAK,cACD,IAAI,MAAM,SAAS;AAAA,MACf,SAAS;AAAA,IACb,CAAC,CACL;AAAA,EACJ;AAAA,EAEU,8BAAoC;AAC1C,QAAI,CAAC,KAAK,MAAM;AACZ,WAAK,eAAe;AACpB,WAAK,yBAAyB;AAAA,IAClC;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,oBAAoB,IAAI,QACzB,CAAC,QAAS,KAAK,2BAA2B,GAC9C;AAAA,IACJ;AACA,UAAM,OAAO,OAAO;AAAA,EACxB;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA,wBAES,KAAK;AAAA,yBACJ,KAAK;AAAA,iCACG,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKL,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlC;AAAA,QAUyB,oBAAsC;AAC3D,UAAM,WAAY,MAAM,MAAM,kBAAkB;AAChD,UAAM,KAAK;AACX,WAAO;AAAA,EACX;AACJ;AAtGW;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AANJ,KAMI;AAYC;AAAA,EADR,AAAC,MAAM,OAAO;AAAA,GACN,AAlBL,KAkBK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
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;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
export * from './Tray.js';
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from "./Tray.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { css } from "@spectrum-web-components/base";
|
|
2
|
+
const styles = css`
|
|
3
|
+
: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;
|
|
6
|
+
//# 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 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": []
|
|
7
|
+
}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { css } from '@spectrum-web-components/base';
|
|
13
|
-
const styles = css `
|
|
1
|
+
import { css } from "@spectrum-web-components/base";
|
|
2
|
+
const styles = css`
|
|
14
3
|
: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)}}
|
|
15
4
|
`;
|
|
16
5
|
export default styles;
|
|
17
|
-
//# sourceMappingURL=spectrum-tray-wrapper.css.js.map
|
|
6
|
+
//# sourceMappingURL=spectrum-tray-wrapper.css.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-tray-wrapper.css.ts"],
|
|
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": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { css } from "@spectrum-web-components/base";
|
|
2
|
+
const styles = css`
|
|
3
|
+
.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
|
+
--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
|
|
5
|
+
) var(
|
|
6
|
+
--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
|
|
7
|
+
) 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(
|
|
8
|
+
--spectrum-tray-min-height,var(--spectrum-global-dimension-static-size-800)
|
|
9
|
+
);outline:none;overflow:auto;padding:var(--spectrum-tray-padding-y,0) var(
|
|
10
|
+
--spectrum-tray-padding-x,var(--spectrum-global-dimension-static-size-100)
|
|
11
|
+
);transform:translateY(100%);transition:opacity var(
|
|
12
|
+
--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)
|
|
13
|
+
) 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(
|
|
14
|
+
--spectrum-dialog-confirm-exit-animation-duration,
|
|
15
|
+
var(--spectrum-global-animation-duration-100)
|
|
16
|
+
)),transform var(
|
|
17
|
+
--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)
|
|
18
|
+
) 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(
|
|
19
|
+
--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)
|
|
20
|
+
) cubic-bezier(0,0,.4,1) var(
|
|
21
|
+
--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)
|
|
22
|
+
),opacity var(
|
|
23
|
+
--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)
|
|
24
|
+
) cubic-bezier(0,0,.4,1) var(
|
|
25
|
+
--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)
|
|
26
|
+
)}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}
|
|
27
|
+
`;
|
|
28
|
+
export default styles;
|
|
29
|
+
//# sourceMappingURL=spectrum-tray.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-tray.css.ts"],
|
|
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": []
|
|
7
|
+
}
|
package/src/spectrum-tray.css.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { css } from '@spectrum-web-components/base';
|
|
13
|
-
const styles = css `
|
|
1
|
+
import { css } from "@spectrum-web-components/base";
|
|
2
|
+
const styles = css`
|
|
14
3
|
.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(
|
|
15
4
|
--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
|
|
16
5
|
) var(
|
|
@@ -37,4 +26,4 @@ var(--spectrum-global-animation-duration-100)
|
|
|
37
26
|
)}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}
|
|
38
27
|
`;
|
|
39
28
|
export default styles;
|
|
40
|
-
//# sourceMappingURL=spectrum-tray.css.js.map
|
|
29
|
+
//# sourceMappingURL=spectrum-tray.css.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-tray.css.ts"],
|
|
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": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { css } from "@spectrum-web-components/base";
|
|
2
|
+
const styles = css`
|
|
3
|
+
: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
|
+
--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
|
|
5
|
+
) var(
|
|
6
|
+
--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
|
|
7
|
+
) 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(
|
|
8
|
+
--spectrum-tray-min-height,var(--spectrum-global-dimension-static-size-800)
|
|
9
|
+
);outline:none;overflow:auto;padding:var(--spectrum-tray-padding-y,0) var(
|
|
10
|
+
--spectrum-tray-padding-x,var(--spectrum-global-dimension-static-size-100)
|
|
11
|
+
);transform:translateY(100%);transition:opacity var(
|
|
12
|
+
--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)
|
|
13
|
+
) 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(
|
|
14
|
+
--spectrum-dialog-confirm-exit-animation-duration,
|
|
15
|
+
var(--spectrum-global-animation-duration-100)
|
|
16
|
+
)),transform var(
|
|
17
|
+
--spectrum-dialog-confirm-exit-animation-duration,var(--spectrum-global-animation-duration-100)
|
|
18
|
+
) 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(
|
|
19
|
+
--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)
|
|
20
|
+
) cubic-bezier(0,0,.4,1) var(
|
|
21
|
+
--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)
|
|
22
|
+
),opacity var(
|
|
23
|
+
--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)
|
|
24
|
+
) cubic-bezier(0,0,.4,1) var(
|
|
25
|
+
--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)
|
|
26
|
+
)}@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;
|
|
29
|
+
//# sourceMappingURL=tray.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray.css.ts"],
|
|
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": []
|
|
7
|
+
}
|
package/src/tray.css.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { css } from '@spectrum-web-components/base';
|
|
13
|
-
const styles = css `
|
|
1
|
+
import { css } from "@spectrum-web-components/base";
|
|
2
|
+
const styles = css`
|
|
14
3
|
: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(
|
|
15
4
|
--spectrum-tray-full-width-border-radius,var(--spectrum-alias-border-radius-regular)
|
|
16
5
|
) var(
|
|
@@ -37,4 +26,4 @@ var(--spectrum-global-animation-duration-100)
|
|
|
37
26
|
)}@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}
|
|
38
27
|
`;
|
|
39
28
|
export default styles;
|
|
40
|
-
//# sourceMappingURL=tray.css.js.map
|
|
29
|
+
//# sourceMappingURL=tray.css.js.map
|
package/src/tray.css.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tray.css.ts"],
|
|
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": []
|
|
7
|
+
}
|
package/stories/tray.stories.js
CHANGED
|
@@ -1,43 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { html } from '@spectrum-web-components/base';
|
|
13
|
-
import '@spectrum-web-components/dialog/sp-dialog.js';
|
|
14
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
15
|
-
import '@spectrum-web-components/menu/sp-menu-item.js';
|
|
16
|
-
import '@spectrum-web-components/menu/sp-menu-divider.js';
|
|
17
|
-
import '../sp-tray.js';
|
|
1
|
+
import { html } from "@spectrum-web-components/base";
|
|
2
|
+
import "@spectrum-web-components/dialog/sp-dialog.js";
|
|
3
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
6
|
+
import "@spectrum-web-components/tray/sp-tray.js";
|
|
18
7
|
export default {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
8
|
+
title: "Tray",
|
|
9
|
+
component: "sp-tray",
|
|
10
|
+
args: {
|
|
11
|
+
open: true
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
open: {
|
|
15
|
+
name: "open",
|
|
16
|
+
type: { name: "boolean", required: false },
|
|
17
|
+
description: "Whether the tray is open.",
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: "boolean" },
|
|
20
|
+
defaultValue: { summary: false }
|
|
21
|
+
},
|
|
22
|
+
control: {
|
|
23
|
+
type: "boolean"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
38
27
|
};
|
|
39
28
|
export const Default = (args) => {
|
|
40
|
-
|
|
29
|
+
return html`
|
|
41
30
|
<sp-tray ?open=${args.open}>
|
|
42
31
|
<sp-dialog size="s">
|
|
43
32
|
<h2 slot="heading">New Messages</h2>
|
|
@@ -47,7 +36,7 @@ export const Default = (args) => {
|
|
|
47
36
|
`;
|
|
48
37
|
};
|
|
49
38
|
export const menu = (args) => {
|
|
50
|
-
|
|
39
|
+
return html`
|
|
51
40
|
<sp-tray ?open=${args.open}>
|
|
52
41
|
<sp-menu style="width: 100%">
|
|
53
42
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -61,4 +50,4 @@ export const menu = (args) => {
|
|
|
61
50
|
</sp-tray>
|
|
62
51
|
`;
|
|
63
52
|
};
|
|
64
|
-
//# sourceMappingURL=tray.stories.js.map
|
|
53
|
+
//# sourceMappingURL=tray.stories.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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;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;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import '@spectrum-web-components/dialog/sp-dialog.js';
|
|
13
|
-
import '@spectrum-web-components/tray/sp-tray.js';
|
|
14
|
-
import { html } from 'lit';
|
|
15
|
-
import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
|
|
16
|
-
measureFixtureCreation(html `
|
|
1
|
+
import "@spectrum-web-components/dialog/sp-dialog.js";
|
|
2
|
+
import "@spectrum-web-components/tray/sp-tray.js";
|
|
3
|
+
import { html } from "lit";
|
|
4
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
5
|
+
measureFixtureCreation(html`
|
|
17
6
|
<sp-tray open>
|
|
18
7
|
<sp-dialog size="s">
|
|
19
8
|
<h2 slot="heading">New Messages</h2>
|
|
@@ -21,4 +10,4 @@ measureFixtureCreation(html `
|
|
|
21
10
|
</sp-dialog>
|
|
22
11
|
</sp-tray>
|
|
23
12
|
`);
|
|
24
|
-
//# sourceMappingURL=basic-test.js.map
|
|
13
|
+
//# sourceMappingURL=basic-test.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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;AACA;AACA;AACA;AAEA,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAOtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/test/tray.test-vrt.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import * as stories from '../stories/tray.stories.js';
|
|
13
|
-
import { regressVisuals } from '../../../test/visual/test.js';
|
|
14
|
-
regressVisuals('TrayStories', stories);
|
|
15
|
-
//# sourceMappingURL=tray.test-vrt.js.map
|
|
1
|
+
import * as stories from "../stories/tray.stories.js";
|
|
2
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
3
|
+
regressVisuals("TrayStories", stories);
|
|
4
|
+
//# sourceMappingURL=tray.test-vrt.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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';\n\nregressVisuals('TrayStories', stories);\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AAEA,eAAe,eAAe,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/test/tray.test.js
CHANGED
|
@@ -1,72 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import '@spectrum-web-components/theme/src/themes.js';
|
|
16
|
-
describe('Tray', () => {
|
|
17
|
-
it('loads default tray accessibly', async () => {
|
|
18
|
-
const el = await fixture(html `
|
|
1
|
+
import {
|
|
2
|
+
elementUpdated,
|
|
3
|
+
expect,
|
|
4
|
+
fixture,
|
|
5
|
+
html,
|
|
6
|
+
nextFrame,
|
|
7
|
+
oneEvent
|
|
8
|
+
} from "@open-wc/testing";
|
|
9
|
+
import "@spectrum-web-components/tray/sp-tray.js";
|
|
10
|
+
import "@spectrum-web-components/theme/sp-theme.js";
|
|
11
|
+
import "@spectrum-web-components/theme/src/themes.js";
|
|
12
|
+
describe("Tray", () => {
|
|
13
|
+
it("loads default tray accessibly", async () => {
|
|
14
|
+
const el = await fixture(html`
|
|
19
15
|
<sp-tray></sp-tray>
|
|
20
16
|
`);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
await elementUpdated(el);
|
|
18
|
+
await expect(el).to.be.accessible();
|
|
19
|
+
});
|
|
20
|
+
it("focuses focusable light DOM element", async () => {
|
|
21
|
+
const el = await fixture(html`
|
|
26
22
|
<sp-tray open>
|
|
27
23
|
<div>
|
|
28
24
|
<a href="#">Test element</a>
|
|
29
25
|
</div>
|
|
30
26
|
</sp-tray>
|
|
31
27
|
`);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
const anchor = el.querySelector("a");
|
|
29
|
+
await elementUpdated(el);
|
|
30
|
+
el.focus();
|
|
31
|
+
await elementUpdated(el);
|
|
32
|
+
expect(document.activeElement).to.equal(anchor);
|
|
33
|
+
});
|
|
34
|
+
it('focuses "tray"', async () => {
|
|
35
|
+
const el = await fixture(html`
|
|
40
36
|
<sp-tray open>
|
|
41
37
|
<div></div>
|
|
42
38
|
</sp-tray>
|
|
43
39
|
`);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
await elementUpdated(el);
|
|
41
|
+
el.focus();
|
|
42
|
+
await elementUpdated(el);
|
|
43
|
+
expect(document.activeElement).to.equal(el);
|
|
44
|
+
expect(el.shadowRoot.activeElement).to.equal(el.tray);
|
|
45
|
+
});
|
|
46
|
+
it("closes", async () => {
|
|
47
|
+
const test = await fixture(html`
|
|
52
48
|
<sp-theme theme="classic" scale="medium" color="dark">
|
|
53
49
|
<sp-tray></sp-tray>
|
|
54
50
|
</sp-theme>
|
|
55
51
|
`);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
expect(el.open).to.be.false;
|
|
70
|
-
});
|
|
52
|
+
const el = test.querySelector("sp-tray");
|
|
53
|
+
await nextFrame();
|
|
54
|
+
await nextFrame();
|
|
55
|
+
expect(el.open).to.be.false;
|
|
56
|
+
el.open = true;
|
|
57
|
+
await elementUpdated(el);
|
|
58
|
+
expect(el.open).to.be.true;
|
|
59
|
+
const closed = oneEvent(el, "close");
|
|
60
|
+
const overlay = el.shadowRoot.querySelector("sp-underlay");
|
|
61
|
+
overlay.click();
|
|
62
|
+
await closed;
|
|
63
|
+
expect(el.open).to.be.false;
|
|
64
|
+
});
|
|
71
65
|
});
|
|
72
|
-
//# sourceMappingURL=tray.test.js.map
|
|
66
|
+
//# sourceMappingURL=tray.test.js.map
|
package/test/tray.test.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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';\n\ndescribe('Tray', () => {\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;AAEA,SAAS,QAAQ,MAAM;AACnB,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,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,aAAa,EAAE,GAAG,MAAM,MAAM;AAAA,EAClD,CAAC;AACD,KAAG,kBAAkB,YAAY;AAC7B,UAAM,KAAK,MAAM,QACb;AAAA;AAAA;AAAA;AAAA,aAKJ;AACA,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,MAClC,GAA2C,IAChD;AAAA,EACJ,CAAC;AACD,KAAG,UAAU,YAAY;AACrB,UAAM,OAAO,MAAM,QACf;AAAA;AAAA;AAAA;AAAA,aAKJ;AAEA,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,cAC1B,aACJ;AACA,YAAQ,MAAM;AACd,UAAM;AAEN,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAAA,EAC1B,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|