@spectrum-web-components/tray 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +4 -3
- package/package.json +7 -7
- package/src/Tray.d.ts +2 -0
- package/src/Tray.js +2 -0
- package/src/Tray.js.map +1 -1
- package/src/spectrum-tray.css.js +1 -1
- package/src/spectrum-tray.css.js.map +1 -1
- package/src/tray.css.js +1 -1
- package/src/tray.css.js.map +1 -1
- package/test/tray.test-vrt.js +0 -15
- package/test/tray.test-vrt.js.map +0 -1
- package/test/tray.test.js +0 -49
- package/test/tray.test.js.map +0 -1
package/custom-elements.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"name": "close",
|
|
78
78
|
"type": {
|
|
79
79
|
"text": "Event"
|
|
80
|
-
}
|
|
80
|
+
},
|
|
81
|
+
"description": "Announces that the Tray has been closed."
|
|
81
82
|
}
|
|
82
83
|
],
|
|
83
84
|
"attributes": [
|
|
@@ -131,7 +132,7 @@
|
|
|
131
132
|
{
|
|
132
133
|
"kind": "variable",
|
|
133
134
|
"name": "styles",
|
|
134
|
-
"default": "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-
|
|
135
|
+
"default": "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`"
|
|
135
136
|
}
|
|
136
137
|
],
|
|
137
138
|
"exports": [
|
|
@@ -152,7 +153,7 @@
|
|
|
152
153
|
{
|
|
153
154
|
"kind": "variable",
|
|
154
155
|
"name": "styles",
|
|
155
|
-
"default": "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-
|
|
156
|
+
"default": "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)}}:host{align-items:flex-end}.tray{padding:var(--spectrum-tray-padding-y,0) var(--spectrum-tray-padding-x,0)}\n`"
|
|
156
157
|
}
|
|
157
158
|
],
|
|
158
159
|
"exports": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/tray",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
"lit-html"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@spectrum-web-components/base": "^0.5.
|
|
48
|
-
"@spectrum-web-components/modal": "^0.5.
|
|
49
|
-
"@spectrum-web-components/shared": "^0.13.
|
|
50
|
-
"@spectrum-web-components/underlay": "^0.8.
|
|
47
|
+
"@spectrum-web-components/base": "^0.5.1",
|
|
48
|
+
"@spectrum-web-components/modal": "^0.5.1",
|
|
49
|
+
"@spectrum-web-components/shared": "^0.13.1",
|
|
50
|
+
"@spectrum-web-components/underlay": "^0.8.1",
|
|
51
51
|
"tslib": "^2.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@spectrum-css/tray": "^1.0.
|
|
54
|
+
"@spectrum-css/tray": "^1.0.11"
|
|
55
55
|
},
|
|
56
56
|
"types": "./src/index.d.ts",
|
|
57
57
|
"customElements": "custom-elements.json",
|
|
58
58
|
"sideEffects": [
|
|
59
59
|
"./sp-*.js"
|
|
60
60
|
],
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "df3f333ee26a45f9fc247716b6e8ef051dca630b"
|
|
62
62
|
}
|
package/src/Tray.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import '@spectrum-web-components/underlay/sp-underlay.js';
|
|
|
4
4
|
* @element sp-tray
|
|
5
5
|
*
|
|
6
6
|
* @slot - content to display within the Tray
|
|
7
|
+
*
|
|
8
|
+
* @fires close - Announces that the Tray has been closed.
|
|
7
9
|
*/
|
|
8
10
|
export declare class Tray extends SpectrumElement {
|
|
9
11
|
static get styles(): CSSResultArray;
|
package/src/Tray.js
CHANGED
package/src/Tray.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tray.js","sourceRoot":"","sources":["Tray.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EACJ,eAAe,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,QAAQ,EACR,KAAK,GACR,MAAM,iDAAiD,CAAC;AACzD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAE7F,OAAO,WAAW,MAAM,iDAAiD,CAAC;AAC1E,OAAO,MAAM,MAAM,eAAe,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"Tray.js","sourceRoot":"","sources":["Tray.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EACJ,eAAe,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,QAAQ,EACR,KAAK,GACR,MAAM,iDAAiD,CAAC;AACzD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAE7F,OAAO,WAAW,MAAM,iDAAiD,CAAC;AAC1E,OAAO,MAAM,MAAM,eAAe,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,IAAK,SAAQ,eAAe;IAAzC;;QAMW,SAAI,GAAG,KAAK,CAAC;IAiCxB,CAAC;IAtCU,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAQM,KAAK;QACR,MAAM,cAAc,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,cAAc,EAAE;YAChB,cAAc,CAAC,KAAK,EAAE,CAAC;SAC1B;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;SACrB;aAAM;YACH,KAAK,CAAC,KAAK,EAAE,CAAC;SACjB;IACL,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,aAAa,CACd,IAAI,KAAK,CAAC,OAAO,EAAE;YACf,OAAO,EAAE,IAAI;SAChB,CAAC,CACL,CAAC;IACN,CAAC;IAES,MAAM;QACZ,OAAO,IAAI,CAAA;iCACc,IAAI,CAAC,IAAI,WAAW,IAAI,CAAC,KAAK;;;;SAItD,CAAC;IACN,CAAC;CACJ;AAjCG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kCACvB;AAGpB;IADC,KAAK,CAAC,OAAO,CAAC;kCACe","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\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';\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 get styles(): CSSResultArray {\n return [modalStyles, styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n @query('.tray')\n private tray!: HTMLDivElement;\n\n public 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 close(): void {\n this.open = false;\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected render(): TemplateResult {\n return html`\n <sp-underlay ?open=${this.open} @click=${this.close}></sp-underlay>\n <div class=\"tray modal\" tabindex=\"-1\">\n <slot></slot>\n </div>\n `;\n }\n}\n"]}
|
package/src/spectrum-tray.css.js
CHANGED
|
@@ -34,7 +34,7 @@ var(--spectrum-global-animation-duration-100)
|
|
|
34
34
|
--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)
|
|
35
35
|
) cubic-bezier(0,0,.4,1) var(
|
|
36
36
|
--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)
|
|
37
|
-
)}@media (max-
|
|
37
|
+
)}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}
|
|
38
38
|
`;
|
|
39
39
|
export default styles;
|
|
40
40
|
//# sourceMappingURL=spectrum-tray.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spectrum-tray.css.js","sourceRoot":"","sources":["spectrum-tray.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBjB,CAAC;AACF,eAAe,MAAM,CAAC","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*/\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-
|
|
1
|
+
{"version":3,"file":"spectrum-tray.css.js","sourceRoot":"","sources":["spectrum-tray.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBjB,CAAC;AACF,eAAe,MAAM,CAAC","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*/\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;"]}
|
package/src/tray.css.js
CHANGED
|
@@ -34,7 +34,7 @@ var(--spectrum-global-animation-duration-100)
|
|
|
34
34
|
--spectrum-dialog-confirm-entry-animation-duration,var(--spectrum-global-animation-duration-500)
|
|
35
35
|
) cubic-bezier(0,0,.4,1) var(
|
|
36
36
|
--spectrum-dialog-confirm-entry-animation-delay,var(--spectrum-global-animation-duration-200)
|
|
37
|
-
)}@media (max-
|
|
37
|
+
)}@media (max-width:375px){.tray{border-radius:var(--spectrum-tray-border-radius,0)}}:host{align-items:flex-end}.tray{padding:var(--spectrum-tray-padding-y,0) var(--spectrum-tray-padding-x,0)}
|
|
38
38
|
`;
|
|
39
39
|
export default styles;
|
|
40
40
|
//# sourceMappingURL=tray.css.js.map
|
package/src/tray.css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tray.css.js","sourceRoot":"","sources":["tray.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBjB,CAAC;AACF,eAAe,MAAM,CAAC","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*/\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-
|
|
1
|
+
{"version":3,"file":"tray.css.js","sourceRoot":"","sources":["tray.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBjB,CAAC;AACF,eAAe,MAAM,CAAC","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*/\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)}}:host{align-items:flex-end}.tray{padding:var(--spectrum-tray-padding-y,0) var(--spectrum-tray-padding-x,0)}\n`;\nexport default styles;"]}
|
package/test/tray.test-vrt.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
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 * 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tray.test-vrt.js","sourceRoot":"","sources":["tray.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC","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"]}
|
package/test/tray.test.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
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 { elementUpdated, expect, fixture, html, oneEvent, } from '@open-wc/testing';
|
|
13
|
-
import '../sp-tray.js';
|
|
14
|
-
describe('Tray', () => {
|
|
15
|
-
it('loads default tray accessibly', async () => {
|
|
16
|
-
const el = await fixture(html `
|
|
17
|
-
<sp-tray></sp-tray>
|
|
18
|
-
`);
|
|
19
|
-
await elementUpdated(el);
|
|
20
|
-
await expect(el).to.be.accessible();
|
|
21
|
-
});
|
|
22
|
-
it('focuses focusable light DOM element', async () => {
|
|
23
|
-
const el = await fixture(html `
|
|
24
|
-
<sp-tray open>
|
|
25
|
-
<div>
|
|
26
|
-
<a href="#">Test element</a>
|
|
27
|
-
</div>
|
|
28
|
-
</sp-tray>
|
|
29
|
-
`);
|
|
30
|
-
const anchor = el.querySelector('a');
|
|
31
|
-
await elementUpdated(el);
|
|
32
|
-
el.focus();
|
|
33
|
-
await elementUpdated(el);
|
|
34
|
-
expect(document.activeElement).to.equal(anchor);
|
|
35
|
-
});
|
|
36
|
-
it('closes', async () => {
|
|
37
|
-
const el = await fixture(html `
|
|
38
|
-
<sp-tray open></sp-tray>
|
|
39
|
-
`);
|
|
40
|
-
await elementUpdated(el);
|
|
41
|
-
expect(el.open).to.be.true;
|
|
42
|
-
const closed = oneEvent(el, 'close');
|
|
43
|
-
const overlay = el.shadowRoot.querySelector('sp-underlay');
|
|
44
|
-
overlay.click();
|
|
45
|
-
await closed;
|
|
46
|
-
expect(el.open).to.be.false;
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=tray.test.js.map
|
package/test/tray.test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tray.test.js","sourceRoot":"","sources":["tray.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EACH,cAAc,EACd,MAAM,EACN,OAAO,EACP,IAAI,EACJ,QAAQ,GACX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,eAAe,CAAC;AAGvB,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;aAEH,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACjD,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;;;;;aAMH,CACJ,CAAC;QACF,MAAM,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QACpB,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;aAEH,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QACzB,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CACvC,aAAa,CACD,CAAC;QACjB,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","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 oneEvent,\n} from '@open-wc/testing';\n\nimport '../sp-tray.js';\nimport { Tray } from '..';\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('closes', async () => {\n const el = await fixture<Tray>(\n html`\n <sp-tray open></sp-tray>\n `\n );\n\n await elementUpdated(el);\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"]}
|