@spectrum-web-components/action-menu 0.36.0 → 0.38.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/custom-elements.json +22 -0
- package/package.json +8 -8
- package/src/ActionMenu.d.ts +1 -0
- package/src/ActionMenu.dev.js +14 -3
- package/src/ActionMenu.dev.js.map +2 -2
- package/src/ActionMenu.js +12 -8
- package/src/ActionMenu.js.map +2 -2
- package/src/action-menu.css.dev.js +1 -1
- package/src/action-menu.css.dev.js.map +1 -1
- package/src/action-menu.css.js +1 -1
- package/src/action-menu.css.js.map +1 -1
- package/stories/action-menu.stories.js +38 -2
- package/stories/action-menu.stories.js.map +2 -2
- package/stories/index.js +8 -3
- package/stories/index.js.map +2 -2
- package/test/index.js +174 -27
- package/test/index.js.map +2 -2
package/custom-elements.json
CHANGED
|
@@ -60,6 +60,17 @@
|
|
|
60
60
|
"default": "undefined",
|
|
61
61
|
"attribute": "selects"
|
|
62
62
|
},
|
|
63
|
+
{
|
|
64
|
+
"kind": "field",
|
|
65
|
+
"name": "static",
|
|
66
|
+
"type": {
|
|
67
|
+
"text": "'white' | 'black' | undefined"
|
|
68
|
+
},
|
|
69
|
+
"privacy": "public",
|
|
70
|
+
"default": "undefined",
|
|
71
|
+
"attribute": "static",
|
|
72
|
+
"reflects": true
|
|
73
|
+
},
|
|
63
74
|
{
|
|
64
75
|
"kind": "field",
|
|
65
76
|
"name": "listRole",
|
|
@@ -109,6 +120,17 @@
|
|
|
109
120
|
"module": "src/ActionMenu.ts"
|
|
110
121
|
},
|
|
111
122
|
"fieldName": "selects"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "static",
|
|
126
|
+
"type": {
|
|
127
|
+
"text": "'white' | 'black' | undefined"
|
|
128
|
+
},
|
|
129
|
+
"default": "undefined",
|
|
130
|
+
"resolveInitializer": {
|
|
131
|
+
"module": "src/ActionMenu.ts"
|
|
132
|
+
},
|
|
133
|
+
"fieldName": "static"
|
|
112
134
|
}
|
|
113
135
|
],
|
|
114
136
|
"mixins": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/action-menu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"lit-html"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@spectrum-web-components/action-button": "^0.
|
|
65
|
-
"@spectrum-web-components/base": "^0.
|
|
66
|
-
"@spectrum-web-components/icon": "^0.
|
|
67
|
-
"@spectrum-web-components/icons-workflow": "^0.
|
|
68
|
-
"@spectrum-web-components/picker": "^0.
|
|
69
|
-
"@spectrum-web-components/shared": "^0.
|
|
64
|
+
"@spectrum-web-components/action-button": "^0.38.0",
|
|
65
|
+
"@spectrum-web-components/base": "^0.38.0",
|
|
66
|
+
"@spectrum-web-components/icon": "^0.38.0",
|
|
67
|
+
"@spectrum-web-components/icons-workflow": "^0.38.0",
|
|
68
|
+
"@spectrum-web-components/picker": "^0.38.0",
|
|
69
|
+
"@spectrum-web-components/shared": "^0.38.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@spectrum-css/actionmenu": "^4.0.50"
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"./**/*.dev.js",
|
|
79
79
|
"./sync/sp-*.js"
|
|
80
80
|
],
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "9a099b7543672f2fd4030833ab813b16c2cad62e"
|
|
82
82
|
}
|
package/src/ActionMenu.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ declare const ActionMenu_base: typeof PickerBase & {
|
|
|
20
20
|
export declare class ActionMenu extends ActionMenu_base {
|
|
21
21
|
static get styles(): CSSResultArray;
|
|
22
22
|
selects: undefined | 'single';
|
|
23
|
+
static: 'white' | 'black' | undefined;
|
|
23
24
|
protected listRole: 'listbox' | 'menu';
|
|
24
25
|
protected itemRole: string;
|
|
25
26
|
private get hasLabel();
|
package/src/ActionMenu.dev.js
CHANGED
|
@@ -24,6 +24,7 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
26
26
|
this.selects = void 0;
|
|
27
|
+
this.static = void 0;
|
|
27
28
|
this.listRole = "menu";
|
|
28
29
|
this.itemRole = "menuitem";
|
|
29
30
|
}
|
|
@@ -49,6 +50,7 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
49
50
|
<sp-action-button
|
|
50
51
|
?quiet=${this.quiet}
|
|
51
52
|
?selected=${this.open}
|
|
53
|
+
static=${ifDefined(this.static)}
|
|
52
54
|
aria-haspopup="true"
|
|
53
55
|
aria-controls=${ifDefined(this.open ? "menu" : void 0)}
|
|
54
56
|
aria-expanded=${this.open ? "true" : "false"}
|
|
@@ -56,13 +58,19 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
56
58
|
id="button"
|
|
57
59
|
class="button"
|
|
58
60
|
size=${this.size}
|
|
59
|
-
@blur=${this.
|
|
60
|
-
@
|
|
61
|
-
@focus=${this.
|
|
61
|
+
@blur=${this.handleButtonBlur}
|
|
62
|
+
@pointerdown=${this.handleButtonPointerdown}
|
|
63
|
+
@focus=${this.handleButtonFocus}
|
|
64
|
+
@click=${this.handleButtonClick}
|
|
65
|
+
@keydown=${{
|
|
66
|
+
handleEvent: this.handleEnterKeydown,
|
|
67
|
+
capture: true
|
|
68
|
+
}}
|
|
62
69
|
?disabled=${this.disabled}
|
|
63
70
|
>
|
|
64
71
|
${this.buttonContent}
|
|
65
72
|
</sp-action-button>
|
|
73
|
+
${this.renderMenu}
|
|
66
74
|
`;
|
|
67
75
|
}
|
|
68
76
|
update(changedProperties) {
|
|
@@ -75,4 +83,7 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
75
83
|
__decorateClass([
|
|
76
84
|
property({ type: String })
|
|
77
85
|
], ActionMenu.prototype, "selects", 2);
|
|
86
|
+
__decorateClass([
|
|
87
|
+
property({ type: String, reflect: true })
|
|
88
|
+
], ActionMenu.prototype, "static", 2);
|
|
78
89
|
//# sourceMappingURL=ActionMenu.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ActionMenu.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 TemplateResult,\n} from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { PickerBase } from '@spectrum-web-components/picker';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport actionMenuStyles from './action-menu.css.js';\n\n/**\n * @element sp-action-menu\n *\n * @slot - menu items to be listed in the Action Menu\n * @slot icon - The icon to use for Action Menu\n * @slot label - The label to use on for the Action Menu\n * @slot tooltip - Tooltip to use on for the Action menu\n * @attr selects - By default `sp-action-menu` does not manage a selection. If\n * you'd like for a selection to be held by the `sp-menu` that it presents in\n * its overlay, use `selects=\"single\" to activate this functionality.\n */\nexport class ActionMenu extends ObserveSlotText(PickerBase, 'label') {\n public static override get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public override selects: undefined | 'single' = undefined;\n\n protected override listRole: 'listbox' | 'menu' = 'menu';\n protected override itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n <slot name=\"icon\" slot=\"icon\" ?icon-only=${!this.hasLabel}>\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"tooltip\"></slot>\n `,\n ];\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-action-button\n ?quiet=${this.quiet}\n ?selected=${this.open}\n aria-haspopup=\"true\"\n aria-controls=${ifDefined(this.open ? 'menu' : undefined)}\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${ifDefined(this.label || undefined)}\n id=\"button\"\n class=\"button\"\n size=${this.size}\n @blur=${this.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,OAGG;AACP,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,OAAO;AACP,SAAS,uBAAuB;AAChC,OAAO;AACP,OAAO,sBAAsB;AAatB,aAAM,mBAAmB,gBAAgB,YAAY,OAAO,EAAE;AAAA,EAA9D;AAAA;AAMH,SAAgB,UAAgC;
|
|
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 TemplateResult,\n} from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { PickerBase } from '@spectrum-web-components/picker';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport actionMenuStyles from './action-menu.css.js';\n\n/**\n * @element sp-action-menu\n *\n * @slot - menu items to be listed in the Action Menu\n * @slot icon - The icon to use for Action Menu\n * @slot label - The label to use on for the Action Menu\n * @slot tooltip - Tooltip to use on for the Action menu\n * @attr selects - By default `sp-action-menu` does not manage a selection. If\n * you'd like for a selection to be held by the `sp-menu` that it presents in\n * its overlay, use `selects=\"single\" to activate this functionality.\n */\nexport class ActionMenu extends ObserveSlotText(PickerBase, 'label') {\n public static override get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public override selects: undefined | 'single' = undefined;\n\n @property({ type: String, reflect: true })\n public static: 'white' | 'black' | undefined = undefined;\n\n protected override listRole: 'listbox' | 'menu' = 'menu';\n protected override itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n <slot name=\"icon\" slot=\"icon\" ?icon-only=${!this.hasLabel}>\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"tooltip\"></slot>\n `,\n ];\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-action-button\n ?quiet=${this.quiet}\n ?selected=${this.open}\n static=${ifDefined(this.static)}\n aria-haspopup=\"true\"\n aria-controls=${ifDefined(this.open ? 'menu' : undefined)}\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${ifDefined(this.label || undefined)}\n id=\"button\"\n class=\"button\"\n size=${this.size}\n @blur=${this.handleButtonBlur}\n @pointerdown=${this.handleButtonPointerdown}\n @focus=${this.handleButtonFocus}\n @click=${this.handleButtonClick}\n @keydown=${{\n handleEvent: this.handleEnterKeydown,\n capture: true,\n }}\n ?disabled=${this.disabled}\n >\n ${this.buttonContent}\n </sp-action-button>\n ${this.renderMenu}\n `;\n }\n\n protected override update(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n super.update(changedProperties);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,OAGG;AACP,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,OAAO;AACP,SAAS,uBAAuB;AAChC,OAAO;AACP,OAAO,sBAAsB;AAatB,aAAM,mBAAmB,gBAAgB,YAAY,OAAO,EAAE;AAAA,EAA9D;AAAA;AAMH,SAAgB,UAAgC;AAGhD,SAAO,SAAwC;AAE/C,SAAmB,WAA+B;AAClD,SAAmB,WAAW;AAAA;AAAA,EAX9B,WAA2B,SAAyB;AAChD,WAAO,CAAC,gBAAgB;AAAA,EAC5B;AAAA,EAUA,IAAY,WAAoB;AAC5B,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAuB,gBAAkC;AACrD,WAAO;AAAA,MACH;AAAA,2DAC+C,CAAC,KAAK,QAAQ;AAAA;AAAA;AAAA,6CAG5B,CAAC,KAAK,QAAQ;AAAA;AAAA;AAAA,IAGnD;AAAA,EACJ;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA,yBAEU,KAAK,KAAK;AAAA,4BACP,KAAK,IAAI;AAAA,yBACZ,UAAU,KAAK,MAAM,CAAC;AAAA;AAAA,gCAEf,UAAU,KAAK,OAAO,SAAS,MAAS,CAAC;AAAA,gCACzC,KAAK,OAAO,SAAS,OAAO;AAAA,6BAC/B,UAAU,KAAK,SAAS,MAAS,CAAC;AAAA;AAAA;AAAA,uBAGxC,KAAK,IAAI;AAAA,wBACR,KAAK,gBAAgB;AAAA,+BACd,KAAK,uBAAuB;AAAA,yBAClC,KAAK,iBAAiB;AAAA,yBACtB,KAAK,iBAAiB;AAAA,2BACpB;AAAA,MACP,aAAa,KAAK;AAAA,MAClB,SAAS;AAAA,IACb,CAAC;AAAA,4BACW,KAAK,QAAQ;AAAA;AAAA,kBAEvB,KAAK,aAAa;AAAA;AAAA,cAEtB,KAAK,UAAU;AAAA;AAAA,EAEzB;AAAA,EAEmB,OAAO,mBAA+C;AACrE,QAAI,kBAAkB,IAAI,SAAS,GAAG;AAClC,WAAK,UAAU;AAAA,IACnB;AACA,UAAM,OAAO,iBAAiB;AAAA,EAClC;AACJ;AA1DoB;AAAA,EADf,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GALjB,WAMO;AAGT;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GARhC,WASF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ActionMenu.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=(n,i,t,o)=>{for(var e=o>1?void 0:o?c(i,t):i,r=n.length-1,s;r>=0;r--)(s=n[r])&&(e=(o?s(i,t,e):s(e))||e);return o&&e&&p(i,t,e),e};import{html as d}from"@spectrum-web-components/base";import{ifDefined as a}from"@spectrum-web-components/base/src/directives.js";import{property as u}from"@spectrum-web-components/base/src/decorators.js";import{PickerBase as h}from"@spectrum-web-components/picker";import"@spectrum-web-components/action-button/sp-action-button.js";import{ObserveSlotText as m}from"@spectrum-web-components/shared/src/observe-slot-text.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";import b from"./action-menu.css.js";export class ActionMenu extends m(h,"label"){constructor(){super(...arguments);this.selects=void 0;this.static=void 0;this.listRole="menu";this.itemRole="menuitem"}static get styles(){return[b]}get hasLabel(){return this.slotHasContent}get buttonContent(){return[d`
|
|
2
2
|
<slot name="icon" slot="icon" ?icon-only=${!this.hasLabel}>
|
|
3
3
|
<sp-icon-more class="icon"></sp-icon-more>
|
|
4
4
|
</slot>
|
|
5
5
|
<slot name="label" ?hidden=${!this.hasLabel}></slot>
|
|
6
6
|
<slot name="tooltip"></slot>
|
|
7
|
-
`]}render(){return
|
|
7
|
+
`]}render(){return d`
|
|
8
8
|
<sp-action-button
|
|
9
9
|
?quiet=${this.quiet}
|
|
10
10
|
?selected=${this.open}
|
|
11
|
+
static=${a(this.static)}
|
|
11
12
|
aria-haspopup="true"
|
|
12
|
-
aria-controls=${
|
|
13
|
+
aria-controls=${a(this.open?"menu":void 0)}
|
|
13
14
|
aria-expanded=${this.open?"true":"false"}
|
|
14
|
-
aria-label=${
|
|
15
|
+
aria-label=${a(this.label||void 0)}
|
|
15
16
|
id="button"
|
|
16
17
|
class="button"
|
|
17
18
|
size=${this.size}
|
|
18
|
-
@blur=${this.
|
|
19
|
-
@
|
|
20
|
-
@focus=${this.
|
|
19
|
+
@blur=${this.handleButtonBlur}
|
|
20
|
+
@pointerdown=${this.handleButtonPointerdown}
|
|
21
|
+
@focus=${this.handleButtonFocus}
|
|
22
|
+
@click=${this.handleButtonClick}
|
|
23
|
+
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
|
|
21
24
|
?disabled=${this.disabled}
|
|
22
25
|
>
|
|
23
26
|
${this.buttonContent}
|
|
24
27
|
</sp-action-button>
|
|
25
|
-
|
|
28
|
+
${this.renderMenu}
|
|
29
|
+
`}update(t){t.has("invalid")&&(this.invalid=!1),super.update(t)}}l([u({type:String})],ActionMenu.prototype,"selects",2),l([u({type:String,reflect:!0})],ActionMenu.prototype,"static",2);
|
|
26
30
|
//# sourceMappingURL=ActionMenu.js.map
|
package/src/ActionMenu.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ActionMenu.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 TemplateResult,\n} from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { PickerBase } from '@spectrum-web-components/picker';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport actionMenuStyles from './action-menu.css.js';\n\n/**\n * @element sp-action-menu\n *\n * @slot - menu items to be listed in the Action Menu\n * @slot icon - The icon to use for Action Menu\n * @slot label - The label to use on for the Action Menu\n * @slot tooltip - Tooltip to use on for the Action menu\n * @attr selects - By default `sp-action-menu` does not manage a selection. If\n * you'd like for a selection to be held by the `sp-menu` that it presents in\n * its overlay, use `selects=\"single\" to activate this functionality.\n */\nexport class ActionMenu extends ObserveSlotText(PickerBase, 'label') {\n public static override get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public override selects: undefined | 'single' = undefined;\n\n protected override listRole: 'listbox' | 'menu' = 'menu';\n protected override itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n <slot name=\"icon\" slot=\"icon\" ?icon-only=${!this.hasLabel}>\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"tooltip\"></slot>\n `,\n ];\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-action-button\n ?quiet=${this.quiet}\n ?selected=${this.open}\n aria-haspopup=\"true\"\n aria-controls=${ifDefined(this.open ? 'menu' : undefined)}\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${ifDefined(this.label || undefined)}\n id=\"button\"\n class=\"button\"\n size=${this.size}\n @blur=${this.
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OAAS,aAAAC,MAAiB,kDAC1B,OAAS,YAAAC,MAAgB,kDACzB,OAAS,cAAAC,MAAkB,kCAC3B,MAAO,6DACP,OAAS,mBAAAC,MAAuB,2DAChC,MAAO,gEACP,OAAOC,MAAsB,uBAatB,aAAM,mBAAmBD,EAAgBD,EAAY,OAAO,CAAE,CAA9D,kCAMH,KAAgB,QAAgC,
|
|
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 TemplateResult,\n} from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { PickerBase } from '@spectrum-web-components/picker';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport actionMenuStyles from './action-menu.css.js';\n\n/**\n * @element sp-action-menu\n *\n * @slot - menu items to be listed in the Action Menu\n * @slot icon - The icon to use for Action Menu\n * @slot label - The label to use on for the Action Menu\n * @slot tooltip - Tooltip to use on for the Action menu\n * @attr selects - By default `sp-action-menu` does not manage a selection. If\n * you'd like for a selection to be held by the `sp-menu` that it presents in\n * its overlay, use `selects=\"single\" to activate this functionality.\n */\nexport class ActionMenu extends ObserveSlotText(PickerBase, 'label') {\n public static override get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public override selects: undefined | 'single' = undefined;\n\n @property({ type: String, reflect: true })\n public static: 'white' | 'black' | undefined = undefined;\n\n protected override listRole: 'listbox' | 'menu' = 'menu';\n protected override itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n <slot name=\"icon\" slot=\"icon\" ?icon-only=${!this.hasLabel}>\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"tooltip\"></slot>\n `,\n ];\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-action-button\n ?quiet=${this.quiet}\n ?selected=${this.open}\n static=${ifDefined(this.static)}\n aria-haspopup=\"true\"\n aria-controls=${ifDefined(this.open ? 'menu' : undefined)}\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-label=${ifDefined(this.label || undefined)}\n id=\"button\"\n class=\"button\"\n size=${this.size}\n @blur=${this.handleButtonBlur}\n @pointerdown=${this.handleButtonPointerdown}\n @focus=${this.handleButtonFocus}\n @click=${this.handleButtonClick}\n @keydown=${{\n handleEvent: this.handleEnterKeydown,\n capture: true,\n }}\n ?disabled=${this.disabled}\n >\n ${this.buttonContent}\n </sp-action-button>\n ${this.renderMenu}\n `;\n }\n\n protected override update(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n super.update(changedProperties);\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OAAS,a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AAM,MAAO,CAAC,GALjB,WAMO,uBAGTK,EAAA,CADNL,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GARhC,WASF",
|
|
6
6
|
"names": ["html", "ifDefined", "property", "PickerBase", "ObserveSlotText", "actionMenuStyles", "changedProperties", "__decorateClass"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { css } from "@spectrum-web-components/base";
|
|
3
3
|
const styles = css`
|
|
4
|
-
:host{display:inline-flex}:host([quiet]){min-width:0}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{
|
|
4
|
+
:host{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none;width:auto}:host([dir=ltr]) .icon,:host([dir=ltr]) ::slotted([slot=icon]){margin-left:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))*-1)}:host([dir=rtl]) .icon,:host([dir=rtl]) ::slotted([slot=icon]){margin-right:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))*-1)}:host([dir]) slot[icon-only] .icon,:host([dir]) slot[icon-only]::slotted([slot=icon]){margin-inline-end:calc((var(
|
|
5
5
|
--custom-actionbutton-edge-to-text,
|
|
6
6
|
var(--spectrum-actionbutton-edge-to-text)
|
|
7
7
|
) - var(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\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{display:inline-flex}:host([quiet]){min-width:0}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\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{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none;width:auto}:host([dir=ltr]) .icon,:host([dir=ltr]) ::slotted([slot=icon]){margin-left:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))*-1)}:host([dir=rtl]) .icon,:host([dir=rtl]) ::slotted([slot=icon]){margin-right:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))*-1)}:host([dir]) slot[icon-only] .icon,:host([dir]) slot[icon-only]::slotted([slot=icon]){margin-inline-end:calc((var(\n--custom-actionbutton-edge-to-text,\nvar(--spectrum-actionbutton-edge-to-text)\n) - var(\n--custom-actionbutton-edge-to-visual-only,\nvar(--spectrum-actionbutton-edge-to-visual-only)\n))*-1);margin-inline-start:calc((var(\n--custom-actionbutton-edge-to-text,\nvar(--spectrum-actionbutton-edge-to-text)\n) - var(\n--custom-actionbutton-edge-to-visual-only,\nvar(--spectrum-actionbutton-edge-to-visual-only)\n))*-1)}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAef,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/action-menu.css.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";import{css as t}from"@spectrum-web-components/base";const o=t`
|
|
2
|
-
:host{display:inline-flex}:host([quiet]){min-width:0}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{
|
|
2
|
+
:host{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none;width:auto}:host([dir=ltr]) .icon,:host([dir=ltr]) ::slotted([slot=icon]){margin-left:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))*-1)}:host([dir=rtl]) .icon,:host([dir=rtl]) ::slotted([slot=icon]){margin-right:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))*-1)}:host([dir]) slot[icon-only] .icon,:host([dir]) slot[icon-only]::slotted([slot=icon]){margin-inline-end:calc((var(
|
|
3
3
|
--custom-actionbutton-edge-to-text,
|
|
4
4
|
var(--spectrum-actionbutton-edge-to-text)
|
|
5
5
|
) - var(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\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{display:inline-flex}:host([quiet]){min-width:0}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\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{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none;width:auto}:host([dir=ltr]) .icon,:host([dir=ltr]) ::slotted([slot=icon]){margin-left:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))*-1)}:host([dir=rtl]) .icon,:host([dir=rtl]) ::slotted([slot=icon]){margin-right:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted))*-1)}:host([dir]) slot[icon-only] .icon,:host([dir]) slot[icon-only]::slotted([slot=icon]){margin-inline-end:calc((var(\n--custom-actionbutton-edge-to-text,\nvar(--spectrum-actionbutton-edge-to-text)\n) - var(\n--custom-actionbutton-edge-to-visual-only,\nvar(--spectrum-actionbutton-edge-to-visual-only)\n))*-1);margin-inline-start:calc((var(\n--custom-actionbutton-edge-to-text,\nvar(--spectrum-actionbutton-edge-to-text)\n) - var(\n--custom-actionbutton-edge-to-visual-only,\nvar(--spectrum-actionbutton-edge-to-visual-only)\n))*-1)}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAef,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
4
|
import "@spectrum-web-components/menu/sp-menu.js";
|
|
4
5
|
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
5
6
|
import "@spectrum-web-components/menu/sp-menu-group.js";
|
|
6
7
|
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
8
|
+
import "@spectrum-web-components/tooltip/sp-tooltip.js";
|
|
7
9
|
import { ActionMenuMarkup } from "./";
|
|
10
|
+
import { makeOverBackground } from "../../button/stories/index.js";
|
|
8
11
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
9
12
|
export default {
|
|
10
13
|
component: "sp-action-menu",
|
|
@@ -94,6 +97,24 @@ export default {
|
|
|
94
97
|
control: {
|
|
95
98
|
type: "boolean"
|
|
96
99
|
}
|
|
100
|
+
},
|
|
101
|
+
staticValue: {
|
|
102
|
+
name: "static",
|
|
103
|
+
type: { name: "string", required: false },
|
|
104
|
+
description: "The visual static variant to apply to the button.",
|
|
105
|
+
table: {
|
|
106
|
+
type: { summary: "string" },
|
|
107
|
+
defaultValue: { summary: "none" }
|
|
108
|
+
},
|
|
109
|
+
control: {
|
|
110
|
+
type: "select",
|
|
111
|
+
labels: {
|
|
112
|
+
white: "white",
|
|
113
|
+
black: "black",
|
|
114
|
+
none: void 0
|
|
115
|
+
},
|
|
116
|
+
options: ["white", "black", "none"]
|
|
117
|
+
}
|
|
97
118
|
}
|
|
98
119
|
},
|
|
99
120
|
args: {
|
|
@@ -102,11 +123,22 @@ export default {
|
|
|
102
123
|
open: false,
|
|
103
124
|
quiet: false,
|
|
104
125
|
tooltipDescription: "",
|
|
105
|
-
tooltipPlacement: "bottom"
|
|
126
|
+
tooltipPlacement: "bottom",
|
|
127
|
+
static: void 0
|
|
106
128
|
}
|
|
107
129
|
};
|
|
108
130
|
const Template = (args = {}) => ActionMenuMarkup(args);
|
|
109
131
|
export const Default = (args = {}) => Template(args);
|
|
132
|
+
export const staticWhite = (args = {}) => Template(args);
|
|
133
|
+
staticWhite.args = {
|
|
134
|
+
staticValue: "white"
|
|
135
|
+
};
|
|
136
|
+
staticWhite.decorators = [makeOverBackground()];
|
|
137
|
+
export const staticBlack = (args = {}) => Template(args);
|
|
138
|
+
staticBlack.args = {
|
|
139
|
+
staticValue: "black"
|
|
140
|
+
};
|
|
141
|
+
staticBlack.decorators = [makeOverBackground()];
|
|
110
142
|
export const quiet = (args = {}) => Template(args);
|
|
111
143
|
quiet.args = {
|
|
112
144
|
quiet: true
|
|
@@ -189,7 +221,11 @@ export const controlled = () => {
|
|
|
189
221
|
</sp-menu-item>
|
|
190
222
|
<sp-menu-item>
|
|
191
223
|
Show
|
|
192
|
-
<sp-menu
|
|
224
|
+
<sp-menu
|
|
225
|
+
slot="submenu"
|
|
226
|
+
selects="multiple"
|
|
227
|
+
@change=${(event) => event.preventDefault()}
|
|
228
|
+
>
|
|
193
229
|
<sp-menu-item
|
|
194
230
|
value="grid"
|
|
195
231
|
?selected=${state.grid}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu.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*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-group.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport { ActionMenuMarkup } from './';\n\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport type { MenuItem } from '@spectrum-web-components/menu/src/MenuItem.js';\n\nexport default {\n component: 'sp-action-menu',\n title: 'Action menu',\n argTypes: {\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the menu is open or not.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: 'boolean',\n },\n visibleLabel: {\n name: 'Visible Label',\n description: 'The placeholder content for the picker.',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: 'text',\n },\n tooltipDescription: {\n name: 'Tooltip Description',\n type: { name: 'string', required: false },\n description: 'Tooltip description',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: {\n type: 'text',\n },\n },\n tooltipPlacement: {\n name: 'Tooltip Placement',\n type: { name: 'string', required: false },\n description: 'Tooltip Placement.',\n table: {\n defaultValue: { summary: 'bottom' },\n },\n control: {\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n type: 'select',\n },\n },\n quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\n description: 'Quiet rendering',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n },\n args: {\n visibleLabel: 'More Actions',\n disabled: false,\n open: false,\n quiet: false,\n tooltipDescription: '',\n tooltipPlacement: 'bottom',\n },\n};\n\ninterface StoryArgs {\n visibleLabel?: string;\n disabled?: boolean;\n open?: boolean;\n customIcon?: string | TemplateResult;\n selects?: 'single';\n selected?: boolean;\n quiet?: boolean;\n tooltipDescription?: string | 'none';\n tooltipPlacement?: string | 'none';\n}\n\nconst Template = (args: StoryArgs = {}): TemplateResult =>\n ActionMenuMarkup(args);\n\nexport const Default = (args: StoryArgs = {}): TemplateResult => Template(args);\n\nexport const quiet = (args: StoryArgs = {}): TemplateResult => Template(args);\nquiet.args = {\n quiet: true,\n};\n\nexport const selects = (args: StoryArgs = {}): TemplateResult =>\n Template({\n ...args,\n selects: 'single',\n selected: true,\n });\nselects.args = {\n open: true,\n};\n\nexport const iconOnly = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\niconOnly.args = {\n visibleLabel: '',\n};\n\nexport const tooltipDescriptionAndPlacement = (\n args: StoryArgs = {}\n): TemplateResult => Template(args);\ntooltipDescriptionAndPlacement.args = {\n tooltipDescription: 'Your tooltip string here',\n visibleLabel: '',\n tooltipPlacement: 'bottom',\n};\n\nexport const customIcon = (args: StoryArgs): TemplateResult => Template(args);\ncustomIcon.args = {\n customIcon: html`\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n `,\n visibleLabel: '',\n};\n\nexport const submenu = (): TemplateResult => {\n return html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item>Two</sp-menu-item>\n <sp-menu-item>\n Select some items\n <sp-menu slot=\"submenu\" selects=\"multiple\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected>B</sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `;\n};\n\nexport const controlled = (): TemplateResult => {\n const state = {\n snap: true,\n grid: false,\n guides: true,\n latestChange: '',\n };\n function toggle(prop: 'snap' | 'grid' | 'guides') {\n return (event: Event): void => {\n const item = event.target as MenuItem;\n state[prop] = !state[prop];\n // in Lit-based usage, this would be handled via render():\n // <sp-menu-item ?selected=${this.isSomethingSelected}>\n item.selected = state[prop];\n };\n }\n function onChange(event: Event): void {\n state.latestChange = (event.target as MenuItem).value;\n logState();\n }\n function logState(): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById(\n 'state-json'\n )!.textContent = `application state: ${JSON.stringify(state)}`;\n }\n return html`\n <sp-action-menu label=\"View\" @change=${onChange}>\n <sp-menu-item value=\"action\" @click=${() => alert('action')}>\n Non-selectable action\n </sp-menu-item>\n <sp-menu-item\n value=\"snap\"\n ?selected=${state.snap}\n @click=${toggle('snap')}\n >\n Snap\n </sp-menu-item>\n <sp-menu-item>\n Show\n <sp-menu slot=\"submenu\">\n <sp-menu-item\n value=\"grid\"\n ?selected=${state.grid}\n @click=${toggle('grid')}\n >\n Grid\n </sp-menu-item>\n <sp-menu-item\n value=\"guides\"\n ?selected=${state.guides}\n @click=${toggle('guides')}\n >\n Guides\n </sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n <span id=\"state-json\"></span>\n `;\n};\n\nexport const groups = (): TemplateResult => html`\n <sp-action-menu open>\n <sp-menu-group id=\"cms\">\n <span slot=\"header\">cms</span>\n <sp-menu-item value=\"updateAllSiteContent\">\n Update All Content\n </sp-menu-item>\n <sp-menu-item value=\"refreshAllXDs\">Refresh All XDs</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"ssg\">\n <span slot=\"header\">ssg</span>\n <sp-menu-item value=\"clearCache\">Clear Cache</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"vrt\">\n <span slot=\"header\">vrt</span>\n <sp-menu-item value=\"vrt-contributions\">Contributions</sp-menu-item>\n <sp-menu-item value=\"vrt-internal\">Internal</sp-menu-item>\n <sp-menu-item value=\"vrt-public\">Public</sp-menu-item>\n <sp-menu-item value=\"vrt-patterns\">Patterns</sp-menu-item>\n <sp-menu-item value=\"vrt\">All</sp-menu-item>\n </sp-menu-group>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-group id=\"misc\">\n <sp-menu-item value=\"logout\">Logout</sp-menu-item>\n </sp-menu-group>\n </sp-action-menu>\n`;\n"],
|
|
5
|
-
"mappings": ";AAWA,SAAS,YAA4B;AAErC,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,wBAAwB;
|
|
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*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.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-group.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { ActionMenuMarkup } from './';\nimport { makeOverBackground } from '../../button/stories/index.js';\n\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport type { MenuItem } from '@spectrum-web-components/menu/src/MenuItem.js';\n\nexport default {\n component: 'sp-action-menu',\n title: 'Action menu',\n argTypes: {\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the menu is open or not.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: 'boolean',\n },\n visibleLabel: {\n name: 'Visible Label',\n description: 'The placeholder content for the picker.',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: 'text',\n },\n tooltipDescription: {\n name: 'Tooltip Description',\n type: { name: 'string', required: false },\n description: 'Tooltip description',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: {\n type: 'text',\n },\n },\n tooltipPlacement: {\n name: 'Tooltip Placement',\n type: { name: 'string', required: false },\n description: 'Tooltip Placement.',\n table: {\n defaultValue: { summary: 'bottom' },\n },\n control: {\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n type: 'select',\n },\n },\n quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\n description: 'Quiet rendering',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n staticValue: {\n name: 'static',\n type: { name: 'string', required: false },\n description: 'The visual static variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'none' },\n },\n control: {\n type: 'select',\n labels: {\n white: 'white',\n black: 'black',\n none: undefined,\n },\n options: ['white', 'black', 'none'],\n },\n },\n },\n args: {\n visibleLabel: 'More Actions',\n disabled: false,\n open: false,\n quiet: false,\n tooltipDescription: '',\n tooltipPlacement: 'bottom',\n static: undefined,\n },\n};\n\ninterface StoryArgs {\n visibleLabel?: string;\n disabled?: boolean;\n open?: boolean;\n customIcon?: string | TemplateResult;\n selects?: 'single';\n selected?: boolean;\n quiet?: boolean;\n staticValue?: 'white' | 'black' | undefined;\n tooltipDescription?: string | 'none';\n tooltipPlacement?: string | 'none';\n}\n\nconst Template = (args: StoryArgs = {}): TemplateResult =>\n ActionMenuMarkup(args);\n\nexport const Default = (args: StoryArgs = {}): TemplateResult => Template(args);\n\nexport const staticWhite = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticWhite.args = {\n staticValue: 'white',\n};\nstaticWhite.decorators = [makeOverBackground()];\nexport const staticBlack = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticBlack.args = {\n staticValue: 'black',\n};\nstaticBlack.decorators = [makeOverBackground()];\nexport const quiet = (args: StoryArgs = {}): TemplateResult => Template(args);\nquiet.args = {\n quiet: true,\n};\n\nexport const selects = (args: StoryArgs = {}): TemplateResult =>\n Template({\n ...args,\n selects: 'single',\n selected: true,\n });\nselects.args = {\n open: true,\n};\n\nexport const iconOnly = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\niconOnly.args = {\n visibleLabel: '',\n};\n\nexport const tooltipDescriptionAndPlacement = (\n args: StoryArgs = {}\n): TemplateResult => Template(args);\ntooltipDescriptionAndPlacement.args = {\n tooltipDescription: 'Your tooltip string here',\n visibleLabel: '',\n tooltipPlacement: 'bottom',\n};\n\nexport const customIcon = (args: StoryArgs): TemplateResult => Template(args);\ncustomIcon.args = {\n customIcon: html`\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n `,\n visibleLabel: '',\n};\n\nexport const submenu = (): TemplateResult => {\n return html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item>Two</sp-menu-item>\n <sp-menu-item>\n Select some items\n <sp-menu slot=\"submenu\" selects=\"multiple\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected>B</sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `;\n};\n\nexport const controlled = (): TemplateResult => {\n const state = {\n snap: true,\n grid: false,\n guides: true,\n latestChange: '',\n };\n function toggle(prop: 'snap' | 'grid' | 'guides') {\n return (event: Event): void => {\n const item = event.target as MenuItem;\n state[prop] = !state[prop];\n // in Lit-based usage, this would be handled via render():\n // <sp-menu-item ?selected=${this.isSomethingSelected}>\n item.selected = state[prop];\n };\n }\n function onChange(event: Event): void {\n state.latestChange = (event.target as MenuItem).value;\n logState();\n }\n function logState(): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById(\n 'state-json'\n )!.textContent = `application state: ${JSON.stringify(state)}`;\n }\n return html`\n <sp-action-menu label=\"View\" @change=${onChange}>\n <sp-menu-item value=\"action\" @click=${() => alert('action')}>\n Non-selectable action\n </sp-menu-item>\n <sp-menu-item\n value=\"snap\"\n ?selected=${state.snap}\n @click=${toggle('snap')}\n >\n Snap\n </sp-menu-item>\n <sp-menu-item>\n Show\n <sp-menu\n slot=\"submenu\"\n selects=\"multiple\"\n @change=${(event: Event) => event.preventDefault()}\n >\n <sp-menu-item\n value=\"grid\"\n ?selected=${state.grid}\n @click=${toggle('grid')}\n >\n Grid\n </sp-menu-item>\n <sp-menu-item\n value=\"guides\"\n ?selected=${state.guides}\n @click=${toggle('guides')}\n >\n Guides\n </sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n <span id=\"state-json\"></span>\n `;\n};\n\nexport const groups = (): TemplateResult => html`\n <sp-action-menu open>\n <sp-menu-group id=\"cms\">\n <span slot=\"header\">cms</span>\n <sp-menu-item value=\"updateAllSiteContent\">\n Update All Content\n </sp-menu-item>\n <sp-menu-item value=\"refreshAllXDs\">Refresh All XDs</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"ssg\">\n <span slot=\"header\">ssg</span>\n <sp-menu-item value=\"clearCache\">Clear Cache</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"vrt\">\n <span slot=\"header\">vrt</span>\n <sp-menu-item value=\"vrt-contributions\">Contributions</sp-menu-item>\n <sp-menu-item value=\"vrt-internal\">Internal</sp-menu-item>\n <sp-menu-item value=\"vrt-public\">Public</sp-menu-item>\n <sp-menu-item value=\"vrt-patterns\">Patterns</sp-menu-item>\n <sp-menu-item value=\"vrt\">All</sp-menu-item>\n </sp-menu-group>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-group id=\"misc\">\n <sp-menu-item value=\"logout\">Logout</sp-menu-item>\n </sp-menu-group>\n </sp-action-menu>\n`;\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAA4B;AAErC,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAEnC,OAAO;AAGP,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,IACN,UAAU;AAAA,MACN,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,MACzC,aACI;AAAA,MACJ,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,IACA,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,IACb;AAAA,IACA,cAAc;AAAA,MACV,MAAM;AAAA,MACN,aAAa;AAAA,MACb,MAAM,EAAE,MAAM,UAAU,UAAU,MAAM;AAAA,MACxC,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,SAAS;AAAA,QAC1B,cAAc,EAAE,SAAS,GAA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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/stories/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
3
|
+
import { html, nothing } from "@spectrum-web-components/base";
|
|
3
4
|
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
4
5
|
import "@spectrum-web-components/icon/sp-icon.js";
|
|
5
6
|
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
@@ -11,6 +12,7 @@ export const ActionMenuMarkup = ({
|
|
|
11
12
|
disabled = false,
|
|
12
13
|
open = false,
|
|
13
14
|
quiet = false,
|
|
15
|
+
staticValue = "",
|
|
14
16
|
visibleLabel = "",
|
|
15
17
|
customIcon = "",
|
|
16
18
|
size = "m",
|
|
@@ -25,15 +27,18 @@ export const ActionMenuMarkup = ({
|
|
|
25
27
|
?disabled=${disabled}
|
|
26
28
|
?open=${open}
|
|
27
29
|
?quiet=${quiet}
|
|
30
|
+
static=${ifDefined(
|
|
31
|
+
staticValue === "none" ? void 0 : staticValue
|
|
32
|
+
)}
|
|
28
33
|
size=${size}
|
|
29
34
|
@change="${changeHandler}"
|
|
30
35
|
.selects=${selects ? selects : void 0}
|
|
31
36
|
value=${selected ? "Select Inverse" : ""}
|
|
32
37
|
>
|
|
33
|
-
${customIcon ? customIcon :
|
|
38
|
+
${customIcon ? customIcon : nothing}
|
|
34
39
|
${visibleLabel ? html`
|
|
35
40
|
<span slot="label">${visibleLabel}</span>
|
|
36
|
-
` :
|
|
41
|
+
` : nothing}
|
|
37
42
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
38
43
|
<sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>
|
|
39
44
|
<sp-menu-item>Feather...</sp-menu-item>
|
package/stories/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\n\nexport const ActionMenuMarkup = ({\n ariaLabel = 'More Actions',\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = false,\n quiet = false,\n visibleLabel = '',\n customIcon = '' as string | TemplateResult,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n tooltipDescription = '',\n tooltipPlacement = 'bottom',\n} = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=${ariaLabel}\n ?disabled=${disabled}\n ?open=${open}\n ?quiet=${quiet}\n size=${size}\n @change=\"${changeHandler}\"\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n >\n ${customIcon ? customIcon :
|
|
5
|
-
"mappings": ";
|
|
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 { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { html, nothing, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\n\nexport const ActionMenuMarkup = ({\n ariaLabel = 'More Actions',\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = false,\n quiet = false,\n staticValue = '',\n visibleLabel = '',\n customIcon = '' as string | TemplateResult,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n tooltipDescription = '',\n tooltipPlacement = 'bottom',\n} = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=${ariaLabel}\n ?disabled=${disabled}\n ?open=${open}\n ?quiet=${quiet}\n static=${ifDefined(\n staticValue === 'none' ? undefined : staticValue\n )}\n size=${size}\n @change=\"${changeHandler}\"\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n >\n ${customIcon ? customIcon : nothing}\n ${visibleLabel\n ? html`\n <span slot=\"label\">${visibleLabel}</span>\n `\n : nothing}\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item ?selected=${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 ${tooltipDescription\n ? html`\n <sp-tooltip\n slot=\"tooltip\"\n self-managed\n placement=${tooltipPlacement}\n >\n ${tooltipDescription}\n </sp-tooltip>\n `\n : html``}\n </sp-action-menu>\n `;\n};\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,iBAAiB;AAC1B,SAAS,MAAM,eAA+B;AAE9C,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEA,aAAM,mBAAmB,CAAC;AAAA,EAC7B,YAAY;AAAA,EACZ,gBAAiB,MAAM;AAAA,EACvB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,mBAAmB;AACvB,IAAI,CAAC,MAAsB;AACvB,SAAO;AAAA;AAAA,oBAES,SAAS;AAAA,wBACL,QAAQ;AAAA,oBACZ,IAAI;AAAA,qBACH,KAAK;AAAA,qBACL;AAAA,IACL,gBAAgB,SAAS,SAAY;AAAA,EACzC,CAAC;AAAA,mBACM,IAAI;AAAA,uBACA,aAAa;AAAA,uBACb,UAAU,UAAU,MAAS;AAAA,oBAChC,WAAW,mBAAmB,EAAE;AAAA;AAAA,cAEtC,aAAa,aAAa,OAAO;AAAA,cACjC,eACI;AAAA,2CACyB,YAAY;AAAA,sBAErC,OAAO;AAAA;AAAA,sCAEa,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAMhC,qBACI;AAAA;AAAA;AAAA;AAAA,sCAIoB,gBAAgB;AAAA;AAAA,4BAE1B,kBAAkB;AAAA;AAAA,sBAG5B,MAAM;AAAA;AAAA;AAGxB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/index.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import {
|
|
3
|
+
aTimeout,
|
|
3
4
|
elementUpdated,
|
|
4
5
|
expect,
|
|
5
6
|
fixture,
|
|
6
7
|
html,
|
|
8
|
+
nextFrame,
|
|
7
9
|
oneEvent
|
|
8
10
|
} from "@open-wc/testing";
|
|
9
11
|
import { testForLitDevWarnings } from "../../../test/testing-helpers";
|
|
10
12
|
import { spy } from "sinon";
|
|
11
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
ignoreResizeObserverLoopError,
|
|
15
|
+
fixture as styledFixture
|
|
16
|
+
} from "../../../test/testing-helpers.js";
|
|
17
|
+
import "@spectrum-web-components/dialog/sp-dialog-base.js";
|
|
18
|
+
import { tooltipDescriptionAndPlacement } from "../stories/action-menu.stories";
|
|
19
|
+
import { sendMouse } from "../../../test/plugins/browser.js";
|
|
12
20
|
ignoreResizeObserverLoopError(before, after);
|
|
13
21
|
const deprecatedActionMenuFixture = async () => await fixture(
|
|
14
22
|
html`
|
|
@@ -83,6 +91,8 @@ export const testActionMenu = (mode) => {
|
|
|
83
91
|
`
|
|
84
92
|
);
|
|
85
93
|
await elementUpdated(el);
|
|
94
|
+
await nextFrame();
|
|
95
|
+
await nextFrame();
|
|
86
96
|
await expect(el).to.be.accessible();
|
|
87
97
|
});
|
|
88
98
|
it("loads - [custom icon]", async () => {
|
|
@@ -101,6 +111,8 @@ export const testActionMenu = (mode) => {
|
|
|
101
111
|
`
|
|
102
112
|
);
|
|
103
113
|
await elementUpdated(el);
|
|
114
|
+
await nextFrame();
|
|
115
|
+
await nextFrame();
|
|
104
116
|
await expect(el).to.be.accessible();
|
|
105
117
|
});
|
|
106
118
|
it("dispatches change events, no [href]", async () => {
|
|
@@ -109,7 +121,11 @@ export const testActionMenu = (mode) => {
|
|
|
109
121
|
html`
|
|
110
122
|
<sp-action-menu
|
|
111
123
|
label="More Actions"
|
|
112
|
-
@change=${(
|
|
124
|
+
@change=${({
|
|
125
|
+
target: { value }
|
|
126
|
+
}) => {
|
|
127
|
+
changeSpy(value);
|
|
128
|
+
}}
|
|
113
129
|
>
|
|
114
130
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
115
131
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -129,15 +145,15 @@ export const testActionMenu = (mode) => {
|
|
|
129
145
|
);
|
|
130
146
|
const opened = oneEvent(el, "sp-opened");
|
|
131
147
|
el.click();
|
|
132
|
-
await opened;
|
|
133
148
|
await elementUpdated(el);
|
|
149
|
+
await opened;
|
|
134
150
|
expect(el.open).to.be.true;
|
|
135
151
|
const closed = oneEvent(el, "sp-closed");
|
|
136
152
|
menuItem2.click();
|
|
137
153
|
await closed;
|
|
138
|
-
await elementUpdated(el);
|
|
139
154
|
expect(el.open).to.be.false;
|
|
140
155
|
expect(changeSpy.callCount).to.equal(1);
|
|
156
|
+
expect(changeSpy.calledWith("Deselect")).to.be.true;
|
|
141
157
|
});
|
|
142
158
|
it("closes when Menu Item has [href]", async () => {
|
|
143
159
|
const changeSpy = spy();
|
|
@@ -145,7 +161,9 @@ export const testActionMenu = (mode) => {
|
|
|
145
161
|
html`
|
|
146
162
|
<sp-action-menu
|
|
147
163
|
label="More Actions"
|
|
148
|
-
@change=${() =>
|
|
164
|
+
@change=${() => {
|
|
165
|
+
changeSpy();
|
|
166
|
+
}}
|
|
149
167
|
>
|
|
150
168
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
151
169
|
<sp-menu-item href="#">Deselect</sp-menu-item>
|
|
@@ -168,26 +186,32 @@ export const testActionMenu = (mode) => {
|
|
|
168
186
|
const opened = oneEvent(el, "sp-opened");
|
|
169
187
|
el.click();
|
|
170
188
|
await opened;
|
|
171
|
-
await elementUpdated(el);
|
|
172
189
|
expect(el.open).to.be.true;
|
|
173
190
|
const closed = oneEvent(el, "sp-closed");
|
|
174
191
|
menuItem2.click();
|
|
175
192
|
await closed;
|
|
176
|
-
await elementUpdated(el);
|
|
177
193
|
expect(el.open).to.be.false;
|
|
178
194
|
expect(changeSpy.callCount).to.equal(0);
|
|
179
195
|
});
|
|
180
196
|
it("can be `quiet`", async () => {
|
|
181
197
|
const el = await actionMenuFixture();
|
|
182
|
-
await elementUpdated(el);
|
|
183
198
|
expect(el.quiet).to.be.false;
|
|
184
199
|
el.quiet = true;
|
|
185
200
|
await elementUpdated(el);
|
|
186
201
|
expect(el.quiet).to.be.true;
|
|
187
202
|
});
|
|
188
|
-
it("
|
|
203
|
+
it("can be `static`", async () => {
|
|
189
204
|
const el = await actionMenuFixture();
|
|
205
|
+
expect(el.static == void 0).to.be.true;
|
|
206
|
+
el.static = "black";
|
|
207
|
+
await elementUpdated(el);
|
|
208
|
+
expect(el.static == "black").to.be.true;
|
|
209
|
+
el.static = "white";
|
|
190
210
|
await elementUpdated(el);
|
|
211
|
+
expect(el.static == "white").to.be.true;
|
|
212
|
+
});
|
|
213
|
+
it("stay `valid`", async () => {
|
|
214
|
+
const el = await actionMenuFixture();
|
|
191
215
|
expect(el.invalid).to.be.false;
|
|
192
216
|
el.invalid = true;
|
|
193
217
|
await elementUpdated(el);
|
|
@@ -195,14 +219,12 @@ export const testActionMenu = (mode) => {
|
|
|
195
219
|
});
|
|
196
220
|
it("focus()", async () => {
|
|
197
221
|
const el = await actionMenuFixture();
|
|
198
|
-
await elementUpdated(el);
|
|
199
222
|
el.focus();
|
|
200
223
|
expect(document.activeElement).to.equal(el);
|
|
201
224
|
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
202
225
|
const opened = oneEvent(el, "sp-opened");
|
|
203
226
|
el.open = true;
|
|
204
227
|
await opened;
|
|
205
|
-
expect(document.activeElement).to.not.equal(el);
|
|
206
228
|
const closed = oneEvent(el, "sp-closed");
|
|
207
229
|
el.open = false;
|
|
208
230
|
await closed;
|
|
@@ -211,7 +233,6 @@ export const testActionMenu = (mode) => {
|
|
|
211
233
|
});
|
|
212
234
|
it("opens unmeasured", async () => {
|
|
213
235
|
const el = await actionMenuFixture();
|
|
214
|
-
await elementUpdated(el);
|
|
215
236
|
const button = el.button;
|
|
216
237
|
button.click();
|
|
217
238
|
await elementUpdated(el);
|
|
@@ -222,7 +243,6 @@ export const testActionMenu = (mode) => {
|
|
|
222
243
|
});
|
|
223
244
|
it("opens unmeasured with deprecated syntax", async () => {
|
|
224
245
|
const el = await deprecatedActionMenuFixture();
|
|
225
|
-
await elementUpdated(el);
|
|
226
246
|
const button = el.button;
|
|
227
247
|
button.click();
|
|
228
248
|
await elementUpdated(el);
|
|
@@ -235,41 +255,30 @@ export const testActionMenu = (mode) => {
|
|
|
235
255
|
expect(button).to.have.attribute("aria-haspopup", "true");
|
|
236
256
|
expect(button).to.have.attribute("aria-expanded", "false");
|
|
237
257
|
expect(button).not.to.have.attribute("aria-controls");
|
|
238
|
-
let items = el.querySelectorAll("sp-menu-item");
|
|
239
|
-
const count = items.length;
|
|
240
|
-
expect(items.length).to.equal(count);
|
|
241
258
|
let opened = oneEvent(el, "sp-opened");
|
|
242
259
|
el.open = true;
|
|
243
260
|
await opened;
|
|
244
261
|
expect(el.open).to.be.true;
|
|
245
262
|
expect(button).to.have.attribute("aria-expanded", "true");
|
|
246
263
|
expect(button).to.have.attribute("aria-controls", "menu");
|
|
247
|
-
items = el.querySelectorAll("sp-menu-item");
|
|
248
|
-
expect(items.length).to.equal(0);
|
|
249
264
|
let closed = oneEvent(el, "sp-closed");
|
|
250
265
|
el.open = false;
|
|
251
266
|
await closed;
|
|
252
267
|
expect(el.open).to.be.false;
|
|
253
268
|
expect(button).to.have.attribute("aria-expanded", "false");
|
|
254
269
|
expect(button).not.to.have.attribute("aria-controls");
|
|
255
|
-
items = el.querySelectorAll("sp-menu-item");
|
|
256
|
-
expect(items.length).to.equal(count);
|
|
257
270
|
opened = oneEvent(el, "sp-opened");
|
|
258
271
|
el.open = true;
|
|
259
272
|
await opened;
|
|
260
273
|
expect(el.open).to.be.true;
|
|
261
274
|
expect(button).to.have.attribute("aria-expanded", "true");
|
|
262
275
|
expect(button).to.have.attribute("aria-controls", "menu");
|
|
263
|
-
items = el.querySelectorAll("sp-menu-item");
|
|
264
|
-
expect(items.length).to.equal(0);
|
|
265
276
|
closed = oneEvent(el, "sp-closed");
|
|
266
277
|
el.open = false;
|
|
267
278
|
await closed;
|
|
268
279
|
expect(el.open).to.be.false;
|
|
269
280
|
expect(button).to.have.attribute("aria-expanded", "false");
|
|
270
281
|
expect(button).not.to.have.attribute("aria-controls");
|
|
271
|
-
items = el.querySelectorAll("sp-menu-item");
|
|
272
|
-
expect(items.length).to.equal(count);
|
|
273
282
|
});
|
|
274
283
|
it("allows submenu items to be selected", async () => {
|
|
275
284
|
const root = await actionSubmenuFixture();
|
|
@@ -290,8 +299,6 @@ export const testActionMenu = (mode) => {
|
|
|
290
299
|
new PointerEvent("pointerenter", { bubbles: true })
|
|
291
300
|
);
|
|
292
301
|
await opened;
|
|
293
|
-
const overlays = document.querySelectorAll("active-overlay");
|
|
294
|
-
expect(overlays.length).to.equal(2);
|
|
295
302
|
await elementUpdated(submenu);
|
|
296
303
|
expect(
|
|
297
304
|
selectedItem.selected,
|
|
@@ -299,7 +306,24 @@ export const testActionMenu = (mode) => {
|
|
|
299
306
|
).to.be.true;
|
|
300
307
|
});
|
|
301
308
|
it("allows top-level selection state to change", async () => {
|
|
302
|
-
const root = await
|
|
309
|
+
const root = await styledFixture(html`
|
|
310
|
+
<sp-action-menu label="More Actions">
|
|
311
|
+
<sp-menu-item>One</sp-menu-item>
|
|
312
|
+
<sp-menu-item selected id="root-selected-item">
|
|
313
|
+
Two
|
|
314
|
+
</sp-menu-item>
|
|
315
|
+
<sp-menu-item id="item-with-submenu">
|
|
316
|
+
B should be selected
|
|
317
|
+
<sp-menu slot="submenu">
|
|
318
|
+
<sp-menu-item>A</sp-menu-item>
|
|
319
|
+
<sp-menu-item selected id="sub-selected-item">
|
|
320
|
+
B
|
|
321
|
+
</sp-menu-item>
|
|
322
|
+
<sp-menu-item>C</sp-menu-item>
|
|
323
|
+
</sp-menu>
|
|
324
|
+
</sp-menu-item>
|
|
325
|
+
</sp-action-menu>
|
|
326
|
+
`);
|
|
303
327
|
const unselectedItem = root.querySelector(
|
|
304
328
|
"sp-menu-item"
|
|
305
329
|
);
|
|
@@ -321,6 +345,7 @@ export const testActionMenu = (mode) => {
|
|
|
321
345
|
let closed = oneEvent(root, "sp-closed");
|
|
322
346
|
selectedItem.click();
|
|
323
347
|
await closed;
|
|
348
|
+
expect(root.open).to.be.false;
|
|
324
349
|
opened = oneEvent(root, "sp-opened");
|
|
325
350
|
root.click();
|
|
326
351
|
await opened;
|
|
@@ -345,6 +370,128 @@ export const testActionMenu = (mode) => {
|
|
|
345
370
|
expect(selectedItem.textContent).to.include("Two");
|
|
346
371
|
expect(selectedItem.selected).to.be.true;
|
|
347
372
|
});
|
|
373
|
+
it("shows tooltip", async () => {
|
|
374
|
+
const openSpy = spy();
|
|
375
|
+
const el = await styledFixture(
|
|
376
|
+
tooltipDescriptionAndPlacement(
|
|
377
|
+
tooltipDescriptionAndPlacement.args
|
|
378
|
+
)
|
|
379
|
+
);
|
|
380
|
+
const tooltip = el.querySelector("sp-tooltip");
|
|
381
|
+
const rect = el.getBoundingClientRect();
|
|
382
|
+
tooltip.addEventListener("sp-opened", () => openSpy());
|
|
383
|
+
await elementUpdated(tooltip);
|
|
384
|
+
await nextFrame();
|
|
385
|
+
await nextFrame();
|
|
386
|
+
const overlay = tooltip.shadowRoot.querySelector(
|
|
387
|
+
"sp-overlay"
|
|
388
|
+
);
|
|
389
|
+
await elementUpdated(overlay);
|
|
390
|
+
expect(overlay.triggerElement === el.button).to.be.true;
|
|
391
|
+
let open = oneEvent(tooltip, "sp-opened");
|
|
392
|
+
sendMouse({
|
|
393
|
+
steps: [
|
|
394
|
+
{
|
|
395
|
+
position: [
|
|
396
|
+
rect.left + rect.width / 2,
|
|
397
|
+
rect.top + rect.height / 2
|
|
398
|
+
],
|
|
399
|
+
type: "move"
|
|
400
|
+
}
|
|
401
|
+
]
|
|
402
|
+
});
|
|
403
|
+
await open;
|
|
404
|
+
expect(tooltip.open).to.be.true;
|
|
405
|
+
let close = oneEvent(tooltip, "sp-closed");
|
|
406
|
+
el.click();
|
|
407
|
+
await close;
|
|
408
|
+
expect(tooltip.open).to.be.false;
|
|
409
|
+
expect(el.open).to.be.true;
|
|
410
|
+
open = oneEvent(tooltip, "sp-opened");
|
|
411
|
+
sendMouse({
|
|
412
|
+
steps: [
|
|
413
|
+
{
|
|
414
|
+
position: [
|
|
415
|
+
rect.left + rect.width * 2,
|
|
416
|
+
rect.top + rect.height / 2
|
|
417
|
+
],
|
|
418
|
+
type: "move"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
position: [
|
|
422
|
+
rect.left + rect.width / 2,
|
|
423
|
+
rect.top + rect.height / 2
|
|
424
|
+
],
|
|
425
|
+
type: "move"
|
|
426
|
+
}
|
|
427
|
+
]
|
|
428
|
+
});
|
|
429
|
+
await open;
|
|
430
|
+
close = oneEvent(tooltip, "sp-closed");
|
|
431
|
+
sendMouse({
|
|
432
|
+
steps: [
|
|
433
|
+
{
|
|
434
|
+
position: [
|
|
435
|
+
rect.left + rect.width * 2,
|
|
436
|
+
rect.top + rect.height / 2
|
|
437
|
+
],
|
|
438
|
+
type: "move"
|
|
439
|
+
}
|
|
440
|
+
]
|
|
441
|
+
});
|
|
442
|
+
await close;
|
|
443
|
+
const menu = el.optionsMenu;
|
|
444
|
+
const menuRect = menu.getBoundingClientRect();
|
|
445
|
+
await sendMouse({
|
|
446
|
+
steps: [
|
|
447
|
+
{
|
|
448
|
+
position: [
|
|
449
|
+
menuRect.left + menuRect.width / 2,
|
|
450
|
+
menuRect.top + menuRect.height / 2
|
|
451
|
+
],
|
|
452
|
+
type: "move"
|
|
453
|
+
}
|
|
454
|
+
]
|
|
455
|
+
});
|
|
456
|
+
await aTimeout(150);
|
|
457
|
+
expect(openSpy.callCount).to.equal(2);
|
|
458
|
+
});
|
|
459
|
+
it("opens, then closes, on subsequent clicks", async () => {
|
|
460
|
+
const el = await actionMenuFixture();
|
|
461
|
+
const rect = el.getBoundingClientRect();
|
|
462
|
+
const open = oneEvent(el, "sp-opened");
|
|
463
|
+
sendMouse({
|
|
464
|
+
steps: [
|
|
465
|
+
{
|
|
466
|
+
position: [
|
|
467
|
+
rect.left + rect.width / 2,
|
|
468
|
+
rect.top + rect.height / 2
|
|
469
|
+
],
|
|
470
|
+
type: "click"
|
|
471
|
+
}
|
|
472
|
+
]
|
|
473
|
+
});
|
|
474
|
+
await open;
|
|
475
|
+
expect(el.open).to.be.true;
|
|
476
|
+
await aTimeout(50);
|
|
477
|
+
expect(el.open).to.be.true;
|
|
478
|
+
const close = oneEvent(el, "sp-closed");
|
|
479
|
+
sendMouse({
|
|
480
|
+
steps: [
|
|
481
|
+
{
|
|
482
|
+
position: [
|
|
483
|
+
rect.left + rect.width / 2,
|
|
484
|
+
rect.top + rect.height / 2
|
|
485
|
+
],
|
|
486
|
+
type: "click"
|
|
487
|
+
}
|
|
488
|
+
]
|
|
489
|
+
});
|
|
490
|
+
await close;
|
|
491
|
+
expect(el.open).to.be.false;
|
|
492
|
+
await aTimeout(50);
|
|
493
|
+
expect(el.open).to.be.false;
|
|
494
|
+
});
|
|
348
495
|
});
|
|
349
496
|
};
|
|
350
497
|
//# sourceMappingURL=index.js.map
|
package/test/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n oneEvent,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers';\n\nimport { spy } from 'sinon';\n\nimport type { ActionMenu } from '@spectrum-web-components/action-menu';\nimport type { Menu, MenuItem } from '@spectrum-web-components/menu';\nimport { ignoreResizeObserverLoopError } from '../../../test/testing-helpers.js';\n\nignoreResizeObserverLoopError(before, after);\n\nconst deprecatedActionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\nconst actionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\nconst actionSubmenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `\n );\n\nexport const testActionMenu = (mode: 'sync' | 'async'): void => {\n describe(`Action menu: ${mode}`, () => {\n testForLitDevWarnings(async () => await actionMenuFixture());\n it('loads', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [slot=\"label\"]', async () => {\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu>\n <span slot=\"label\">More Actions</span>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [custom icon]', async () => {\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('dispatches change events, no [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${() => changeSpy()}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await opened;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n await elementUpdated(el);\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(1);\n });\n it('closes when Menu Item has [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${() => changeSpy()}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item href=\"#\">Deselect</sp-menu-item>\n <sp-menu-item href=\"#\">Select Inverse</sp-menu-item>\n <sp-menu-item href=\"#\">Feather...</sp-menu-item>\n <sp-menu-item href=\"#\">Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item href=\"#\">Save Selection</sp-menu-item>\n <sp-menu-item href=\"#\" disabled>\n Make Work Path\n </sp-menu-item>\n </sp-action-menu>\n `\n );\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await opened;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n await elementUpdated(el);\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(0);\n });\n it('can be `quiet`', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el.quiet).to.be.false;\n\n el.quiet = true;\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n });\n it('stay `valid`', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n\n el.invalid = true;\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n });\n it('focus()', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n el.focus();\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(document.activeElement).to.not.equal(el);\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n });\n it('opens unmeasured', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n const button = el.button as HTMLButtonElement;\n\n button.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n });\n it('opens unmeasured with deprecated syntax', async () => {\n const el = await deprecatedActionMenuFixture();\n\n await elementUpdated(el);\n const button = el.button as HTMLButtonElement;\n\n button.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('toggles open/close multiple time', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n let items = el.querySelectorAll('sp-menu-item');\n const count = items.length;\n expect(items.length).to.equal(count);\n\n let opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(0);\n\n let closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(count);\n\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(0);\n\n closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(count);\n });\n it('allows submenu items to be selected', async () => {\n const root = await actionSubmenuFixture();\n const menuItem = root.querySelector('#item-with-submenu') as Menu;\n const submenu = menuItem.querySelector(\n 'sp-menu[slot=\"submenu\"]'\n ) as Menu;\n const selectedItem = submenu.querySelector(\n '#sub-selected-item'\n ) as MenuItem;\n\n expect(selectedItem.selected, 'item should be initially selected')\n .to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n expect(root.open).to.be.true;\n\n opened = oneEvent(menuItem, 'sp-opened');\n menuItem.dispatchEvent(\n new PointerEvent('pointerenter', { bubbles: true })\n );\n await opened;\n const overlays = document.querySelectorAll('active-overlay');\n expect(overlays.length).to.equal(2);\n\n await elementUpdated(submenu);\n expect(\n selectedItem.selected,\n 'initially selected item should maintain selection'\n ).to.be.true;\n });\n it('allows top-level selection state to change', async () => {\n const root = await actionSubmenuFixture();\n const unselectedItem = root.querySelector(\n 'sp-menu-item'\n ) as MenuItem;\n const selectedItem = root.querySelector(\n '#root-selected-item'\n ) as MenuItem;\n let selected = true;\n\n selectedItem.addEventListener('click', () => {\n selected = !selected;\n selectedItem.selected = selected;\n });\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n let closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking unselected\n // (no event listener: should remain selected = false)\n closed = oneEvent(root, 'sp-closed');\n unselectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.false;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n });\n });\n};\n"],
|
|
5
|
-
"mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,6BAA6B;AAEtC,SAAS,WAAW;AAIpB,SAAS,
|
|
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 aTimeout,\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers';\n\nimport { spy } from 'sinon';\n\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport type { Menu, MenuItem } from '@spectrum-web-components/menu';\nimport {\n ignoreResizeObserverLoopError,\n fixture as styledFixture,\n} from '../../../test/testing-helpers.js';\nimport '@spectrum-web-components/dialog/sp-dialog-base.js';\nimport { tooltipDescriptionAndPlacement } from '../stories/action-menu.stories';\nimport type { Tooltip } from '@spectrum-web-components/tooltip';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport type { TestablePicker } from '../../picker/test/index.js';\nimport type { Overlay } from '@spectrum-web-components/overlay';\n\nignoreResizeObserverLoopError(before, after);\n\nconst deprecatedActionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\nconst actionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\nconst actionSubmenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `\n );\n\nexport const testActionMenu = (mode: 'sync' | 'async'): void => {\n describe(`Action menu: ${mode}`, () => {\n testForLitDevWarnings(async () => await actionMenuFixture());\n it('loads', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [slot=\"label\"]', async () => {\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu>\n <span slot=\"label\">More Actions</span>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\n await elementUpdated(el);\n await nextFrame();\n await nextFrame();\n\n await expect(el).to.be.accessible();\n });\n it('loads - [custom icon]', async () => {\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu label=\"More Actions\">\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\n await elementUpdated(el);\n await nextFrame();\n await nextFrame();\n\n await expect(el).to.be.accessible();\n });\n it('dispatches change events, no [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${({\n target: { value },\n }: Event & { target: ActionMenu }) => {\n changeSpy(value);\n }}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>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-action-menu>\n `\n );\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await elementUpdated(el);\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(1);\n expect(changeSpy.calledWith('Deselect')).to.be.true;\n });\n it('closes when Menu Item has [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(\n html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${() => {\n changeSpy();\n }}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item href=\"#\">Deselect</sp-menu-item>\n <sp-menu-item href=\"#\">Select Inverse</sp-menu-item>\n <sp-menu-item href=\"#\">Feather...</sp-menu-item>\n <sp-menu-item href=\"#\">Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item href=\"#\">Save Selection</sp-menu-item>\n <sp-menu-item href=\"#\" disabled>\n Make Work Path\n </sp-menu-item>\n </sp-action-menu>\n `\n );\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(0);\n });\n it('can be `quiet`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.quiet).to.be.false;\n\n el.quiet = true;\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n });\n it('can be `static`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.static == undefined).to.be.true;\n\n el.static = 'black';\n await elementUpdated(el);\n\n expect(el.static == 'black').to.be.true;\n\n el.static = 'white';\n await elementUpdated(el);\n\n expect(el.static == 'white').to.be.true;\n });\n it('stay `valid`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.invalid).to.be.false;\n\n el.invalid = true;\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n });\n it('focus()', async () => {\n const el = await actionMenuFixture();\n\n el.focus();\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n });\n it('opens unmeasured', async () => {\n const el = await actionMenuFixture();\n\n const button = el.button as HTMLButtonElement;\n\n button.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n });\n it('opens unmeasured with deprecated syntax', async () => {\n const el = await deprecatedActionMenuFixture();\n\n const button = el.button as HTMLButtonElement;\n\n button.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('toggles open/close multiple time', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n let opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n let closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n });\n it('allows submenu items to be selected', async () => {\n const root = await actionSubmenuFixture();\n const menuItem = root.querySelector('#item-with-submenu') as Menu;\n const submenu = menuItem.querySelector(\n 'sp-menu[slot=\"submenu\"]'\n ) as Menu;\n const selectedItem = submenu.querySelector(\n '#sub-selected-item'\n ) as MenuItem;\n\n expect(selectedItem.selected, 'item should be initially selected')\n .to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n expect(root.open).to.be.true;\n\n opened = oneEvent(menuItem, 'sp-opened');\n menuItem.dispatchEvent(\n new PointerEvent('pointerenter', { bubbles: true })\n );\n await opened;\n\n await elementUpdated(submenu);\n expect(\n selectedItem.selected,\n 'initially selected item should maintain selection'\n ).to.be.true;\n });\n it('allows top-level selection state to change', async () => {\n const root = await styledFixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `);\n\n const unselectedItem = root.querySelector(\n 'sp-menu-item'\n ) as MenuItem;\n const selectedItem = root.querySelector(\n '#root-selected-item'\n ) as MenuItem;\n let selected = true;\n\n selectedItem.addEventListener('click', () => {\n selected = !selected;\n selectedItem.selected = selected;\n });\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n let closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n expect(root.open).to.be.false;\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking unselected\n // (no event listener: should remain selected = false)\n closed = oneEvent(root, 'sp-closed');\n unselectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.false;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n });\n it('shows tooltip', async () => {\n const openSpy = spy();\n const el = await styledFixture<ActionMenu>(\n tooltipDescriptionAndPlacement(\n tooltipDescriptionAndPlacement.args\n )\n );\n const tooltip = el.querySelector('sp-tooltip') as Tooltip;\n const rect = el.getBoundingClientRect();\n tooltip.addEventListener('sp-opened', () => openSpy());\n await elementUpdated(tooltip);\n\n await nextFrame();\n await nextFrame();\n\n const overlay = tooltip.shadowRoot.querySelector(\n 'sp-overlay'\n ) as Overlay;\n await elementUpdated(overlay);\n\n expect(overlay.triggerElement === el.button).to.be.true;\n let open = oneEvent(tooltip, 'sp-opened');\n sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n await open;\n\n expect(tooltip.open).to.be.true;\n\n let close = oneEvent(tooltip, 'sp-closed');\n el.click();\n await close;\n\n expect(tooltip.open).to.be.false;\n expect(el.open).to.be.true;\n\n open = oneEvent(tooltip, 'sp-opened');\n sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width * 2,\n rect.top + rect.height / 2,\n ],\n type: 'move',\n },\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n await open;\n\n close = oneEvent(tooltip, 'sp-closed');\n sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width * 2,\n rect.top + rect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n await close;\n\n const menu = (el as unknown as TestablePicker).optionsMenu;\n const menuRect = menu.getBoundingClientRect();\n\n await sendMouse({\n steps: [\n {\n position: [\n menuRect.left + menuRect.width / 2,\n menuRect.top + menuRect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n\n await aTimeout(150);\n\n expect(openSpy.callCount).to.equal(2);\n });\n it('opens, then closes, on subsequent clicks', async () => {\n const el = await actionMenuFixture();\n const rect = el.getBoundingClientRect();\n\n const open = oneEvent(el, 'sp-opened');\n sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await open;\n\n expect(el.open).to.be.true;\n await aTimeout(50);\n expect(el.open).to.be.true;\n\n const close = oneEvent(el, 'sp-closed');\n sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\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