@spectrum-web-components/action-menu 0.13.8-express.9 → 0.13.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +6 -6
- package/package.json +10 -10
- package/sp-action-menu.d.ts +0 -6
- package/sp-action-menu.js +0 -14
- package/sp-action-menu.js.map +0 -1
- package/src/ActionMenu.d.ts +0 -31
- package/src/ActionMenu.js +0 -88
- package/src/ActionMenu.js.map +0 -1
- package/src/action-menu.css.d.ts +0 -2
- package/src/action-menu.css.js +0 -17
- package/src/action-menu.css.js.map +0 -1
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -13
- package/src/index.js.map +0 -1
- package/stories/action-menu-sizes.stories.js +0 -12
- package/stories/action-menu-sizes.stories.js.map +0 -1
- package/stories/action-menu.stories.js +0 -77
- package/stories/action-menu.stories.js.map +0 -1
- package/stories/index.js +0 -44
- package/stories/index.js.map +0 -1
- package/sync/sp-action-menu.d.ts +0 -2
- package/sync/sp-action-menu.js +0 -14
- package/sync/sp-action-menu.js.map +0 -1
- package/test/action-menu-sizes.test-vrt.js +0 -15
- package/test/action-menu-sizes.test-vrt.js.map +0 -1
- package/test/action-menu-sync.test.js +0 -161
- package/test/action-menu-sync.test.js.map +0 -1
- package/test/action-menu.test-vrt.js +0 -15
- package/test/action-menu.test-vrt.js.map +0 -1
- package/test/action-menu.test.js +0 -161
- package/test/action-menu.test.js.map +0 -1
package/custom-elements.json
CHANGED
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "javascript-module",
|
|
22
|
+
"path": "sync/sp-action-menu.ts",
|
|
23
|
+
"declarations": [],
|
|
24
|
+
"exports": []
|
|
25
|
+
},
|
|
20
26
|
{
|
|
21
27
|
"kind": "javascript-module",
|
|
22
28
|
"path": "src/ActionMenu.ts",
|
|
@@ -159,12 +165,6 @@
|
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
167
|
]
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"kind": "javascript-module",
|
|
165
|
-
"path": "sync/sp-action-menu.ts",
|
|
166
|
-
"declarations": [],
|
|
167
|
-
"exports": []
|
|
168
168
|
}
|
|
169
169
|
]
|
|
170
170
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/action-menu",
|
|
3
|
-
"version": "0.13.8
|
|
3
|
+
"version": "0.13.8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"lit-html"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@spectrum-web-components/action-button": "^0.
|
|
50
|
-
"@spectrum-web-components/base": "^0.5.
|
|
51
|
-
"@spectrum-web-components/icon": "^0.11.4
|
|
52
|
-
"@spectrum-web-components/icons-workflow": "^0.8.4
|
|
53
|
-
"@spectrum-web-components/menu": "^0.12.2
|
|
54
|
-
"@spectrum-web-components/picker": "^0.10.3
|
|
55
|
-
"@spectrum-web-components/shared": "^0.13.
|
|
49
|
+
"@spectrum-web-components/action-button": "^0.8.0",
|
|
50
|
+
"@spectrum-web-components/base": "^0.5.3",
|
|
51
|
+
"@spectrum-web-components/icon": "^0.11.4",
|
|
52
|
+
"@spectrum-web-components/icons-workflow": "^0.8.4",
|
|
53
|
+
"@spectrum-web-components/menu": "^0.12.2",
|
|
54
|
+
"@spectrum-web-components/picker": "^0.10.3",
|
|
55
|
+
"@spectrum-web-components/shared": "^0.13.5",
|
|
56
56
|
"tslib": "^2.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@spectrum-css/actionmenu": "^3.0.
|
|
59
|
+
"@spectrum-css/actionmenu": "^3.0.18"
|
|
60
60
|
},
|
|
61
61
|
"types": "./src/index.d.ts",
|
|
62
62
|
"customElements": "custom-elements.json",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"./sp-*.js",
|
|
65
65
|
"./sync/sp-*.js"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "57aba8030b6af96af4015a0aa830e342a17dc219"
|
|
68
68
|
}
|
package/sp-action-menu.d.ts
DELETED
package/sp-action-menu.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { ActionMenu } from './src/ActionMenu.js';
|
|
13
|
-
customElements.define('sp-action-menu', ActionMenu);
|
|
14
|
-
//# sourceMappingURL=sp-action-menu.js.map
|
package/sp-action-menu.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sp-action-menu.js","sourceRoot":"","sources":["sp-action-menu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { 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"]}
|
package/src/ActionMenu.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
3
|
-
import '@spectrum-web-components/popover/sp-popover.js';
|
|
4
|
-
import { PickerBase } from '@spectrum-web-components/picker';
|
|
5
|
-
import '@spectrum-web-components/action-button/sp-action-button.js';
|
|
6
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';
|
|
7
|
-
declare const ActionMenu_base: typeof PickerBase & {
|
|
8
|
-
new (...args: any[]): import("@spectrum-web-components/shared/src/observe-slot-text.js").SlotTextObservingInterface;
|
|
9
|
-
prototype: import("@spectrum-web-components/shared/src/observe-slot-text.js").SlotTextObservingInterface;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* @element sp-action-menu
|
|
13
|
-
*
|
|
14
|
-
* @slot - menu items to be listed in the Action Menu
|
|
15
|
-
* @slot icon - The icon to use for Action Menu
|
|
16
|
-
* @slot label - The label to use on for the Action Menu
|
|
17
|
-
* @attr selects - By default `sp-action-menu` does not manage a selection. If
|
|
18
|
-
* you'd like for a selection to be held by the `sp-menu` that it presents in
|
|
19
|
-
* its overlay, use `selects="single" to activate this functionality.
|
|
20
|
-
*/
|
|
21
|
-
export declare class ActionMenu extends ActionMenu_base {
|
|
22
|
-
static get styles(): CSSResultArray;
|
|
23
|
-
selects: undefined | 'single';
|
|
24
|
-
protected listRole: 'listbox' | 'menu';
|
|
25
|
-
protected itemRole: string;
|
|
26
|
-
private get hasLabel();
|
|
27
|
-
protected get buttonContent(): TemplateResult[];
|
|
28
|
-
protected render(): TemplateResult;
|
|
29
|
-
protected updated(changedProperties: PropertyValues): void;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
package/src/ActionMenu.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { __decorate } from "tslib";
|
|
13
|
-
import { html, } from '@spectrum-web-components/base';
|
|
14
|
-
import { ifDefined } from '@spectrum-web-components/base/src/directives.js';
|
|
15
|
-
import { property } from '@spectrum-web-components/base/src/decorators.js';
|
|
16
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
17
|
-
import '@spectrum-web-components/popover/sp-popover.js';
|
|
18
|
-
import { PickerBase } from '@spectrum-web-components/picker';
|
|
19
|
-
import '@spectrum-web-components/action-button/sp-action-button.js';
|
|
20
|
-
import { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';
|
|
21
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';
|
|
22
|
-
import actionMenuStyles from './action-menu.css.js';
|
|
23
|
-
/**
|
|
24
|
-
* @element sp-action-menu
|
|
25
|
-
*
|
|
26
|
-
* @slot - menu items to be listed in the Action Menu
|
|
27
|
-
* @slot icon - The icon to use for Action Menu
|
|
28
|
-
* @slot label - The label to use on for the Action Menu
|
|
29
|
-
* @attr selects - By default `sp-action-menu` does not manage a selection. If
|
|
30
|
-
* you'd like for a selection to be held by the `sp-menu` that it presents in
|
|
31
|
-
* its overlay, use `selects="single" to activate this functionality.
|
|
32
|
-
*/
|
|
33
|
-
export class ActionMenu extends ObserveSlotText(PickerBase, 'label') {
|
|
34
|
-
constructor() {
|
|
35
|
-
super(...arguments);
|
|
36
|
-
this.selects = undefined;
|
|
37
|
-
this.listRole = 'menu';
|
|
38
|
-
this.itemRole = 'menuitem';
|
|
39
|
-
}
|
|
40
|
-
static get styles() {
|
|
41
|
-
return [actionMenuStyles];
|
|
42
|
-
}
|
|
43
|
-
get hasLabel() {
|
|
44
|
-
return this.slotHasContent;
|
|
45
|
-
}
|
|
46
|
-
get buttonContent() {
|
|
47
|
-
return [
|
|
48
|
-
html `
|
|
49
|
-
<slot name="icon" slot="icon" ?icon-only=${!this.hasLabel}>
|
|
50
|
-
<sp-icon-more class="icon"></sp-icon-more>
|
|
51
|
-
</slot>
|
|
52
|
-
<slot name="label" ?hidden=${!this.hasLabel}></slot>
|
|
53
|
-
`,
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
render() {
|
|
57
|
-
return html `
|
|
58
|
-
<sp-action-button
|
|
59
|
-
quiet
|
|
60
|
-
?selected=${this.open}
|
|
61
|
-
aria-haspopup="true"
|
|
62
|
-
aria-controls="popover"
|
|
63
|
-
aria-expanded=${this.open ? 'true' : 'false'}
|
|
64
|
-
aria-label=${ifDefined(this.label || undefined)}
|
|
65
|
-
id="button"
|
|
66
|
-
class="button"
|
|
67
|
-
size=${this.size}
|
|
68
|
-
@blur=${this.onButtonBlur}
|
|
69
|
-
@click=${this.onButtonClick}
|
|
70
|
-
@focus=${this.onButtonFocus}
|
|
71
|
-
?disabled=${this.disabled}
|
|
72
|
-
>
|
|
73
|
-
${this.buttonContent}
|
|
74
|
-
</sp-action-button>
|
|
75
|
-
`;
|
|
76
|
-
}
|
|
77
|
-
updated(changedProperties) {
|
|
78
|
-
super.updated(changedProperties);
|
|
79
|
-
if (changedProperties.has('invalid')) {
|
|
80
|
-
this.invalid = false;
|
|
81
|
-
}
|
|
82
|
-
this.quiet = true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
__decorate([
|
|
86
|
-
property({ type: String })
|
|
87
|
-
], ActionMenu.prototype, "selects", void 0);
|
|
88
|
-
//# sourceMappingURL=ActionMenu.js.map
|
package/src/ActionMenu.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.js","sourceRoot":"","sources":["ActionMenu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,GAGP,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,0CAA0C,CAAC;AAClD,OAAO,gDAAgD,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,4DAA4D,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAC3F,OAAO,+DAA+D,CAAC;AACvE,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,OAAO,UAAW,SAAQ,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC;IAApE;;QAMW,YAAO,GAAyB,SAAS,CAAC;QAEvC,aAAQ,GAAuB,MAAM,CAAC;QACtC,aAAQ,GAAG,UAAU,CAAC;IA6CpC,CAAC;IArDU,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9B,CAAC;IAOD,IAAY,QAAQ;QAChB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED,IAAc,aAAa;QACvB,OAAO;YACH,IAAI,CAAA;2DAC2C,CAAC,IAAI,CAAC,QAAQ;;;6CAG5B,CAAC,IAAI,CAAC,QAAQ;aAC9C;SACJ,CAAC;IACN,CAAC;IAES,MAAM;QACZ,OAAO,IAAI,CAAA;;;4BAGS,IAAI,CAAC,IAAI;;;gCAGL,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;6BAC/B,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;;;uBAGxC,IAAI,CAAC,IAAI;wBACR,IAAI,CAAC,YAAY;yBAChB,IAAI,CAAC,aAAa;yBAClB,IAAI,CAAC,aAAa;4BACf,IAAI,CAAC,QAAQ;;kBAEvB,IAAI,CAAC,aAAa;;SAE3B,CAAC;IACN,CAAC;IAES,OAAO,CAAC,iBAAiC;QAC/C,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACjC,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAClC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACxB;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;CACJ;AAhDG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACsB","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 '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/popover/sp-popover.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 get styles(): CSSResultArray {\n return [actionMenuStyles];\n }\n\n @property({ type: String })\n public selects: undefined | 'single' = undefined;\n\n protected listRole: 'listbox' | 'menu' = 'menu';\n protected itemRole = 'menuitem';\n private get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n protected 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 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 updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('invalid')) {\n this.invalid = false;\n }\n this.quiet = true;\n }\n}\n"]}
|
package/src/action-menu.css.d.ts
DELETED
package/src/action-menu.css.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { css } from '@spectrum-web-components/base';
|
|
13
|
-
const styles = css `
|
|
14
|
-
: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-left:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-icononly-padding-left-adjusted))*-1);margin-right:calc((var(--spectrum-actionbutton-textonly-padding-right-adjusted) - var(--spectrum-actionbutton-icononly-padding-right-adjusted))*-1)}
|
|
15
|
-
`;
|
|
16
|
-
export default styles;
|
|
17
|
-
//# sourceMappingURL=action-menu.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu.css.js","sourceRoot":"","sources":["action-menu.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;CAEjB,CAAC;AACF,eAAe,MAAM,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n: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-left:calc((var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-icononly-padding-left-adjusted))*-1);margin-right:calc((var(--spectrum-actionbutton-textonly-padding-right-adjusted) - var(--spectrum-actionbutton-icononly-padding-right-adjusted))*-1)}\n`;\nexport default styles;"]}
|
package/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ActionMenu.js';
|
package/src/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
export * from './ActionMenu.js';
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,cAAc,iBAAiB,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './ActionMenu.js';\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
2
|
-
import '@spectrum-web-components/menu/sp-menu-item.js';
|
|
3
|
-
import { ActionMenuMarkup } from './';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Action menu/Sizes',
|
|
6
|
-
component: 'sp-action-menu',
|
|
7
|
-
};
|
|
8
|
-
export const s = () => ActionMenuMarkup({ size: 's' });
|
|
9
|
-
export const m = () => ActionMenuMarkup({ size: 'm' });
|
|
10
|
-
export const l = () => ActionMenuMarkup({ size: 'l' });
|
|
11
|
-
export const xl = () => ActionMenuMarkup({ size: 'xl' });
|
|
12
|
-
//# sourceMappingURL=action-menu-sizes.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu-sizes.stories.js","sourceRoot":"","sources":["action-menu-sizes.stories.ts"],"names":[],"mappings":"AAaA,OAAO,0CAA0C,CAAC;AAClD,OAAO,+CAA+C,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAEtC,eAAe;IACX,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,gBAAgB;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,EAAE,GAAG,GAAmB,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC","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"]}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { html } from '@spectrum-web-components/base';
|
|
13
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
14
|
-
import '@spectrum-web-components/menu/sp-menu-item.js';
|
|
15
|
-
import { ActionMenuMarkup } from './';
|
|
16
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';
|
|
17
|
-
export default {
|
|
18
|
-
component: 'sp-action-menu',
|
|
19
|
-
title: 'Action menu',
|
|
20
|
-
argTypes: {
|
|
21
|
-
disabled: {
|
|
22
|
-
name: 'disabled',
|
|
23
|
-
type: { name: 'boolean', required: false },
|
|
24
|
-
description: 'Disable this control. It will not receive focus or events.',
|
|
25
|
-
table: {
|
|
26
|
-
type: { summary: 'boolean' },
|
|
27
|
-
defaultValue: { summary: false },
|
|
28
|
-
},
|
|
29
|
-
control: {
|
|
30
|
-
type: 'boolean',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
open: {
|
|
34
|
-
name: 'open',
|
|
35
|
-
type: { name: 'boolean', required: false },
|
|
36
|
-
description: 'Whether the menu is open or not.',
|
|
37
|
-
table: {
|
|
38
|
-
type: { summary: 'boolean' },
|
|
39
|
-
defaultValue: { summary: false },
|
|
40
|
-
},
|
|
41
|
-
control: 'boolean',
|
|
42
|
-
},
|
|
43
|
-
visibleLabel: {
|
|
44
|
-
name: 'Visible Label',
|
|
45
|
-
description: 'The placeholder content for the picker.',
|
|
46
|
-
type: { name: 'string', required: false },
|
|
47
|
-
table: {
|
|
48
|
-
type: { summary: 'string' },
|
|
49
|
-
defaultValue: { summary: '' },
|
|
50
|
-
},
|
|
51
|
-
control: 'text',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
args: {
|
|
55
|
-
visibleLabel: 'More Actions',
|
|
56
|
-
disabled: false,
|
|
57
|
-
open: false,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
const Template = (args = {}) => ActionMenuMarkup(args);
|
|
61
|
-
export const Default = (args = {}) => Template(args);
|
|
62
|
-
export const selects = (args = {}) => Template(Object.assign(Object.assign({}, args), { selects: 'single', selected: true }));
|
|
63
|
-
selects.args = {
|
|
64
|
-
open: true,
|
|
65
|
-
};
|
|
66
|
-
export const iconOnly = (args = {}) => Template(args);
|
|
67
|
-
iconOnly.args = {
|
|
68
|
-
visibleLabel: '',
|
|
69
|
-
};
|
|
70
|
-
export const customIcon = (args) => Template(args);
|
|
71
|
-
customIcon.args = {
|
|
72
|
-
customIcon: html `
|
|
73
|
-
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
74
|
-
`,
|
|
75
|
-
visibleLabel: '',
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=action-menu.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu.stories.js","sourceRoot":"","sources":["action-menu.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;A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F,MAAM,QAAQ,GAAG,CAAC,OAAkB,EAAE,EAAkB,EAAE,CACtD,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAE3B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAkB,EAAE,EAAkB,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAkB,EAAE,EAAkB,EAAE,CAC5D,QAAQ,iCACD,IAAI,KACP,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,IAAI,IAChB,CAAC;AACP,OAAO,CAAC,IAAI,GAAG;IACX,IAAI,EAAE,IAAI;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAkB,EAAE,EAAkB,EAAE,CAC7D,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnB,QAAQ,CAAC,IAAI,GAAG;IACZ,YAAY,EAAE,EAAE;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAe,EAAkB,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9E,UAAU,CAAC,IAAI,GAAG;IACd,UAAU,EAAE,IAAI,CAAA;;KAEf;IACD,YAAY,EAAE,EAAE;CACnB,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { 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"]}
|
package/stories/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { html } from '@spectrum-web-components/base';
|
|
13
|
-
import '../sp-action-menu.js';
|
|
14
|
-
import '@spectrum-web-components/icon/sp-icon.js';
|
|
15
|
-
import '@spectrum-web-components/menu/sp-menu-divider.js';
|
|
16
|
-
import '@spectrum-web-components/menu/sp-menu-item.js';
|
|
17
|
-
export const ActionMenuMarkup = ({ ariaLabel = 'More Actions', changeHandler = (() => undefined), disabled = false, open = false, visibleLabel = '', customIcon = '', size = 'm', selects = '', selected = false, } = {}) => {
|
|
18
|
-
return html `
|
|
19
|
-
<sp-action-menu
|
|
20
|
-
label=${ariaLabel}
|
|
21
|
-
?disabled=${disabled}
|
|
22
|
-
?open=${open}
|
|
23
|
-
size=${size}
|
|
24
|
-
@change="${changeHandler}"
|
|
25
|
-
.selects=${selects ? selects : undefined}
|
|
26
|
-
value=${selected ? 'Select Inverse' : ''}
|
|
27
|
-
>
|
|
28
|
-
${customIcon ? customIcon : html ``}
|
|
29
|
-
${visibleLabel
|
|
30
|
-
? html `
|
|
31
|
-
<span slot="label">${visibleLabel}</span>
|
|
32
|
-
`
|
|
33
|
-
: html ``}
|
|
34
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
35
|
-
<sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>
|
|
36
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
37
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
38
|
-
<sp-menu-divider></sp-menu-divider>
|
|
39
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
40
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
41
|
-
</sp-action-menu>
|
|
42
|
-
`;
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
package/stories/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AAErE,OAAO,sBAAsB,CAAC;AAC9B,OAAO,0CAA0C,CAAC;AAClD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,+CAA+C,CAAC;AAEvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC7B,SAAS,GAAG,cAAc,EAC1B,aAAa,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAA2B,EAC3D,QAAQ,GAAG,KAAK,EAChB,IAAI,GAAG,KAAK,EACZ,YAAY,GAAG,EAAE,EACjB,UAAU,GAAG,EAA6B,EAC1C,IAAI,GAAG,GAAqC,EAC5C,OAAO,GAAG,EAAc,EACxB,QAAQ,GAAG,KAAK,MAChB,EAAE,EAAkB,EAAE;IACtB,OAAO,IAAI,CAAA;;oBAEK,SAAS;wBACL,QAAQ;oBACZ,IAAI;mBACL,IAAI;uBACA,aAAa;uBACb,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;oBAChC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE;;cAEtC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,EAAE;cAChC,YAAY;QACV,CAAC,CAAC,IAAI,CAAA;2CACqB,YAAY;mBACpC;QACH,CAAC,CAAC,IAAI,CAAA,EAAE;;sCAEc,QAAQ;;;;;;;KAOzC,CAAC;AACN,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '../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"]}
|
package/sync/sp-action-menu.d.ts
DELETED
package/sync/sp-action-menu.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import '@spectrum-web-components/picker/sync/index.js';
|
|
13
|
-
import '../sp-action-menu.js';
|
|
14
|
-
//# sourceMappingURL=sp-action-menu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sp-action-menu.js","sourceRoot":"","sources":["sp-action-menu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,+CAA+C,CAAC;AACvD,OAAO,sBAAsB,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/picker/sync/index.js';\nimport '../sp-action-menu.js';\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import * as stories from '../stories/action-menu-sizes.stories.js';
|
|
13
|
-
import { regressVisuals } from '../../../test/visual/test.js';
|
|
14
|
-
regressVisuals('ActionMenuSizesStories', stories);
|
|
15
|
-
//# sourceMappingURL=action-menu-sizes.test-vrt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu-sizes.test-vrt.js","sourceRoot":"","sources":["action-menu-sizes.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-menu-sizes.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionMenuSizesStories', stories);\n"]}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import '@spectrum-web-components/action-menu/sync/sp-action-menu.js';
|
|
13
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';
|
|
14
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
15
|
-
import '@spectrum-web-components/menu/sp-menu-item.js';
|
|
16
|
-
import '@spectrum-web-components/menu/sp-menu-divider.js';
|
|
17
|
-
import { elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing';
|
|
18
|
-
const deprecatedActionMenuFixture = async () => await fixture(html `
|
|
19
|
-
<sp-action-menu label="More Actions">
|
|
20
|
-
<sp-menu>
|
|
21
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
22
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
23
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
24
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
25
|
-
<sp-menu-divider></sp-menu-divider>
|
|
26
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
27
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
28
|
-
</sp-menu>
|
|
29
|
-
</sp-action-menu>
|
|
30
|
-
`);
|
|
31
|
-
const actionMenuFixture = async () => await fixture(html `
|
|
32
|
-
<sp-action-menu label="More Actions">
|
|
33
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
34
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
35
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
36
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
37
|
-
<sp-menu-divider></sp-menu-divider>
|
|
38
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
39
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
40
|
-
</sp-action-menu>
|
|
41
|
-
`);
|
|
42
|
-
describe('Action menu', () => {
|
|
43
|
-
it('loads', async () => {
|
|
44
|
-
const el = await actionMenuFixture();
|
|
45
|
-
await elementUpdated(el);
|
|
46
|
-
expect(el).to.not.be.undefined;
|
|
47
|
-
await expect(el).to.be.accessible();
|
|
48
|
-
});
|
|
49
|
-
it('loads - [slot="label"]', async () => {
|
|
50
|
-
const el = await fixture(html `
|
|
51
|
-
<sp-action-menu>
|
|
52
|
-
<span slot="label">More Actions</span>
|
|
53
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
54
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
55
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
56
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
57
|
-
<sp-menu-divider></sp-menu-divider>
|
|
58
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
59
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
60
|
-
</sp-action-menu>
|
|
61
|
-
`);
|
|
62
|
-
await elementUpdated(el);
|
|
63
|
-
await expect(el).to.be.accessible();
|
|
64
|
-
});
|
|
65
|
-
it('loads - [custom icon]', async () => {
|
|
66
|
-
const el = await fixture(html `
|
|
67
|
-
<sp-action-menu label="More Actions">
|
|
68
|
-
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
69
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
70
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
71
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
72
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
73
|
-
<sp-menu-divider></sp-menu-divider>
|
|
74
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
75
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
76
|
-
</sp-action-menu>
|
|
77
|
-
`);
|
|
78
|
-
await elementUpdated(el);
|
|
79
|
-
await expect(el).to.be.accessible();
|
|
80
|
-
});
|
|
81
|
-
it('stays `quiet`', async () => {
|
|
82
|
-
const el = await actionMenuFixture();
|
|
83
|
-
await elementUpdated(el);
|
|
84
|
-
expect(el.quiet).to.be.true;
|
|
85
|
-
el.quiet = false;
|
|
86
|
-
await elementUpdated(el);
|
|
87
|
-
expect(el.quiet).to.be.true;
|
|
88
|
-
});
|
|
89
|
-
it('stay `valid`', async () => {
|
|
90
|
-
const el = await actionMenuFixture();
|
|
91
|
-
await elementUpdated(el);
|
|
92
|
-
expect(el.invalid).to.be.false;
|
|
93
|
-
el.invalid = true;
|
|
94
|
-
await elementUpdated(el);
|
|
95
|
-
expect(el.invalid).to.be.false;
|
|
96
|
-
});
|
|
97
|
-
it('focus()', async () => {
|
|
98
|
-
const el = await actionMenuFixture();
|
|
99
|
-
await elementUpdated(el);
|
|
100
|
-
el.focus();
|
|
101
|
-
expect(document.activeElement).to.equal(el);
|
|
102
|
-
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
103
|
-
const opened = oneEvent(el, 'sp-opened');
|
|
104
|
-
el.open = true;
|
|
105
|
-
await opened;
|
|
106
|
-
expect(document.activeElement).to.not.equal(el);
|
|
107
|
-
const closed = oneEvent(el, 'sp-closed');
|
|
108
|
-
el.open = false;
|
|
109
|
-
await closed;
|
|
110
|
-
expect(document.activeElement).to.equal(el);
|
|
111
|
-
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
112
|
-
});
|
|
113
|
-
it('opens unmeasured', async () => {
|
|
114
|
-
const el = await actionMenuFixture();
|
|
115
|
-
await elementUpdated(el);
|
|
116
|
-
const button = el.button;
|
|
117
|
-
button.click();
|
|
118
|
-
await elementUpdated(el);
|
|
119
|
-
expect(el.open).to.be.true;
|
|
120
|
-
});
|
|
121
|
-
it('opens unmeasured with deprecated syntax', async () => {
|
|
122
|
-
const el = await deprecatedActionMenuFixture();
|
|
123
|
-
await elementUpdated(el);
|
|
124
|
-
const button = el.button;
|
|
125
|
-
button.click();
|
|
126
|
-
await elementUpdated(el);
|
|
127
|
-
expect(el.open).to.be.true;
|
|
128
|
-
});
|
|
129
|
-
it('toggles open/close multiple time', async () => {
|
|
130
|
-
const el = await actionMenuFixture();
|
|
131
|
-
await elementUpdated(el);
|
|
132
|
-
let items = el.querySelectorAll('sp-menu-item');
|
|
133
|
-
const count = items.length;
|
|
134
|
-
expect(items.length).to.equal(count);
|
|
135
|
-
let opened = oneEvent(el, 'sp-opened');
|
|
136
|
-
el.open = true;
|
|
137
|
-
await opened;
|
|
138
|
-
expect(el.open).to.be.true;
|
|
139
|
-
items = el.querySelectorAll('sp-menu-item');
|
|
140
|
-
expect(items.length).to.equal(0);
|
|
141
|
-
let closed = oneEvent(el, 'sp-closed');
|
|
142
|
-
el.open = false;
|
|
143
|
-
await closed;
|
|
144
|
-
expect(el.open).to.be.false;
|
|
145
|
-
items = el.querySelectorAll('sp-menu-item');
|
|
146
|
-
expect(items.length).to.equal(count);
|
|
147
|
-
opened = oneEvent(el, 'sp-opened');
|
|
148
|
-
el.open = true;
|
|
149
|
-
await opened;
|
|
150
|
-
expect(el.open).to.be.true;
|
|
151
|
-
items = el.querySelectorAll('sp-menu-item');
|
|
152
|
-
expect(items.length).to.equal(0);
|
|
153
|
-
closed = oneEvent(el, 'sp-closed');
|
|
154
|
-
el.open = false;
|
|
155
|
-
await closed;
|
|
156
|
-
expect(el.open).to.be.false;
|
|
157
|
-
items = el.querySelectorAll('sp-menu-item');
|
|
158
|
-
expect(items.length).to.equal(count);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
//# sourceMappingURL=action-menu-sync.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu-sync.test.js","sourceRoot":"","sources":["action-menu-sync.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,6DAA6D,CAAC;AAErE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,0CAA0C,CAAC;AAClD,OAAO,+CAA+C,CAAC;AACvD,OAAO,kDAAkD,CAAC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C,KAAK,CAAC,KAAK,CAAC,CAAC;QAErC,MAAM,GAAG,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACnC,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC;QACf,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC3B,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEjC,MAAM,GAAG,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACnC,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC;QAChB,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAC5B,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@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 { elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing';\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 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"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import * as stories from '../stories/action-menu.stories.js';
|
|
13
|
-
import { regressVisuals } from '../../../test/visual/test.js';
|
|
14
|
-
regressVisuals('ActionMenuStories', stories);
|
|
15
|
-
//# sourceMappingURL=action-menu.test-vrt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu.test-vrt.js","sourceRoot":"","sources":["action-menu.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-menu.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionMenuStories', stories);\n"]}
|
package/test/action-menu.test.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import '@spectrum-web-components/action-menu/sp-action-menu.js';
|
|
13
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';
|
|
14
|
-
import '@spectrum-web-components/menu/sp-menu.js';
|
|
15
|
-
import '@spectrum-web-components/menu/sp-menu-item.js';
|
|
16
|
-
import '@spectrum-web-components/menu/sp-menu-divider.js';
|
|
17
|
-
import { elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing';
|
|
18
|
-
const deprecatedActionMenuFixture = async () => await fixture(html `
|
|
19
|
-
<sp-action-menu label="More Actions">
|
|
20
|
-
<sp-menu>
|
|
21
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
22
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
23
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
24
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
25
|
-
<sp-menu-divider></sp-menu-divider>
|
|
26
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
27
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
28
|
-
</sp-menu>
|
|
29
|
-
</sp-action-menu>
|
|
30
|
-
`);
|
|
31
|
-
const actionMenuFixture = async () => await fixture(html `
|
|
32
|
-
<sp-action-menu label="More Actions">
|
|
33
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
34
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
35
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
36
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
37
|
-
<sp-menu-divider></sp-menu-divider>
|
|
38
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
39
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
40
|
-
</sp-action-menu>
|
|
41
|
-
`);
|
|
42
|
-
describe('Action menu', () => {
|
|
43
|
-
it('loads', async () => {
|
|
44
|
-
const el = await actionMenuFixture();
|
|
45
|
-
await elementUpdated(el);
|
|
46
|
-
expect(el).to.not.be.undefined;
|
|
47
|
-
await expect(el).to.be.accessible();
|
|
48
|
-
});
|
|
49
|
-
it('loads - [slot="label"]', async () => {
|
|
50
|
-
const el = await fixture(html `
|
|
51
|
-
<sp-action-menu>
|
|
52
|
-
<span slot="label">More Actions</span>
|
|
53
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
54
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
55
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
56
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
57
|
-
<sp-menu-divider></sp-menu-divider>
|
|
58
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
59
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
60
|
-
</sp-action-menu>
|
|
61
|
-
`);
|
|
62
|
-
await elementUpdated(el);
|
|
63
|
-
await expect(el).to.be.accessible();
|
|
64
|
-
});
|
|
65
|
-
it('loads - [custom icon]', async () => {
|
|
66
|
-
const el = await fixture(html `
|
|
67
|
-
<sp-action-menu label="More Actions">
|
|
68
|
-
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
69
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
70
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
71
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
72
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
73
|
-
<sp-menu-divider></sp-menu-divider>
|
|
74
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
75
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
76
|
-
</sp-action-menu>
|
|
77
|
-
`);
|
|
78
|
-
await elementUpdated(el);
|
|
79
|
-
await expect(el).to.be.accessible();
|
|
80
|
-
});
|
|
81
|
-
it('stays `quiet`', async () => {
|
|
82
|
-
const el = await actionMenuFixture();
|
|
83
|
-
await elementUpdated(el);
|
|
84
|
-
expect(el.quiet).to.be.true;
|
|
85
|
-
el.quiet = false;
|
|
86
|
-
await elementUpdated(el);
|
|
87
|
-
expect(el.quiet).to.be.true;
|
|
88
|
-
});
|
|
89
|
-
it('stay `valid`', async () => {
|
|
90
|
-
const el = await actionMenuFixture();
|
|
91
|
-
await elementUpdated(el);
|
|
92
|
-
expect(el.invalid).to.be.false;
|
|
93
|
-
el.invalid = true;
|
|
94
|
-
await elementUpdated(el);
|
|
95
|
-
expect(el.invalid).to.be.false;
|
|
96
|
-
});
|
|
97
|
-
it('focus()', async () => {
|
|
98
|
-
const el = await actionMenuFixture();
|
|
99
|
-
await elementUpdated(el);
|
|
100
|
-
el.focus();
|
|
101
|
-
expect(document.activeElement).to.equal(el);
|
|
102
|
-
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
103
|
-
const opened = oneEvent(el, 'sp-opened');
|
|
104
|
-
el.open = true;
|
|
105
|
-
await opened;
|
|
106
|
-
expect(document.activeElement).to.not.equal(el);
|
|
107
|
-
const closed = oneEvent(el, 'sp-closed');
|
|
108
|
-
el.open = false;
|
|
109
|
-
await closed;
|
|
110
|
-
expect(document.activeElement).to.equal(el);
|
|
111
|
-
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
112
|
-
});
|
|
113
|
-
it('opens unmeasured', async () => {
|
|
114
|
-
const el = await actionMenuFixture();
|
|
115
|
-
await elementUpdated(el);
|
|
116
|
-
const button = el.button;
|
|
117
|
-
button.click();
|
|
118
|
-
await elementUpdated(el);
|
|
119
|
-
expect(el.open).to.be.true;
|
|
120
|
-
});
|
|
121
|
-
it('opens unmeasured with deprecated syntax', async () => {
|
|
122
|
-
const el = await deprecatedActionMenuFixture();
|
|
123
|
-
await elementUpdated(el);
|
|
124
|
-
const button = el.button;
|
|
125
|
-
button.click();
|
|
126
|
-
await elementUpdated(el);
|
|
127
|
-
expect(el.open).to.be.true;
|
|
128
|
-
});
|
|
129
|
-
it('toggles open/close multiple time', async () => {
|
|
130
|
-
const el = await actionMenuFixture();
|
|
131
|
-
await elementUpdated(el);
|
|
132
|
-
let items = el.querySelectorAll('sp-menu-item');
|
|
133
|
-
const count = items.length;
|
|
134
|
-
expect(items.length).to.equal(count);
|
|
135
|
-
let opened = oneEvent(el, 'sp-opened');
|
|
136
|
-
el.open = true;
|
|
137
|
-
await opened;
|
|
138
|
-
expect(el.open).to.be.true;
|
|
139
|
-
items = el.querySelectorAll('sp-menu-item');
|
|
140
|
-
expect(items.length).to.equal(0);
|
|
141
|
-
let closed = oneEvent(el, 'sp-closed');
|
|
142
|
-
el.open = false;
|
|
143
|
-
await closed;
|
|
144
|
-
expect(el.open).to.be.false;
|
|
145
|
-
items = el.querySelectorAll('sp-menu-item');
|
|
146
|
-
expect(items.length).to.equal(count);
|
|
147
|
-
opened = oneEvent(el, 'sp-opened');
|
|
148
|
-
el.open = true;
|
|
149
|
-
await opened;
|
|
150
|
-
expect(el.open).to.be.true;
|
|
151
|
-
items = el.querySelectorAll('sp-menu-item');
|
|
152
|
-
expect(items.length).to.equal(0);
|
|
153
|
-
closed = oneEvent(el, 'sp-closed');
|
|
154
|
-
el.open = false;
|
|
155
|
-
await closed;
|
|
156
|
-
expect(el.open).to.be.false;
|
|
157
|
-
items = el.querySelectorAll('sp-menu-item');
|
|
158
|
-
expect(items.length).to.equal(count);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
//# sourceMappingURL=action-menu.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu.test.js","sourceRoot":"","sources":["action-menu.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,wDAAwD,CAAC;AAEhE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,0CAA0C,CAAC;AAClD,OAAO,+CAA+C,CAAC;AACvD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEnF,MAAM,2BAA2B,GAAG,KAAK,IAAyB,EAAE,CAChE,MAAM,OAAO,CACT,IAAI,CAAA;;;;;;;;;;;;SAYH,CACJ,CAAC;AAEN,MAAM,iBAAiB,GAAG,KAAK,IAAyB,EAAE,CACtD,MAAM,OAAO,CACT,IAAI,CAAA;;;;;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CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEjC,MAAM,GAAG,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACnC,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC;QAChB,MAAM,MAAM,CAAC;QAEb,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAC5B,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@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 { elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing';\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 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"]}
|