@spectrum-web-components/action-menu 0.37.0 → 0.39.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/README.md +30 -0
- package/custom-elements.json +36 -1
- package/package.json +9 -9
- package/src/ActionMenu.d.ts +6 -1
- package/src/ActionMenu.dev.js +30 -4
- package/src/ActionMenu.dev.js.map +2 -2
- package/src/ActionMenu.js +17 -6
- package/src/ActionMenu.js.map +3 -3
- package/stories/action-menu.stories.js +57 -1
- package/stories/action-menu.stories.js.map +3 -3
- package/stories/index.js +8 -3
- package/stories/index.js.map +2 -2
- package/test/index.js +57 -7
- package/test/index.js.map +2 -2
package/README.md
CHANGED
|
@@ -157,6 +157,36 @@ import { ActionMenu } from '@spectrum-web-components/action-menu';
|
|
|
157
157
|
|
|
158
158
|
## Variants
|
|
159
159
|
|
|
160
|
+
### No icon
|
|
161
|
+
|
|
162
|
+
In order to deliver an `<sp-action-menu>` without an icon, use the `label-only` slot. This will supress any icon from being displayed, both the default ellipsis icon or any icon the user might provide to the element.
|
|
163
|
+
|
|
164
|
+
<!-- prettier-ignore -->
|
|
165
|
+
```html
|
|
166
|
+
<sp-action-menu>
|
|
167
|
+
<span slot="label-only">More Actions</span>
|
|
168
|
+
<sp-menu-item>
|
|
169
|
+
Deselect
|
|
170
|
+
</sp-menu-item>
|
|
171
|
+
<sp-menu-item>
|
|
172
|
+
Select inverse
|
|
173
|
+
</sp-menu-item>
|
|
174
|
+
<sp-menu-item>
|
|
175
|
+
Feather...
|
|
176
|
+
</sp-menu-item>
|
|
177
|
+
<sp-menu-item>
|
|
178
|
+
Select and mask...
|
|
179
|
+
</sp-menu-item>
|
|
180
|
+
<sp-menu-divider></sp-menu-divider>
|
|
181
|
+
<sp-menu-item>
|
|
182
|
+
Save selection
|
|
183
|
+
</sp-menu-item>
|
|
184
|
+
<sp-menu-item disabled>
|
|
185
|
+
Make work path
|
|
186
|
+
</sp-menu-item>
|
|
187
|
+
</sp-action-menu>
|
|
188
|
+
```
|
|
189
|
+
|
|
160
190
|
### No visible label
|
|
161
191
|
|
|
162
192
|
The visible label that is be provided via the default `<slot>` interface can be ommitted in preference of an icon only interface. In this context be sure that the `<sp-action-menu>` continued to be accessible to screen readers by applying the `label` attribute. This will apply an `aria-label` attribute of the same value to the `<button>` element that toggles the menu list.
|
package/custom-elements.json
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"name": "label"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
"description": "Tooltip to
|
|
48
|
+
"description": "Tooltip to to be applied to the the Action Button",
|
|
49
49
|
"name": "tooltip"
|
|
50
50
|
}
|
|
51
51
|
],
|
|
@@ -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",
|
|
@@ -87,6 +98,15 @@
|
|
|
87
98
|
"privacy": "private",
|
|
88
99
|
"readonly": true
|
|
89
100
|
},
|
|
101
|
+
{
|
|
102
|
+
"kind": "field",
|
|
103
|
+
"name": "labelOnly",
|
|
104
|
+
"type": {
|
|
105
|
+
"text": "boolean"
|
|
106
|
+
},
|
|
107
|
+
"privacy": "private",
|
|
108
|
+
"readonly": true
|
|
109
|
+
},
|
|
90
110
|
{
|
|
91
111
|
"kind": "field",
|
|
92
112
|
"name": "buttonContent",
|
|
@@ -109,9 +129,24 @@
|
|
|
109
129
|
"module": "src/ActionMenu.ts"
|
|
110
130
|
},
|
|
111
131
|
"fieldName": "selects"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "static",
|
|
135
|
+
"type": {
|
|
136
|
+
"text": "'white' | 'black' | undefined"
|
|
137
|
+
},
|
|
138
|
+
"default": "undefined",
|
|
139
|
+
"resolveInitializer": {
|
|
140
|
+
"module": "src/ActionMenu.ts"
|
|
141
|
+
},
|
|
142
|
+
"fieldName": "static"
|
|
112
143
|
}
|
|
113
144
|
],
|
|
114
145
|
"mixins": [
|
|
146
|
+
{
|
|
147
|
+
"name": "ObserveSlotPresence",
|
|
148
|
+
"package": "@spectrum-web-components/shared/src/observe-slot-presence.js"
|
|
149
|
+
},
|
|
115
150
|
{
|
|
116
151
|
"name": "ObserveSlotText",
|
|
117
152
|
"package": "@spectrum-web-components/shared/src/observe-slot-text.js"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/action-menu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -61,15 +61,15 @@
|
|
|
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.39.0",
|
|
65
|
+
"@spectrum-web-components/base": "^0.39.0",
|
|
66
|
+
"@spectrum-web-components/icon": "^0.39.0",
|
|
67
|
+
"@spectrum-web-components/icons-workflow": "^0.39.0",
|
|
68
|
+
"@spectrum-web-components/picker": "^0.39.0",
|
|
69
|
+
"@spectrum-web-components/shared": "^0.39.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@spectrum-css/actionmenu": "^
|
|
72
|
+
"@spectrum-css/actionmenu": "^5.0.0"
|
|
73
73
|
},
|
|
74
74
|
"types": "./src/index.d.ts",
|
|
75
75
|
"customElements": "custom-elements.json",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"./**/*.dev.js",
|
|
79
79
|
"./sync/sp-*.js"
|
|
80
80
|
],
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "2acc8390ef0ac6cc940958d4da705c9859155c0d"
|
|
82
82
|
}
|
package/src/ActionMenu.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ import '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';
|
|
|
5
5
|
declare const ActionMenu_base: typeof PickerBase & {
|
|
6
6
|
new (...args: any[]): import("@spectrum-web-components/shared/src/observe-slot-text.js").SlotTextObservingInterface;
|
|
7
7
|
prototype: import("@spectrum-web-components/shared/src/observe-slot-text.js").SlotTextObservingInterface;
|
|
8
|
+
} & {
|
|
9
|
+
new (...args: any[]): import("@spectrum-web-components/shared/src/observe-slot-presence.js").SlotPresenceObservingInterface;
|
|
10
|
+
prototype: import("@spectrum-web-components/shared/src/observe-slot-presence.js").SlotPresenceObservingInterface;
|
|
8
11
|
};
|
|
9
12
|
/**
|
|
10
13
|
* @element sp-action-menu
|
|
@@ -12,7 +15,7 @@ declare const ActionMenu_base: typeof PickerBase & {
|
|
|
12
15
|
* @slot - menu items to be listed in the Action Menu
|
|
13
16
|
* @slot icon - The icon to use for Action Menu
|
|
14
17
|
* @slot label - The label to use on for the Action Menu
|
|
15
|
-
* @slot tooltip - Tooltip to
|
|
18
|
+
* @slot tooltip - Tooltip to to be applied to the the Action Button
|
|
16
19
|
* @attr selects - By default `sp-action-menu` does not manage a selection. If
|
|
17
20
|
* you'd like for a selection to be held by the `sp-menu` that it presents in
|
|
18
21
|
* its overlay, use `selects="single" to activate this functionality.
|
|
@@ -20,9 +23,11 @@ declare const ActionMenu_base: typeof PickerBase & {
|
|
|
20
23
|
export declare class ActionMenu extends ActionMenu_base {
|
|
21
24
|
static get styles(): CSSResultArray;
|
|
22
25
|
selects: undefined | 'single';
|
|
26
|
+
static: 'white' | 'black' | undefined;
|
|
23
27
|
protected listRole: 'listbox' | 'menu';
|
|
24
28
|
protected itemRole: string;
|
|
25
29
|
private get hasLabel();
|
|
30
|
+
private get labelOnly();
|
|
26
31
|
protected get buttonContent(): TemplateResult[];
|
|
27
32
|
protected render(): TemplateResult;
|
|
28
33
|
protected update(changedProperties: PropertyValues<this>): void;
|
package/src/ActionMenu.dev.js
CHANGED
|
@@ -13,17 +13,23 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
13
|
import {
|
|
14
14
|
html
|
|
15
15
|
} from "@spectrum-web-components/base";
|
|
16
|
+
import { state } from "@spectrum-web-components/base/src/decorators.js";
|
|
16
17
|
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
17
18
|
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
18
19
|
import { PickerBase } from "@spectrum-web-components/picker";
|
|
19
20
|
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
21
|
+
import { ObserveSlotPresence } from "@spectrum-web-components/shared/src/observe-slot-presence.js";
|
|
20
22
|
import { ObserveSlotText } from "@spectrum-web-components/shared/src/observe-slot-text.js";
|
|
21
23
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";
|
|
22
24
|
import actionMenuStyles from "./action-menu.css.js";
|
|
23
|
-
export class ActionMenu extends
|
|
25
|
+
export class ActionMenu extends ObserveSlotPresence(
|
|
26
|
+
ObserveSlotText(PickerBase, "label"),
|
|
27
|
+
'[slot="label-only"]'
|
|
28
|
+
) {
|
|
24
29
|
constructor() {
|
|
25
30
|
super(...arguments);
|
|
26
31
|
this.selects = void 0;
|
|
32
|
+
this.static = void 0;
|
|
27
33
|
this.listRole = "menu";
|
|
28
34
|
this.itemRole = "menuitem";
|
|
29
35
|
}
|
|
@@ -33,13 +39,24 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
33
39
|
get hasLabel() {
|
|
34
40
|
return this.slotHasContent;
|
|
35
41
|
}
|
|
42
|
+
get labelOnly() {
|
|
43
|
+
return this.slotContentIsPresent;
|
|
44
|
+
}
|
|
36
45
|
get buttonContent() {
|
|
37
46
|
return [
|
|
38
47
|
html`
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
${this.labelOnly ? html`` : html`
|
|
49
|
+
<slot
|
|
50
|
+
name="icon"
|
|
51
|
+
slot="icon"
|
|
52
|
+
?icon-only=${!this.hasLabel}
|
|
53
|
+
?hidden=${this.labelOnly}
|
|
54
|
+
>
|
|
55
|
+
<sp-icon-more class="icon"></sp-icon-more>
|
|
56
|
+
</slot>
|
|
57
|
+
`}
|
|
42
58
|
<slot name="label" ?hidden=${!this.hasLabel}></slot>
|
|
59
|
+
<slot name="label-only"></slot>
|
|
43
60
|
<slot name="tooltip"></slot>
|
|
44
61
|
`
|
|
45
62
|
];
|
|
@@ -49,6 +66,7 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
49
66
|
<sp-action-button
|
|
50
67
|
?quiet=${this.quiet}
|
|
51
68
|
?selected=${this.open}
|
|
69
|
+
static=${ifDefined(this.static)}
|
|
52
70
|
aria-haspopup="true"
|
|
53
71
|
aria-controls=${ifDefined(this.open ? "menu" : void 0)}
|
|
54
72
|
aria-expanded=${this.open ? "true" : "false"}
|
|
@@ -57,6 +75,8 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
57
75
|
class="button"
|
|
58
76
|
size=${this.size}
|
|
59
77
|
@blur=${this.handleButtonBlur}
|
|
78
|
+
@pointerdown=${this.handleButtonPointerdown}
|
|
79
|
+
@focus=${this.handleButtonFocus}
|
|
60
80
|
@click=${this.handleButtonClick}
|
|
61
81
|
@keydown=${{
|
|
62
82
|
handleEvent: this.handleEnterKeydown,
|
|
@@ -79,4 +99,10 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
79
99
|
__decorateClass([
|
|
80
100
|
property({ type: String })
|
|
81
101
|
], ActionMenu.prototype, "selects", 2);
|
|
102
|
+
__decorateClass([
|
|
103
|
+
property({ type: String, reflect: true })
|
|
104
|
+
], ActionMenu.prototype, "static", 2);
|
|
105
|
+
__decorateClass([
|
|
106
|
+
state()
|
|
107
|
+
], ActionMenu.prototype, "labelOnly", 1);
|
|
82
108
|
//# 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
|
|
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,
|
|
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 { state } from '@spectrum-web-components/base/src/decorators.js';\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 { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.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 to be applied to the the Action Button\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 ObserveSlotPresence(\n ObserveSlotText(PickerBase, 'label'),\n '[slot=\"label-only\"]'\n) {\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 @state()\n private get labelOnly(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n ${this.labelOnly\n ? html``\n : html`\n <slot\n name=\"icon\"\n slot=\"icon\"\n ?icon-only=${!this.hasLabel}\n ?hidden=${this.labelOnly}\n >\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n `}\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"label-only\"></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,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,O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,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;AAzEoB;AAAA,EADf,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GARjB,WASO;AAGT;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAXhC,WAYF;AASK;AAAA,EADX,MAAM;AAAA,GApBE,WAqBG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ActionMenu.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=(r,o,t,i)=>{for(var e=i>1?void 0:i?h(o,t):o,s=r.length-1,a;s>=0;s--)(a=r[s])&&(e=(i?a(o,t,e):a(e))||e);return i&&e&&p(o,t,e),e};import{html as n}from"@spectrum-web-components/base";import{state as c}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as d}from"@spectrum-web-components/base/src/directives.js";import{property as u}from"@spectrum-web-components/base/src/decorators.js";import{PickerBase as m}from"@spectrum-web-components/picker";import"@spectrum-web-components/action-button/sp-action-button.js";import{ObserveSlotPresence as b}from"@spectrum-web-components/shared/src/observe-slot-presence.js";import{ObserveSlotText as f}from"@spectrum-web-components/shared/src/observe-slot-text.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";import $ from"./action-menu.css.js";export class ActionMenu extends b(f(m,"label"),'[slot="label-only"]'){constructor(){super(...arguments);this.selects=void 0;this.static=void 0;this.listRole="menu";this.itemRole="menuitem"}static get styles(){return[$]}get hasLabel(){return this.slotHasContent}get labelOnly(){return this.slotContentIsPresent}get buttonContent(){return[n`
|
|
2
|
+
${this.labelOnly?n``:n`
|
|
3
|
+
<slot
|
|
4
|
+
name="icon"
|
|
5
|
+
slot="icon"
|
|
6
|
+
?icon-only=${!this.hasLabel}
|
|
7
|
+
?hidden=${this.labelOnly}
|
|
8
|
+
>
|
|
9
|
+
<sp-icon-more class="icon"></sp-icon-more>
|
|
10
|
+
</slot>
|
|
11
|
+
`}
|
|
5
12
|
<slot name="label" ?hidden=${!this.hasLabel}></slot>
|
|
13
|
+
<slot name="label-only"></slot>
|
|
6
14
|
<slot name="tooltip"></slot>
|
|
7
|
-
`]}render(){return
|
|
15
|
+
`]}render(){return n`
|
|
8
16
|
<sp-action-button
|
|
9
17
|
?quiet=${this.quiet}
|
|
10
18
|
?selected=${this.open}
|
|
19
|
+
static=${d(this.static)}
|
|
11
20
|
aria-haspopup="true"
|
|
12
21
|
aria-controls=${d(this.open?"menu":void 0)}
|
|
13
22
|
aria-expanded=${this.open?"true":"false"}
|
|
@@ -16,6 +25,8 @@
|
|
|
16
25
|
class="button"
|
|
17
26
|
size=${this.size}
|
|
18
27
|
@blur=${this.handleButtonBlur}
|
|
28
|
+
@pointerdown=${this.handleButtonPointerdown}
|
|
29
|
+
@focus=${this.handleButtonFocus}
|
|
19
30
|
@click=${this.handleButtonClick}
|
|
20
31
|
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
|
|
21
32
|
?disabled=${this.disabled}
|
|
@@ -23,5 +34,5 @@
|
|
|
23
34
|
${this.buttonContent}
|
|
24
35
|
</sp-action-button>
|
|
25
36
|
${this.renderMenu}
|
|
26
|
-
`}update(t){t.has("invalid")&&(this.invalid=!1),super.update(t)}}l([
|
|
37
|
+
`}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),l([c()],ActionMenu.prototype,"labelOnly",1);
|
|
27
38
|
//# 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
|
|
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,
|
|
6
|
-
"names": ["html", "ifDefined", "property", "PickerBase", "ObserveSlotText", "actionMenuStyles", "changedProperties", "__decorateClass"]
|
|
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 { state } from '@spectrum-web-components/base/src/decorators.js';\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 { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.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 to be applied to the the Action Button\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 ObserveSlotPresence(\n ObserveSlotText(PickerBase, 'label'),\n '[slot=\"label-only\"]'\n) {\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 @state()\n private get labelOnly(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override get buttonContent(): TemplateResult[] {\n return [\n html`\n ${this.labelOnly\n ? html``\n : html`\n <slot\n name=\"icon\"\n slot=\"icon\"\n ?icon-only=${!this.hasLabel}\n ?hidden=${this.labelOnly}\n >\n <sp-icon-more class=\"icon\"></sp-icon-more>\n </slot>\n `}\n <slot name=\"label\" ?hidden=${!this.hasLabel}></slot>\n <slot name=\"label-only\"></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,SAAAC,MAAa,kDACtB,OAAS,aAAAC,MAAiB,kDAC1B,OAAS,YAAAC,MAAgB,kDACzB,OAAS,cAAAC,MAAkB,kCAC3B,MAAO,6DACP,OAAS,uBAAAC,MAA2B,+DACpC,OAAS,mBAAAC,MAAuB,2DAChC,MAAO,gEACP,OAAOC,MAAsB,uBAatB,aAAM,mBAAmBF,EAC5BC,EAAgBF,EAAY,OAAO,EACnC,qBACJ,CAAE,CAHK,kCASH,KAAgB,QAAgC,OAGhD,KAAO,OAAwC,OAE/C,KAAmB,SAA+B,OAClD,KAAmB,SAAW,WAX9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|
6
|
+
"names": ["html", "state", "ifDefined", "property", "PickerBase", "ObserveSlotPresence", "ObserveSlotText", "actionMenuStyles", "changedProperties", "__decorateClass"]
|
|
7
7
|
}
|
|
@@ -7,6 +7,7 @@ import "@spectrum-web-components/menu/sp-menu-group.js";
|
|
|
7
7
|
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
8
8
|
import "@spectrum-web-components/tooltip/sp-tooltip.js";
|
|
9
9
|
import { ActionMenuMarkup } from "./";
|
|
10
|
+
import { makeOverBackground } from "../../button/stories/index.js";
|
|
10
11
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
11
12
|
export default {
|
|
12
13
|
component: "sp-action-menu",
|
|
@@ -96,6 +97,24 @@ export default {
|
|
|
96
97
|
control: {
|
|
97
98
|
type: "boolean"
|
|
98
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
|
+
}
|
|
99
118
|
}
|
|
100
119
|
},
|
|
101
120
|
args: {
|
|
@@ -104,15 +123,52 @@ export default {
|
|
|
104
123
|
open: false,
|
|
105
124
|
quiet: false,
|
|
106
125
|
tooltipDescription: "",
|
|
107
|
-
tooltipPlacement: "bottom"
|
|
126
|
+
tooltipPlacement: "bottom",
|
|
127
|
+
static: void 0
|
|
108
128
|
}
|
|
109
129
|
};
|
|
110
130
|
const Template = (args = {}) => ActionMenuMarkup(args);
|
|
111
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()];
|
|
112
142
|
export const quiet = (args = {}) => Template(args);
|
|
113
143
|
quiet.args = {
|
|
114
144
|
quiet: true
|
|
115
145
|
};
|
|
146
|
+
export const labelOnly = ({
|
|
147
|
+
changeHandler = () => void 0,
|
|
148
|
+
disabled = false,
|
|
149
|
+
open = false,
|
|
150
|
+
size = "m",
|
|
151
|
+
selects: selects2 = "",
|
|
152
|
+
selected = false
|
|
153
|
+
} = {}) => html`
|
|
154
|
+
<sp-action-menu
|
|
155
|
+
?disabled=${disabled}
|
|
156
|
+
?open=${open}
|
|
157
|
+
size=${size}
|
|
158
|
+
@change="${changeHandler}"
|
|
159
|
+
.selects=${selects2 ? selects2 : void 0}
|
|
160
|
+
value=${selected ? "Select Inverse" : ""}
|
|
161
|
+
>
|
|
162
|
+
<span slot="label-only">Label Only</span>
|
|
163
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
164
|
+
<sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>
|
|
165
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
166
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
167
|
+
<sp-menu-divider></sp-menu-divider>
|
|
168
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
169
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
170
|
+
</sp-action-menu>
|
|
171
|
+
`;
|
|
116
172
|
export const selects = (args = {}) => Template({
|
|
117
173
|
...args,
|
|
118
174
|
selects: "single",
|
|
@@ -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/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 './';\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\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;
|
|
6
|
-
"names": []
|
|
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';\nimport { Placement } from '@spectrum-web-components/overlay/src/overlay-types.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?: Placement;\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 labelOnly = ({\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = false,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n} = {}): TemplateResult => html`\n <sp-action-menu\n ?disabled=${disabled}\n ?open=${open}\n size=${size}\n @change=\"${changeHandler}\"\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n >\n <span slot=\"label-only\">Label Only</span>\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 </sp-action-menu>\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} as StoryArgs;\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\">Log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EO,aAAM,SAAS,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": ["selects"]
|
|
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';\nimport { Placement } from '@spectrum-web-components/overlay/src/overlay-types.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' as Placement,\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'\n ? undefined\n : (staticValue as 'black' | 'white')\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;AAGA,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,SACV,SACC;AAAA,EACX,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
|
@@ -200,6 +200,16 @@ export const testActionMenu = (mode) => {
|
|
|
200
200
|
await elementUpdated(el);
|
|
201
201
|
expect(el.quiet).to.be.true;
|
|
202
202
|
});
|
|
203
|
+
it("can be `static`", async () => {
|
|
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";
|
|
210
|
+
await elementUpdated(el);
|
|
211
|
+
expect(el.static == "white").to.be.true;
|
|
212
|
+
});
|
|
203
213
|
it("stay `valid`", async () => {
|
|
204
214
|
const el = await actionMenuFixture();
|
|
205
215
|
expect(el.invalid).to.be.false;
|
|
@@ -296,10 +306,19 @@ export const testActionMenu = (mode) => {
|
|
|
296
306
|
).to.be.true;
|
|
297
307
|
});
|
|
298
308
|
it("allows top-level selection state to change", async () => {
|
|
309
|
+
let selected = true;
|
|
310
|
+
const handleChange = (event) => {
|
|
311
|
+
if (event.target.value === "test") {
|
|
312
|
+
selected = !selected;
|
|
313
|
+
event.target.updateComplete.then(() => {
|
|
314
|
+
event.target.value = selected ? "test" : "";
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
};
|
|
299
318
|
const root = await styledFixture(html`
|
|
300
|
-
<sp-action-menu label="More Actions">
|
|
319
|
+
<sp-action-menu label="More Actions" @change=${handleChange}>
|
|
301
320
|
<sp-menu-item>One</sp-menu-item>
|
|
302
|
-
<sp-menu-item selected id="root-selected-item">
|
|
321
|
+
<sp-menu-item selected value="test" id="root-selected-item">
|
|
303
322
|
Two
|
|
304
323
|
</sp-menu-item>
|
|
305
324
|
<sp-menu-item id="item-with-submenu">
|
|
@@ -320,11 +339,6 @@ export const testActionMenu = (mode) => {
|
|
|
320
339
|
const selectedItem = root.querySelector(
|
|
321
340
|
"#root-selected-item"
|
|
322
341
|
);
|
|
323
|
-
let selected = true;
|
|
324
|
-
selectedItem.addEventListener("click", () => {
|
|
325
|
-
selected = !selected;
|
|
326
|
-
selectedItem.selected = selected;
|
|
327
|
-
});
|
|
328
342
|
expect(unselectedItem.textContent).to.include("One");
|
|
329
343
|
expect(unselectedItem.selected).to.be.false;
|
|
330
344
|
expect(selectedItem.textContent).to.include("Two");
|
|
@@ -446,6 +460,42 @@ export const testActionMenu = (mode) => {
|
|
|
446
460
|
await aTimeout(150);
|
|
447
461
|
expect(openSpy.callCount).to.equal(2);
|
|
448
462
|
});
|
|
463
|
+
it("opens, then closes, on subsequent clicks", async () => {
|
|
464
|
+
const el = await actionMenuFixture();
|
|
465
|
+
const rect = el.getBoundingClientRect();
|
|
466
|
+
const open = oneEvent(el, "sp-opened");
|
|
467
|
+
sendMouse({
|
|
468
|
+
steps: [
|
|
469
|
+
{
|
|
470
|
+
position: [
|
|
471
|
+
rect.left + rect.width / 2,
|
|
472
|
+
rect.top + rect.height / 2
|
|
473
|
+
],
|
|
474
|
+
type: "click"
|
|
475
|
+
}
|
|
476
|
+
]
|
|
477
|
+
});
|
|
478
|
+
await open;
|
|
479
|
+
expect(el.open).to.be.true;
|
|
480
|
+
await aTimeout(50);
|
|
481
|
+
expect(el.open).to.be.true;
|
|
482
|
+
const close = oneEvent(el, "sp-closed");
|
|
483
|
+
sendMouse({
|
|
484
|
+
steps: [
|
|
485
|
+
{
|
|
486
|
+
position: [
|
|
487
|
+
rect.left + rect.width / 2,
|
|
488
|
+
rect.top + rect.height / 2
|
|
489
|
+
],
|
|
490
|
+
type: "click"
|
|
491
|
+
}
|
|
492
|
+
]
|
|
493
|
+
});
|
|
494
|
+
await close;
|
|
495
|
+
expect(el.open).to.be.false;
|
|
496
|
+
await aTimeout(50);
|
|
497
|
+
expect(el.open).to.be.false;
|
|
498
|
+
});
|
|
449
499
|
});
|
|
450
500
|
};
|
|
451
501
|
//# 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 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('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 });\n};\n"],
|
|
5
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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
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 let selected = true;\n const handleChange = (\n event: Event & { target: ActionMenu }\n ): void => {\n if (event.target.value === 'test') {\n selected = !selected;\n\n event.target.updateComplete.then(() => {\n event.target.value = selected ? 'test' : '';\n });\n }\n };\n const root = await styledFixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\" @change=${handleChange}>\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected value=\"test\" 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\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 });\n await close;\n\n expect(el.open).to.be.false;\n await aTimeout(50);\n expect(el.open).to.be.false;\n });\n });\n};\n"],
|
|
5
|
+
"mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,6BAA6B;AAEtC,SAAS,WAAW;AAIpB;AAAA,EACI;AAAA,EACA,WAAW;AAAA,OACR;AACP,OAAO;AACP,SAAS,sCAAsC;AAE/C,SAAS,iBAAiB;AAI1B,8BAA8B,QAAQ,KAAK;AAE3C,MAAM,8BAA8B,YAChC,MAAM;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaJ;AAEJ,MAAM,oBAAoB,YACtB,MAAM;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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