@spectrum-web-components/tray 0.3.3-express.9 → 0.3.3

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/README.md CHANGED
@@ -26,70 +26,34 @@ import { Tray } from '@spectrum-web-components/tray';
26
26
  ## Dialog
27
27
 
28
28
  ```html
29
- <sp-button
30
- variant="secondary"
31
- onclick="
32
- const trigger = this;
33
- const interaction = 'modal';
34
- const content = this.nextElementSibling;
35
- const options = {
36
- offset: 0,
37
- placement: 'none',
38
- receivesFocus: 'auto',
39
- };
40
- Overlay.open(
41
- trigger,
42
- interaction,
43
- content,
44
- options
45
- );
46
- "
47
- >
48
- Toggle tray
49
- </sp-button>
50
- <sp-tray>
51
- <sp-dialog size="small" dismissable>
52
- <h2 slot="heading">New Messages</h2>
53
- You have 5 new messages.
54
- </sp-dialog>
55
- </sp-tray>
29
+ <overlay-trigger type="modal" placement="none">
30
+ <sp-button slot="trigger" variant="secondary">Toggle tray</sp-button>
31
+ <sp-tray slot="click-content">
32
+ <sp-dialog size="small" dismissable>
33
+ <h2 slot="heading">New Messages</h2>
34
+ You have 5 new messages.
35
+ </sp-dialog>
36
+ </sp-tray>
37
+ </overlay-trigger>
56
38
  ```
57
39
 
58
40
  ## Menu
59
41
 
60
42
  ```html
61
- <sp-button
62
- variant="secondary"
63
- onclick="
64
- const trigger = this;
65
- const interaction = 'modal';
66
- const content = this.nextElementSibling;
67
- const options = {
68
- offset: 0,
69
- placement: 'none',
70
- receivesFocus: 'auto',
71
- };
72
- Overlay.open(
73
- trigger,
74
- interaction,
75
- content,
76
- options
77
- );
78
- "
79
- >
80
- Toggle menu
81
- </sp-button>
82
- <sp-tray>
83
- <sp-menu style="width: 100%">
84
- <sp-menu-item selected>Deselect</sp-menu-item>
85
- <sp-menu-item>Select Inverse</sp-menu-item>
86
- <sp-menu-item focused>Feather...</sp-menu-item>
87
- <sp-menu-item>Select and Mask...</sp-menu-item>
88
- <sp-menu-divider></sp-menu-divider>
89
- <sp-menu-item>Save Selection</sp-menu-item>
90
- <sp-menu-item disabled>Make Work Path</sp-menu-item>
91
- </sp-menu>
92
- </sp-tray>
43
+ <overlay-trigger type="modal" placement="none">
44
+ <sp-button slot="trigger" variant="secondary">Toggle menu</sp-button>
45
+ <sp-tray slot="click-content">
46
+ <sp-menu style="width: 100%">
47
+ <sp-menu-item selected>Deselect</sp-menu-item>
48
+ <sp-menu-item>Select Inverse</sp-menu-item>
49
+ <sp-menu-item focused>Feather...</sp-menu-item>
50
+ <sp-menu-item>Select and Mask...</sp-menu-item>
51
+ <sp-menu-divider></sp-menu-divider>
52
+ <sp-menu-item>Save Selection</sp-menu-item>
53
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
54
+ </sp-menu>
55
+ </sp-tray>
56
+ </overlay-trigger>
93
57
  ```
94
58
 
95
59
  ## Accessibility
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/tray",
3
- "version": "0.3.3-express.9+abfee7409",
3
+ "version": "0.3.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -44,20 +44,20 @@
44
44
  "lit-html"
45
45
  ],
46
46
  "dependencies": {
47
- "@spectrum-web-components/base": "^0.5.2",
48
- "@spectrum-web-components/modal": "^0.6.2-express.9+abfee7409",
49
- "@spectrum-web-components/reactive-controllers": "^0.2.0",
50
- "@spectrum-web-components/shared": "^0.13.4",
51
- "@spectrum-web-components/underlay": "^0.8.4-express.9+abfee7409",
47
+ "@spectrum-web-components/base": "^0.5.3",
48
+ "@spectrum-web-components/modal": "^0.6.2",
49
+ "@spectrum-web-components/reactive-controllers": "^0.2.1",
50
+ "@spectrum-web-components/shared": "^0.13.5",
51
+ "@spectrum-web-components/underlay": "^0.8.4",
52
52
  "tslib": "^2.0.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@spectrum-css/tray": "^1.0.17"
55
+ "@spectrum-css/tray": "^1.0.18"
56
56
  },
57
57
  "types": "./src/index.d.ts",
58
58
  "customElements": "custom-elements.json",
59
59
  "sideEffects": [
60
60
  "./sp-*.js"
61
61
  ],
62
- "gitHead": "abfee740957976448a3e4cf90df17d6165f857d6"
62
+ "gitHead": "57aba8030b6af96af4015a0aa830e342a17dc219"
63
63
  }
