@spectrum-web-components/action-menu 0.14.2-devmode2.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/sp-action-menu.dev.js +1 -0
- package/sp-action-menu.dev.js.map +1 -1
- package/sp-action-menu.js +1 -2
- package/sp-action-menu.js.map +2 -2
- package/src/ActionMenu.dev.js +1 -0
- package/src/ActionMenu.dev.js.map +1 -1
- package/src/ActionMenu.js +5 -57
- package/src/ActionMenu.js.map +2 -2
- package/src/action-menu.css.dev.js +1 -0
- package/src/action-menu.css.dev.js.map +1 -1
- package/src/action-menu.css.js +2 -4
- package/src/action-menu.css.js.map +2 -2
- package/src/index.dev.js +1 -0
- package/src/index.dev.js.map +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/stories/action-menu-sizes.stories.js +1 -0
- package/stories/action-menu-sizes.stories.js.map +1 -1
- package/stories/action-menu.stories.js +1 -0
- package/stories/action-menu.stories.js.map +1 -1
- package/stories/index.js +1 -0
- package/stories/index.js.map +1 -1
- package/sync/sp-action-menu.dev.js +1 -0
- package/sync/sp-action-menu.dev.js.map +1 -1
- package/sync/sp-action-menu.js +1 -2
- package/sync/sp-action-menu.js.map +1 -1
- package/test/action-menu-sizes.test-vrt.js +1 -0
- package/test/action-menu-sizes.test-vrt.js.map +1 -1
- package/test/action-menu-sync.test.js +17 -8
- package/test/action-menu-sync.test.js.map +1 -1
- package/test/action-menu.test-vrt.js +1 -0
- package/test/action-menu.test-vrt.js.map +1 -1
- package/test/action-menu.test.js +34 -14
- package/test/action-menu.test.js.map +1 -1
- package/test/benchmark/test-basic.js +1 -0
- package/test/benchmark/test-basic.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/action-menu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
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.10.1",
|
|
65
|
+
"@spectrum-web-components/base": "^0.7.0",
|
|
66
|
+
"@spectrum-web-components/icon": "^0.12.0",
|
|
67
|
+
"@spectrum-web-components/icons-workflow": "^0.9.0",
|
|
68
|
+
"@spectrum-web-components/picker": "^0.13.1",
|
|
69
|
+
"@spectrum-web-components/shared": "^0.15.0",
|
|
70
70
|
"tslib": "^2.0.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"./**/*.dev.js",
|
|
80
80
|
"./sync/sp-*.js"
|
|
81
81
|
],
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "1cfea66c39440232b9982509573801b8e3a9f692"
|
|
83
83
|
}
|
package/sp-action-menu.dev.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-action-menu.ts"],
|
|
4
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 { ActionMenu } from './src/ActionMenu.dev.js'\n\ncustomElements.define('sp-action-menu', ActionMenu);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-action-menu': ActionMenu;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAYA;
|
|
5
|
+
"mappings": ";AAYA,SAAS,kBAAkB;AAE3B,eAAe,OAAO,kBAAkB,UAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/sp-action-menu.js
CHANGED
package/sp-action-menu.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-action-menu.ts"],
|
|
4
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 { ActionMenu } from './src/ActionMenu.js';\n\ncustomElements.define('sp-action-menu', ActionMenu);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-action-menu': ActionMenu;\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "aAYA,OAAS,cAAAA,MAAkB,sBAE3B,eAAe,OAAO,iBAAkBA,CAAU",
|
|
6
|
+
"names": ["ActionMenu"]
|
|
7
7
|
}
|
package/src/ActionMenu.dev.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ActionMenu.ts"],
|
|
4
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 * @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 `,\n ];\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-action-button\n quiet\n ?selected=${this.open}\n aria-haspopup=\"true\"\n aria-controls=\"popover\"\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.onButtonBlur}\n @click=${this.onButtonClick}\n @focus=${this.onButtonFocus}\n ?disabled=${this.disabled}\n >\n ${this.buttonContent}\n </sp-action-button>\n `;\n }\n\n protected override update(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n this.quiet = true;\n super.update(changedProperties);\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
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;AAYtB,aAAM,mBAAmB,gBAAgB,YAAY,OAAO,EAAE;AAAA,EAA9D;AAAA;AAMH,SAAgB,UAAgC;AAEhD,SAAmB,WAA+B;AAClD,SAAmB,WAAW;AAAA;AAAA,EAR9B,WAA2B,SAAyB;AAChD,WAAO,CAAC,gBAAgB;AAAA,EAC5B;AAAA,EAOA,IAAY,WAAoB;AAC5B,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAuB,gBAAkC;AACrD,WAAO;AAAA,MACH;AAAA,2DAC+C,CAAC,KAAK;AAAA;AAAA;AAAA,6CAGpB,CAAC,KAAK;AAAA;AAAA,IAE3C;AAAA,EACJ;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA;AAAA,4BAGa,KAAK;AAAA;AAAA;AAAA,gCAGD,KAAK,OAAO,SAAS;AAAA,6BACxB,UAAU,KAAK,SAAS,MAAS;AAAA;AAAA;AAAA,uBAGvC,KAAK;AAAA,wBACJ,KAAK;AAAA,yBACJ,KAAK;AAAA,yBACL,KAAK;AAAA,4BACF,KAAK;AAAA;AAAA,kBAEf,KAAK;AAAA;AAAA;AAAA,EAGnB;AAAA,EAEmB,OAAO,mBAA+C;AACrE,QAAI,kBAAkB,IAAI,SAAS,GAAG;AAClC,WAAK,UAAU;AAAA,IACnB;AACA,SAAK,QAAQ;AACb,UAAM,OAAO,iBAAiB;AAAA,EAClC;AACJ;AAhDoB;AAAA,EADf,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GALjB,WAMO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ActionMenu.js
CHANGED
|
@@ -1,56 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
-
if (decorator = decorators[i])
|
|
7
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
10
|
-
return result;
|
|
11
|
-
};
|
|
12
|
-
import {
|
|
13
|
-
html
|
|
14
|
-
} from "@spectrum-web-components/base";
|
|
15
|
-
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
16
|
-
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
17
|
-
import { PickerBase } from "@spectrum-web-components/picker";
|
|
18
|
-
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
19
|
-
import { ObserveSlotText } from "@spectrum-web-components/shared/src/observe-slot-text.js";
|
|
20
|
-
import "@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";
|
|
21
|
-
import actionMenuStyles from "./action-menu.css.js";
|
|
22
|
-
export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.selects = void 0;
|
|
26
|
-
this.listRole = "menu";
|
|
27
|
-
this.itemRole = "menuitem";
|
|
28
|
-
}
|
|
29
|
-
static get styles() {
|
|
30
|
-
return [actionMenuStyles];
|
|
31
|
-
}
|
|
32
|
-
get hasLabel() {
|
|
33
|
-
return this.slotHasContent;
|
|
34
|
-
}
|
|
35
|
-
get buttonContent() {
|
|
36
|
-
return [
|
|
37
|
-
html`
|
|
1
|
+
"use strict";var u=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var n=(r,o,t,i)=>{for(var e=i>1?void 0:i?p(o,t):o,s=r.length-1,l;s>=0;s--)(l=r[s])&&(e=(i?l(o,t,e):l(e))||e);return i&&e&&u(o,t,e),e};import{html as a}from"@spectrum-web-components/base";import{ifDefined as d}from"@spectrum-web-components/base/src/directives.js";import{property as c}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{ObserveSlotText as b}from"@spectrum-web-components/shared/src/observe-slot-text.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";import h from"./action-menu.css.js";export class ActionMenu extends b(m,"label"){constructor(){super(...arguments);this.selects=void 0;this.listRole="menu";this.itemRole="menuitem"}static get styles(){return[h]}get hasLabel(){return this.slotHasContent}get buttonContent(){return[a`
|
|
38
2
|
<slot name="icon" slot="icon" ?icon-only=${!this.hasLabel}>
|
|
39
3
|
<sp-icon-more class="icon"></sp-icon-more>
|
|
40
4
|
</slot>
|
|
41
5
|
<slot name="label" ?hidden=${!this.hasLabel}></slot>
|
|
42
|
-
`
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
return html`
|
|
6
|
+
`]}render(){return a`
|
|
47
7
|
<sp-action-button
|
|
48
8
|
quiet
|
|
49
9
|
?selected=${this.open}
|
|
50
10
|
aria-haspopup="true"
|
|
51
11
|
aria-controls="popover"
|
|
52
|
-
aria-expanded=${this.open
|
|
53
|
-
aria-label=${
|
|
12
|
+
aria-expanded=${this.open?"true":"false"}
|
|
13
|
+
aria-label=${d(this.label||void 0)}
|
|
54
14
|
id="button"
|
|
55
15
|
class="button"
|
|
56
16
|
size=${this.size}
|
|
@@ -61,17 +21,5 @@ export class ActionMenu extends ObserveSlotText(PickerBase, "label") {
|
|
|
61
21
|
>
|
|
62
22
|
${this.buttonContent}
|
|
63
23
|
</sp-action-button>
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
update(changedProperties) {
|
|
67
|
-
if (changedProperties.has("invalid")) {
|
|
68
|
-
this.invalid = false;
|
|
69
|
-
}
|
|
70
|
-
this.quiet = true;
|
|
71
|
-
super.update(changedProperties);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
__decorateClass([
|
|
75
|
-
property({ type: String })
|
|
76
|
-
], ActionMenu.prototype, "selects", 2);
|
|
24
|
+
`}update(t){t.has("invalid")&&(this.invalid=!1),this.quiet=!0,super.update(t)}}n([c({type:String})],ActionMenu.prototype,"selects",2);
|
|
77
25
|
//# sourceMappingURL=ActionMenu.js.map
|
package/src/ActionMenu.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ActionMenu.ts"],
|
|
4
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 * @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 `,\n ];\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-action-button\n quiet\n ?selected=${this.open}\n aria-haspopup=\"true\"\n aria-controls=\"popover\"\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.onButtonBlur}\n @click=${this.onButtonClick}\n @focus=${this.onButtonFocus}\n ?disabled=${this.disabled}\n >\n ${this.buttonContent}\n </sp-action-button>\n `;\n }\n\n protected override update(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n this.quiet = true;\n super.update(changedProperties);\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
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,uBAYtB,aAAM,mBAAmBD,EAAgBD,EAAY,OAAO,CAAE,CAA9D,kCAMH,KAAgB,QAAgC,OAEhD,KAAmB,SAA+B,OAClD,KAAmB,SAAW,WAR9B,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAgB,CAC5B,CAOA,IAAY,UAAoB,CAC5B,OAAO,KAAK,cAChB,CAEA,IAAuB,eAAkC,CACrD,MAAO,CACHL;AAAA,2DAC+C,CAAC,KAAK;AAAA;AAAA;AAAA,6CAGpB,CAAC,KAAK;AAAA,aAE3C,CACJ,CAEmB,QAAyB,CACxC,OAAOA;AAAA;AAAA;AAAA,4BAGa,KAAK;AAAA;AAAA;AAAA,gCAGD,KAAK,KAAO,OAAS;AAAA,6BACxBC,EAAU,KAAK,OAAS,MAAS;AAAA;AAAA;AAAA,uBAGvC,KAAK;AAAA,wBACJ,KAAK;AAAA,yBACJ,KAAK;AAAA,yBACL,KAAK;AAAA,4BACF,KAAK;AAAA;AAAA,kBAEf,KAAK;AAAA;AAAA,SAGnB,CAEmB,OAAOK,EAA+C,CACjEA,EAAkB,IAAI,SAAS,IAC/B,KAAK,QAAU,IAEnB,KAAK,MAAQ,GACb,MAAM,OAAOA,CAAiB,CAClC,CACJ,CAhDoBC,EAAA,CADfL,EAAS,CAAE,KAAM,MAAO,CAAC,GALjB,WAMO",
|
|
6
|
+
"names": ["html", "ifDefined", "property", "PickerBase", "ObserveSlotText", "actionMenuStyles", "changedProperties", "__decorateClass"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import { css } from "@spectrum-web-components/base";
|
|
2
3
|
const styles = css`
|
|
3
4
|
:host{display:inline-flex}:host([quiet]){min-width:0}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{display:none;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(
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{display:inline-flex}:host([quiet]){min-width:0}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{display:none;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
|
-
"mappings": "AAWA;
|
|
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,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const styles = css`
|
|
1
|
+
"use strict";import{css as t}from"@spectrum-web-components/base";const o=t`
|
|
3
2
|
:host{display:inline-flex}:host([quiet]){min-width:0}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{display:none;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(
|
|
4
3
|
--custom-actionbutton-edge-to-text,
|
|
5
4
|
var(--spectrum-actionbutton-edge-to-text)
|
|
@@ -13,6 +12,5 @@ var(--spectrum-actionbutton-edge-to-text)
|
|
|
13
12
|
--custom-actionbutton-edge-to-visual-only,
|
|
14
13
|
var(--spectrum-actionbutton-edge-to-visual-only)
|
|
15
14
|
))*-1)}
|
|
16
|
-
`;
|
|
17
|
-
export default styles;
|
|
15
|
+
`;export default o;
|
|
18
16
|
//# sourceMappingURL=action-menu.css.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{display:inline-flex}:host([quiet]){min-width:0}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{display:none;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
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
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
|
+
"names": ["css", "styles"]
|
|
7
7
|
}
|
package/src/index.dev.js
CHANGED
package/src/index.dev.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
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*/\nexport * from './ActionMenu.dev.js'\n"],
|
|
5
|
-
"mappings": "AAWA;",
|
|
5
|
+
"mappings": ";AAWA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
"use strict";export*from"./ActionMenu.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
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*/\nexport * from './ActionMenu.js';\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "aAWA,WAAc",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu-sizes.stories.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2021 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 { 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 { ActionMenuMarkup } from './';\n\nexport default {\n title: 'Action menu/Sizes',\n component: 'sp-action-menu',\n};\n\nexport const s = (): TemplateResult => ActionMenuMarkup({ size: 's' });\nexport const m = (): TemplateResult => ActionMenuMarkup({ size: 'm' });\nexport const l = (): TemplateResult => ActionMenuMarkup({ size: 'l' });\nexport const xl = (): TemplateResult => ActionMenuMarkup({ size: 'xl' });\n"],
|
|
5
|
-
"mappings": "AAaA;
|
|
5
|
+
"mappings": ";AAaA,OAAO;AACP,OAAO;AACP,SAAS,wBAAwB;AAEjC,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AACf;AAEO,aAAM,IAAI,MAAsB,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAC9D,aAAM,IAAI,MAAsB,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAC9D,aAAM,IAAI,MAAsB,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAC9D,aAAM,KAAK,MAAsB,iBAAiB,EAAE,MAAM,KAAK,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu.stories.ts"],
|
|
4
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 { ActionMenuMarkup } from './';\n\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.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 },\n args: {\n visibleLabel: 'More Actions',\n disabled: false,\n open: false,\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}\n\nconst Template = (args: StoryArgs = {}): TemplateResult =>\n ActionMenuMarkup(args);\n\nexport const Default = (args: StoryArgs = {}): TemplateResult => Template(args);\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 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"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAA4B;AAErC,OAAO;AACP,OAAO;AACP,SAAS,wBAAwB;AAEjC,OAAO;AAEP,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,GAAG;AAAA,MAChC;AAAA,MACA,SAAS;AAAA,IACb;AAAA,EACJ;AAAA,EACA,MAAM;AAAA,IACF,cAAc;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,EACV;AACJ;AAWA,MAAM,WAAW,CAAC,OAAkB,CAAC,MACjC,iBAAiB,IAAI;AAElB,aAAM,UAAU,CAAC,OAAkB,CAAC,MAAsB,SAAS,IAAI;AAEvE,aAAM,UAAU,CAAC,OAAkB,CAAC,MACvC,SAAS;AAAA,EACL,GAAG;AAAA,EACH,SAAS;AAAA,EACT,UAAU;AACd,CAAC;AACL,QAAQ,OAAO;AAAA,EACX,MAAM;AACV;AAEO,aAAM,WAAW,CAAC,OAAkB,CAAC,MACxC,SAAS,IAAI;AACjB,SAAS,OAAO;AAAA,EACZ,cAAc;AAClB;AAEO,aAAM,aAAa,CAAC,SAAoC,SAAS,IAAI;AAC5E,WAAW,OAAO;AAAA,EACd,YAAY;AAAA;AAAA;AAAA,EAGZ,cAAc;AAClB;AAEO,aAAM,UAAU,MAAsB;AACzC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/stories/index.js
CHANGED
package/stories/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
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';\n\nexport const ActionMenuMarkup = ({\n ariaLabel = 'More Actions',\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = 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} = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=${ariaLabel}\n ?disabled=${disabled}\n ?open=${open}\n size=${size}\n @change=\"${changeHandler}\"\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n >\n ${customIcon ? customIcon : html``}\n ${visibleLabel\n ? html`\n <span slot=\"label\">${visibleLabel}</span>\n `\n : html``}\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};\n"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAA4B;AAErC,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,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AACf,IAAI,CAAC,MAAsB;AACvB,SAAO;AAAA;AAAA,oBAES;AAAA,wBACI;AAAA,oBACJ;AAAA,mBACD;AAAA,uBACI;AAAA,uBACA,UAAU,UAAU;AAAA,oBACvB,WAAW,mBAAmB;AAAA;AAAA,cAEpC,aAAa,aAAa;AAAA,cAC1B,eACI;AAAA,2CACyB;AAAA,sBAEzB;AAAA;AAAA,sCAEoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQtC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-action-menu.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/picker/sync/index.js';\nimport '../sp-action-menu.dev.js'\n"],
|
|
5
|
-
"mappings": "AAYA;
|
|
5
|
+
"mappings": ";AAYA,OAAO;AACP,OAAO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/sync/sp-action-menu.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-action-menu.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/picker/sync/index.js';\nimport '../sp-action-menu.js';\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "aAYA,MAAO,gDACP,MAAO",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu-sizes.test-vrt.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-menu-sizes.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionMenuSizesStories', stories);\n"],
|
|
5
|
-
"mappings": "AAYA;
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,0BAA0B,OAAO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import "@spectrum-web-components/action-menu/sync/sp-action-menu.js";
|
|
2
3
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
3
4
|
import "@spectrum-web-components/menu/sp-menu.js";
|
|
@@ -11,7 +12,8 @@ import {
|
|
|
11
12
|
oneEvent
|
|
12
13
|
} from "@open-wc/testing";
|
|
13
14
|
import { testForLitDevWarnings } from "../../../test/testing-helpers";
|
|
14
|
-
const deprecatedActionMenuFixture = async () => await fixture(
|
|
15
|
+
const deprecatedActionMenuFixture = async () => await fixture(
|
|
16
|
+
html`
|
|
15
17
|
<sp-action-menu label="More Actions">
|
|
16
18
|
<sp-menu>
|
|
17
19
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -23,8 +25,10 @@ const deprecatedActionMenuFixture = async () => await fixture(html`
|
|
|
23
25
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
24
26
|
</sp-menu>
|
|
25
27
|
</sp-action-menu>
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
+
`
|
|
29
|
+
);
|
|
30
|
+
const actionMenuFixture = async () => await fixture(
|
|
31
|
+
html`
|
|
28
32
|
<sp-action-menu label="More Actions">
|
|
29
33
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
30
34
|
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
@@ -34,7 +38,8 @@ const actionMenuFixture = async () => await fixture(html`
|
|
|
34
38
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
35
39
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
36
40
|
</sp-action-menu>
|
|
37
|
-
`
|
|
41
|
+
`
|
|
42
|
+
);
|
|
38
43
|
describe("Action menu", () => {
|
|
39
44
|
testForLitDevWarnings(async () => await actionMenuFixture());
|
|
40
45
|
it("loads", async () => {
|
|
@@ -44,7 +49,8 @@ describe("Action menu", () => {
|
|
|
44
49
|
await expect(el).to.be.accessible();
|
|
45
50
|
});
|
|
46
51
|
it('loads - [slot="label"]', async () => {
|
|
47
|
-
const el = await fixture(
|
|
52
|
+
const el = await fixture(
|
|
53
|
+
html`
|
|
48
54
|
<sp-action-menu>
|
|
49
55
|
<span slot="label">More Actions</span>
|
|
50
56
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -55,12 +61,14 @@ describe("Action menu", () => {
|
|
|
55
61
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
56
62
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
57
63
|
</sp-action-menu>
|
|
58
|
-
`
|
|
64
|
+
`
|
|
65
|
+
);
|
|
59
66
|
await elementUpdated(el);
|
|
60
67
|
await expect(el).to.be.accessible();
|
|
61
68
|
});
|
|
62
69
|
it("loads - [custom icon]", async () => {
|
|
63
|
-
const el = await fixture(
|
|
70
|
+
const el = await fixture(
|
|
71
|
+
html`
|
|
64
72
|
<sp-action-menu label="More Actions">
|
|
65
73
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
66
74
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -71,7 +79,8 @@ describe("Action menu", () => {
|
|
|
71
79
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
72
80
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
73
81
|
</sp-action-menu>
|
|
74
|
-
`
|
|
82
|
+
`
|
|
83
|
+
);
|
|
75
84
|
await elementUpdated(el);
|
|
76
85
|
await expect(el).to.be.accessible();
|
|
77
86
|
});
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu-sync.test.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/action-menu/sync/sp-action-menu.js';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n oneEvent,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers';\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\ndescribe('Action menu', () => {\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('stays `quiet`', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n\n el.quiet = false;\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 });\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 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 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 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 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 items = el.querySelectorAll('sp-menu-item');\n expect(items.length).to.equal(count);\n });\n});\n"],
|
|
5
|
-
"mappings": "AAYA;
|
|
5
|
+
"mappings": ";AAYA,OAAO;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,6BAA6B;AAEtC,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;AAAA;AAWJ;AAEJ,SAAS,eAAe,MAAM;AAC1B,wBAAsB,YAAY,MAAM,kBAAkB,CAAC;AAC3D,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,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V,UAAM;AAEN,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,YAAQ,GAAG,iBAAiB,cAAc;AAC1C,WAAO,MAAM,MAAM,EAAE,GAAG,MAAM,KAAK;AAEnC,aAAS,SAAS,IAAI,WAAW;AACjC,OAAG,OAAO;AACV,UAAM;AAEN,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,YAAQ,GAAG,iBAAiB,cAAc;AAC1C,WAAO,MAAM,MAAM,EAAE,GAAG,MAAM,CAAC;AAE/B,aAAS,SAAS,IAAI,WAAW;AACjC,OAAG,OAAO;AACV,UAAM;AAEN,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,YAAQ,GAAG,iBAAiB,cAAc;AAC1C,WAAO,MAAM,MAAM,EAAE,GAAG,MAAM,KAAK;AAAA,EACvC,CAAC;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu.test-vrt.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-menu.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionMenuStories', stories);\n"],
|
|
5
|
-
"mappings": "AAYA;
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,qBAAqB,OAAO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/action-menu.test.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
2
3
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
3
4
|
import "@spectrum-web-components/menu/sp-menu.js";
|
|
@@ -11,7 +12,8 @@ import {
|
|
|
11
12
|
oneEvent
|
|
12
13
|
} from "@open-wc/testing";
|
|
13
14
|
import { testForLitDevWarnings } from "../../../test/testing-helpers";
|
|
14
|
-
const deprecatedActionMenuFixture = async () => await fixture(
|
|
15
|
+
const deprecatedActionMenuFixture = async () => await fixture(
|
|
16
|
+
html`
|
|
15
17
|
<sp-action-menu label="More Actions">
|
|
16
18
|
<sp-menu>
|
|
17
19
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -23,8 +25,10 @@ const deprecatedActionMenuFixture = async () => await fixture(html`
|
|
|
23
25
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
24
26
|
</sp-menu>
|
|
25
27
|
</sp-action-menu>
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
+
`
|
|
29
|
+
);
|
|
30
|
+
const actionMenuFixture = async () => await fixture(
|
|
31
|
+
html`
|
|
28
32
|
<sp-action-menu label="More Actions">
|
|
29
33
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
30
34
|
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
@@ -34,8 +38,10 @@ const actionMenuFixture = async () => await fixture(html`
|
|
|
34
38
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
35
39
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
36
40
|
</sp-action-menu>
|
|
37
|
-
`
|
|
38
|
-
|
|
41
|
+
`
|
|
42
|
+
);
|
|
43
|
+
const actionSubmenuFixture = async () => await fixture(
|
|
44
|
+
html`
|
|
39
45
|
<sp-action-menu label="More Actions">
|
|
40
46
|
<sp-menu-item>One</sp-menu-item>
|
|
41
47
|
<sp-menu-item>Two</sp-menu-item>
|
|
@@ -50,7 +56,8 @@ const actionSubmenuFixture = async () => await fixture(html`
|
|
|
50
56
|
</sp-menu>
|
|
51
57
|
</sp-menu-item>
|
|
52
58
|
</sp-action-menu>
|
|
53
|
-
`
|
|
59
|
+
`
|
|
60
|
+
);
|
|
54
61
|
describe("Action menu", () => {
|
|
55
62
|
testForLitDevWarnings(async () => await actionMenuFixture());
|
|
56
63
|
it("loads", async () => {
|
|
@@ -60,7 +67,8 @@ describe("Action menu", () => {
|
|
|
60
67
|
await expect(el).to.be.accessible();
|
|
61
68
|
});
|
|
62
69
|
it('loads - [slot="label"]', async () => {
|
|
63
|
-
const el = await fixture(
|
|
70
|
+
const el = await fixture(
|
|
71
|
+
html`
|
|
64
72
|
<sp-action-menu>
|
|
65
73
|
<span slot="label">More Actions</span>
|
|
66
74
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -71,12 +79,14 @@ describe("Action menu", () => {
|
|
|
71
79
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
72
80
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
73
81
|
</sp-action-menu>
|
|
74
|
-
`
|
|
82
|
+
`
|
|
83
|
+
);
|
|
75
84
|
await elementUpdated(el);
|
|
76
85
|
await expect(el).to.be.accessible();
|
|
77
86
|
});
|
|
78
87
|
it("loads - [custom icon]", async () => {
|
|
79
|
-
const el = await fixture(
|
|
88
|
+
const el = await fixture(
|
|
89
|
+
html`
|
|
80
90
|
<sp-action-menu label="More Actions">
|
|
81
91
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
82
92
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -87,7 +97,8 @@ describe("Action menu", () => {
|
|
|
87
97
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
88
98
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
89
99
|
</sp-action-menu>
|
|
90
|
-
`
|
|
100
|
+
`
|
|
101
|
+
);
|
|
91
102
|
await elementUpdated(el);
|
|
92
103
|
await expect(el).to.be.accessible();
|
|
93
104
|
});
|
|
@@ -173,20 +184,29 @@ describe("Action menu", () => {
|
|
|
173
184
|
it("allows submenu items to be selected", async () => {
|
|
174
185
|
const root = await actionSubmenuFixture();
|
|
175
186
|
const menuItem = root.querySelector("#item-with-submenu");
|
|
176
|
-
const submenu = menuItem.querySelector(
|
|
177
|
-
|
|
187
|
+
const submenu = menuItem.querySelector(
|
|
188
|
+
'sp-menu[slot="submenu"]'
|
|
189
|
+
);
|
|
190
|
+
const selectedItem = submenu.querySelector(
|
|
191
|
+
"#selected-item"
|
|
192
|
+
);
|
|
178
193
|
expect(selectedItem.selected, "item is not initially selected").to.be.true;
|
|
179
194
|
let opened = oneEvent(root, "sp-opened");
|
|
180
195
|
root.click();
|
|
181
196
|
await opened;
|
|
182
197
|
expect(root.open).to.be.true;
|
|
183
198
|
opened = oneEvent(menuItem, "sp-opened");
|
|
184
|
-
menuItem.dispatchEvent(
|
|
199
|
+
menuItem.dispatchEvent(
|
|
200
|
+
new PointerEvent("pointerenter", { bubbles: true })
|
|
201
|
+
);
|
|
185
202
|
await opened;
|
|
186
203
|
const overlays = document.querySelectorAll("active-overlay");
|
|
187
204
|
expect(overlays.length).to.equal(2);
|
|
188
205
|
await elementUpdated(submenu);
|
|
189
|
-
expect(
|
|
206
|
+
expect(
|
|
207
|
+
selectedItem.selected,
|
|
208
|
+
"initially selected item is no longer selected"
|
|
209
|
+
).to.be.true;
|
|
190
210
|
});
|
|
191
211
|
});
|
|
192
212
|
//# sourceMappingURL=action-menu.test.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["action-menu.test.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n oneEvent,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers';\nimport type { MenuItem } from '@spectrum-web-components/menu/src/MenuItem.js';\nimport type { Menu } from '@spectrum-web-components/menu';\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>Two</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=\"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\ndescribe('Action menu', () => {\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('stays `quiet`', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n\n el.quiet = false;\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 });\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 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 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 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 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 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 '#selected-item'\n ) as MenuItem;\n\n expect(selectedItem.selected, 'item is not initially selected').to.be\n .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 is no longer selected'\n ).to.be.true;\n });\n});\n"],
|
|
5
|
-
"mappings": "AAYA;
|
|
5
|
+
"mappings": ";AAYA,OAAO;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,6BAA6B;AAItC,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;AAAA;AAWJ;AAEJ,MAAM,uBAAuB,YACzB,MAAM;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBJ;AAEJ,SAAS,eAAe,MAAM;AAC1B,wBAAsB,YAAY,MAAM,kBAAkB,CAA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C;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["test-basic.ts"],
|
|
4
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 '@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-divider.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-action-menu>\n <span slot=\"label\">\n Select a Country with a very long label, too long in fact\n </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"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAatB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|