@@ -1,64 +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 { 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';
18
- export default {
19
- title: 'Tray',
20
- component: 'sp-tray',
21
- args: {
22
- open: true,
23
- },
24
- argTypes: {
25
- open: {
26
- name: 'open',
27
- type: { name: 'boolean', required: false },
28
- description: 'Whether the tray is open.',
29
- table: {
30
- type: { summary: 'boolean' },
31
- defaultValue: { summary: false },
32
- },
33
- control: {
34
- type: 'boolean',
35
- },
36
- },
37
- },
38
- };
39
- export const Default = (args) => {
40
- return html `
41
- <sp-tray ?open=${args.open}>
42
- <sp-dialog size="s">
43
- <h2 slot="heading">New Messages</h2>
44
- You have 5 new messages.
45
- </sp-dialog>
46
- </sp-tray>
47
- `;
48
- };
49
- export const menu = (args) => {
50
- return html `
51
- <sp-tray ?open=${args.open}>
52
- <sp-menu style="width: 100%">
53
- <sp-menu-item>Deselect</sp-menu-item>
54
- <sp-menu-item selected>Select Inverse</sp-menu-item>
55
- <sp-menu-item>Feather...</sp-menu-item>
56
- <sp-menu-item>Select and Mask...</sp-menu-item>
57
- <sp-menu-divider></sp-menu-divider>
58
- <sp-menu-item>Save Selection</sp-menu-item>
59
- <sp-menu-item disabled>Make Work Path</sp-menu-item>
60
- </sp-menu>
61
- </sp-tray>
62
- `;
63
- };
64
- //# sourceMappingURL=tray.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tray.stories.js","sourceRoot":"","sources":["tray.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AAErE,OAAO,8CAA8C,CAAC;AACtD,OAAO,0CAA0C,CAAC;AAClD,OAAO,+CAA+C,CAAC;AACvD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,eAAe,CAAC;AAEvB,eAAe;IACX,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE;QACF,IAAI,EAAE,IAAI;KACb;IACD,QAAQ,EAAE;QACN,IAAI,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE;YAC1C,WAAW,EAAE,2BAA2B;YACxC,KAAK,EAAE;gBACH,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;gBAC5B,YAAY,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aACnC;YACD,OAAO,EAAE;gBACL,IAAI,EAAE,SAAS;aAClB;SACJ;KACJ;CACJ,CAAC;AAMF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAe,EAAkB,EAAE;IACvD,OAAO,IAAI,CAAA;yBACU,IAAI,CAAC,IAAI;;;;;;KAM7B,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAe,EAAkB,EAAE;IACpD,OAAO,IAAI,CAAA;yBACU,IAAI,CAAC,IAAI;;;;;;;;;;;KAW7B,CAAC;AACN,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 { 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 '../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"]}
@@ -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,60 +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, nextFrame, oneEvent, } from '@open-wc/testing';
13
- import '../sp-tray.js';
14
- import '@spectrum-web-components/theme/sp-theme.js';
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 `
19
- <sp-tray></sp-tray>
20
- `);
21
- await elementUpdated(el);
22
- await expect(el).to.be.accessible();
23
- });
24
- it('focuses focusable light DOM element', async () => {
25
- const el = await fixture(html `
26
- <sp-tray open>
27
- <div>
28
- <a href="#">Test element</a>
29
- </div>
30
- </sp-tray>
31
- `);
32
- const anchor = el.querySelector('a');
33
- await elementUpdated(el);
34
- el.focus();
35
- await elementUpdated(el);
36
- expect(document.activeElement).to.equal(anchor);
37
- });
38
- it('closes', async () => {
39
- const test = await fixture(html `
40
- <sp-theme scale="medium" color="dark">
41
- <sp-tray></sp-tray>
42
- </sp-theme>
43
- `);
44
- const el = test.querySelector('sp-tray');
45
- // Ensure closed styles are set before opening so that
46
- // the `transitionend` event will be met below.
47
- await nextFrame();
48
- await nextFrame();
49
- expect(el.open).to.be.false;
50
- el.open = true;
51
- await elementUpdated(el);
52
- expect(el.open).to.be.true;
53
- const closed = oneEvent(el, 'close');
54
- const overlay = el.shadowRoot.querySelector('sp-underlay');
55
- overlay.click();
56
- await closed;
57
- expect(el.open).to.be.false;
58
- });
59
- });
60
- //# sourceMappingURL=tray.test.js.map
@@ -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,SAAS,EACT,QAAQ,GACX,MAAM,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I,GAAG,IAAI,CAAC;QACf,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,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 nextFrame,\n oneEvent,\n} from '@open-wc/testing';\n\nimport '../sp-tray.js';\nimport { Tray } from '..';\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('closes', async () => {\n const test = await fixture<HTMLElement>(\n html`\n <sp-theme 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"]}