@spectrum-web-components/action-menu 0.15.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 +4 -4
- package/sp-action-menu.dev.js +1 -0
- package/sp-action-menu.dev.js.map +1 -1
- package/sp-action-menu.js +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +12 -1
- package/stories/action-menu-sizes.stories.js.map +1 -1
- package/stories/action-menu.stories.js +72 -2
- package/stories/action-menu.stories.js.map +1 -1
- package/stories/index.js +31 -13
- 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 -1
- package/sync/sp-action-menu.js.map +1 -1
- package/test/action-menu-sizes.test-vrt.js +4 -1
- package/test/action-menu-sizes.test-vrt.js.map +1 -1
- package/test/action-menu-sync.test.js +126 -5
- package/test/action-menu-sync.test.js.map +1 -1
- package/test/action-menu.test-vrt.js +4 -1
- package/test/action-menu.test-vrt.js.map +1 -1
- package/test/action-menu.test.js +157 -6
- package/test/action-menu.test.js.map +1 -1
- package/test/benchmark/test-basic.js +8 -1
- 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.15.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"lit-html"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@spectrum-web-components/action-button": "^0.10.
|
|
64
|
+
"@spectrum-web-components/action-button": "^0.10.1",
|
|
65
65
|
"@spectrum-web-components/base": "^0.7.0",
|
|
66
66
|
"@spectrum-web-components/icon": "^0.12.0",
|
|
67
67
|
"@spectrum-web-components/icons-workflow": "^0.9.0",
|
|
68
|
-
"@spectrum-web-components/picker": "^0.13.
|
|
68
|
+
"@spectrum-web-components/picker": "^0.13.1",
|
|
69
69
|
"@spectrum-web-components/shared": "^0.15.0",
|
|
70
70
|
"tslib": "^2.0.0"
|
|
71
71
|
},
|
|
@@ -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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ActionMenu as e}from"./src/ActionMenu.js";customElements.define("sp-action-menu",e);
|
|
1
|
+
"use strict";import{ActionMenu as e}from"./src/ActionMenu.js";customElements.define("sp-action-menu",e);
|
|
2
2
|
//# sourceMappingURL=sp-action-menu.js.map
|
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,4 +1,4 @@
|
|
|
1
|
-
var u=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var n=(
|
|
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`
|
|
2
2
|
<slot name="icon" slot="icon" ?icon-only=${!this.hasLabel}>
|
|
3
3
|
<sp-icon-more class="icon"></sp-icon-more>
|
|
4
4
|
</slot>
|
|
@@ -21,5 +21,5 @@ var u=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var n=(i,e,r,o
|
|
|
21
21
|
>
|
|
22
22
|
${this.buttonContent}
|
|
23
23
|
</sp-action-button>
|
|
24
|
-
`}update(
|
|
24
|
+
`}update(t){t.has("invalid")&&(this.invalid=!1),this.quiet=!0,super.update(t)}}n([c({type:String})],ActionMenu.prototype,"selects",2);
|
|
25
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,4 +1,4 @@
|
|
|
1
|
-
import{css as t}from"@spectrum-web-components/base";const o=t`
|
|
1
|
+
"use strict";import{css as t}from"@spectrum-web-components/base";const o=t`
|
|
2
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(
|
|
3
3
|
--custom-actionbutton-edge-to-text,
|
|
4
4
|
var(--spectrum-actionbutton-edge-to-text)
|
|
@@ -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*from"./ActionMenu.js";
|
|
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
|
}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
3
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
4
|
+
import { ActionMenuMarkup } from "./";
|
|
5
|
+
export default {
|
|
6
|
+
title: "Action menu/Sizes",
|
|
7
|
+
component: "sp-action-menu"
|
|
8
|
+
};
|
|
9
|
+
export const s = () => ActionMenuMarkup({ size: "s" });
|
|
10
|
+
export const m = () => ActionMenuMarkup({ size: "m" });
|
|
11
|
+
export const l = () => ActionMenuMarkup({ size: "l" });
|
|
12
|
+
export const xl = () => ActionMenuMarkup({ size: "xl" });
|
|
2
13
|
//# sourceMappingURL=action-menu-sizes.stories.js.map
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
5
|
+
import { ActionMenuMarkup } from "./";
|
|
6
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
7
|
+
export default {
|
|
8
|
+
component: "sp-action-menu",
|
|
9
|
+
title: "Action menu",
|
|
10
|
+
argTypes: {
|
|
11
|
+
disabled: {
|
|
12
|
+
name: "disabled",
|
|
13
|
+
type: { name: "boolean", required: false },
|
|
14
|
+
description: "Disable this control. It will not receive focus or events.",
|
|
15
|
+
table: {
|
|
16
|
+
type: { summary: "boolean" },
|
|
17
|
+
defaultValue: { summary: false }
|
|
18
|
+
},
|
|
19
|
+
control: {
|
|
20
|
+
type: "boolean"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
open: {
|
|
24
|
+
name: "open",
|
|
25
|
+
type: { name: "boolean", required: false },
|
|
26
|
+
description: "Whether the menu is open or not.",
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: "boolean" },
|
|
29
|
+
defaultValue: { summary: false }
|
|
30
|
+
},
|
|
31
|
+
control: "boolean"
|
|
32
|
+
},
|
|
33
|
+
visibleLabel: {
|
|
34
|
+
name: "Visible Label",
|
|
35
|
+
description: "The placeholder content for the picker.",
|
|
36
|
+
type: { name: "string", required: false },
|
|
37
|
+
table: {
|
|
38
|
+
type: { summary: "string" },
|
|
39
|
+
defaultValue: { summary: "" }
|
|
40
|
+
},
|
|
41
|
+
control: "text"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
args: {
|
|
45
|
+
visibleLabel: "More Actions",
|
|
46
|
+
disabled: false,
|
|
47
|
+
open: false
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const Template = (args = {}) => ActionMenuMarkup(args);
|
|
51
|
+
export const Default = (args = {}) => Template(args);
|
|
52
|
+
export const selects = (args = {}) => Template({
|
|
53
|
+
...args,
|
|
54
|
+
selects: "single",
|
|
55
|
+
selected: true
|
|
56
|
+
});
|
|
57
|
+
selects.args = {
|
|
58
|
+
open: true
|
|
59
|
+
};
|
|
60
|
+
export const iconOnly = (args = {}) => Template(args);
|
|
61
|
+
iconOnly.args = {
|
|
62
|
+
visibleLabel: ""
|
|
63
|
+
};
|
|
64
|
+
export const customIcon = (args) => Template(args);
|
|
65
|
+
customIcon.args = {
|
|
66
|
+
customIcon: html`
|
|
2
67
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
3
|
-
`,
|
|
68
|
+
`,
|
|
69
|
+
visibleLabel: ""
|
|
70
|
+
};
|
|
71
|
+
export const submenu = () => {
|
|
72
|
+
return html`
|
|
4
73
|
<sp-action-menu label="More Actions">
|
|
5
74
|
<sp-menu-item>One</sp-menu-item>
|
|
6
75
|
<sp-menu-item>Two</sp-menu-item>
|
|
@@ -14,4 +83,5 @@ import{html as s}from"@spectrum-web-components/base";import"@spectrum-web-compon
|
|
|
14
83
|
</sp-menu-item>
|
|
15
84
|
</sp-action-menu>
|
|
16
85
|
`;
|
|
86
|
+
};
|
|
17
87
|
//# sourceMappingURL=action-menu.stories.js.map
|
|
@@ -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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,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
|
@@ -1,19 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
4
|
+
import "@spectrum-web-components/icon/sp-icon.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
6
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
7
|
+
export const ActionMenuMarkup = ({
|
|
8
|
+
ariaLabel = "More Actions",
|
|
9
|
+
changeHandler = () => void 0,
|
|
10
|
+
disabled = false,
|
|
11
|
+
open = false,
|
|
12
|
+
visibleLabel = "",
|
|
13
|
+
customIcon = "",
|
|
14
|
+
size = "m",
|
|
15
|
+
selects = "",
|
|
16
|
+
selected = false
|
|
17
|
+
} = {}) => {
|
|
18
|
+
return html`
|
|
2
19
|
<sp-action-menu
|
|
3
|
-
label=${
|
|
4
|
-
?disabled=${
|
|
5
|
-
?open=${
|
|
6
|
-
size=${
|
|
7
|
-
@change="${
|
|
8
|
-
.selects=${
|
|
9
|
-
value=${
|
|
20
|
+
label=${ariaLabel}
|
|
21
|
+
?disabled=${disabled}
|
|
22
|
+
?open=${open}
|
|
23
|
+
size=${size}
|
|
24
|
+
@change="${changeHandler}"
|
|
25
|
+
.selects=${selects ? selects : void 0}
|
|
26
|
+
value=${selected ? "Select Inverse" : ""}
|
|
10
27
|
>
|
|
11
|
-
${
|
|
12
|
-
${
|
|
13
|
-
<span slot="label">${
|
|
14
|
-
|
|
28
|
+
${customIcon ? customIcon : html``}
|
|
29
|
+
${visibleLabel ? html`
|
|
30
|
+
<span slot="label">${visibleLabel}</span>
|
|
31
|
+
` : html``}
|
|
15
32
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
16
|
-
<sp-menu-item ?selected=${
|
|
33
|
+
<sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>
|
|
17
34
|
<sp-menu-item>Feather...</sp-menu-item>
|
|
18
35
|
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
19
36
|
<sp-menu-divider></sp-menu-divider>
|
|
@@ -21,4 +38,5 @@ import{html as e}from"@spectrum-web-components/base";import"@spectrum-web-compon
|
|
|
21
38
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
22
39
|
</sp-action-menu>
|
|
23
40
|
`;
|
|
41
|
+
};
|
|
24
42
|
//# sourceMappingURL=index.js.map
|
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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"@spectrum-web-components/picker/sync/index.js";import"../sp-action-menu.js";
|
|
1
|
+
"use strict";import"@spectrum-web-components/picker/sync/index.js";import"../sp-action-menu.js";
|
|
2
2
|
//# sourceMappingURL=sp-action-menu.js.map
|
|
@@ -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
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as stories from "../stories/action-menu-sizes.stories.js";
|
|
3
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
4
|
+
regressVisuals("ActionMenuSizesStories", stories);
|
|
2
5
|
//# sourceMappingURL=action-menu-sizes.test-vrt.js.map
|
|
@@ -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,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sync/sp-action-menu.js";
|
|
3
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
6
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
7
|
+
import {
|
|
8
|
+
elementUpdated,
|
|
9
|
+
expect,
|
|
10
|
+
fixture,
|
|
11
|
+
html,
|
|
12
|
+
oneEvent
|
|
13
|
+
} from "@open-wc/testing";
|
|
14
|
+
import { testForLitDevWarnings } from "../../../test/testing-helpers";
|
|
15
|
+
const deprecatedActionMenuFixture = async () => await fixture(
|
|
16
|
+
html`
|
|
2
17
|
<sp-action-menu label="More Actions">
|
|
3
18
|
<sp-menu>
|
|
4
19
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -10,7 +25,10 @@ import"@spectrum-web-components/action-menu/sync/sp-action-menu.js";import"@spec
|
|
|
10
25
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
11
26
|
</sp-menu>
|
|
12
27
|
</sp-action-menu>
|
|
13
|
-
`
|
|
28
|
+
`
|
|
29
|
+
);
|
|
30
|
+
const actionMenuFixture = async () => await fixture(
|
|
31
|
+
html`
|
|
14
32
|
<sp-action-menu label="More Actions">
|
|
15
33
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
16
34
|
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
@@ -20,7 +38,19 @@ import"@spectrum-web-components/action-menu/sync/sp-action-menu.js";import"@spec
|
|
|
20
38
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
21
39
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
22
40
|
</sp-action-menu>
|
|
23
|
-
`
|
|
41
|
+
`
|
|
42
|
+
);
|
|
43
|
+
describe("Action menu", () => {
|
|
44
|
+
testForLitDevWarnings(async () => await actionMenuFixture());
|
|
45
|
+
it("loads", async () => {
|
|
46
|
+
const el = await actionMenuFixture();
|
|
47
|
+
await elementUpdated(el);
|
|
48
|
+
expect(el).to.not.be.undefined;
|
|
49
|
+
await expect(el).to.be.accessible();
|
|
50
|
+
});
|
|
51
|
+
it('loads - [slot="label"]', async () => {
|
|
52
|
+
const el = await fixture(
|
|
53
|
+
html`
|
|
24
54
|
<sp-action-menu>
|
|
25
55
|
<span slot="label">More Actions</span>
|
|
26
56
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -31,7 +61,14 @@ import"@spectrum-web-components/action-menu/sync/sp-action-menu.js";import"@spec
|
|
|
31
61
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
32
62
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
33
63
|
</sp-action-menu>
|
|
34
|
-
`
|
|
64
|
+
`
|
|
65
|
+
);
|
|
66
|
+
await elementUpdated(el);
|
|
67
|
+
await expect(el).to.be.accessible();
|
|
68
|
+
});
|
|
69
|
+
it("loads - [custom icon]", async () => {
|
|
70
|
+
const el = await fixture(
|
|
71
|
+
html`
|
|
35
72
|
<sp-action-menu label="More Actions">
|
|
36
73
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
37
74
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -42,5 +79,89 @@ import"@spectrum-web-components/action-menu/sync/sp-action-menu.js";import"@spec
|
|
|
42
79
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
43
80
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
44
81
|
</sp-action-menu>
|
|
45
|
-
`
|
|
82
|
+
`
|
|
83
|
+
);
|
|
84
|
+
await elementUpdated(el);
|
|
85
|
+
await expect(el).to.be.accessible();
|
|
86
|
+
});
|
|
87
|
+
it("stays `quiet`", async () => {
|
|
88
|
+
const el = await actionMenuFixture();
|
|
89
|
+
await elementUpdated(el);
|
|
90
|
+
expect(el.quiet).to.be.true;
|
|
91
|
+
el.quiet = false;
|
|
92
|
+
await elementUpdated(el);
|
|
93
|
+
expect(el.quiet).to.be.true;
|
|
94
|
+
});
|
|
95
|
+
it("stay `valid`", async () => {
|
|
96
|
+
const el = await actionMenuFixture();
|
|
97
|
+
await elementUpdated(el);
|
|
98
|
+
expect(el.invalid).to.be.false;
|
|
99
|
+
el.invalid = true;
|
|
100
|
+
await elementUpdated(el);
|
|
101
|
+
expect(el.invalid).to.be.false;
|
|
102
|
+
});
|
|
103
|
+
it("focus()", async () => {
|
|
104
|
+
const el = await actionMenuFixture();
|
|
105
|
+
await elementUpdated(el);
|
|
106
|
+
el.focus();
|
|
107
|
+
expect(document.activeElement).to.equal(el);
|
|
108
|
+
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
109
|
+
const opened = oneEvent(el, "sp-opened");
|
|
110
|
+
el.open = true;
|
|
111
|
+
await opened;
|
|
112
|
+
expect(document.activeElement).to.not.equal(el);
|
|
113
|
+
const closed = oneEvent(el, "sp-closed");
|
|
114
|
+
el.open = false;
|
|
115
|
+
await closed;
|
|
116
|
+
expect(document.activeElement).to.equal(el);
|
|
117
|
+
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
118
|
+
});
|
|
119
|
+
it("opens unmeasured", async () => {
|
|
120
|
+
const el = await actionMenuFixture();
|
|
121
|
+
await elementUpdated(el);
|
|
122
|
+
const button = el.button;
|
|
123
|
+
button.click();
|
|
124
|
+
await elementUpdated(el);
|
|
125
|
+
expect(el.open).to.be.true;
|
|
126
|
+
});
|
|
127
|
+
it("opens unmeasured with deprecated syntax", async () => {
|
|
128
|
+
const el = await deprecatedActionMenuFixture();
|
|
129
|
+
await elementUpdated(el);
|
|
130
|
+
const button = el.button;
|
|
131
|
+
button.click();
|
|
132
|
+
await elementUpdated(el);
|
|
133
|
+
expect(el.open).to.be.true;
|
|
134
|
+
});
|
|
135
|
+
it("toggles open/close multiple time", async () => {
|
|
136
|
+
const el = await actionMenuFixture();
|
|
137
|
+
await elementUpdated(el);
|
|
138
|
+
let items = el.querySelectorAll("sp-menu-item");
|
|
139
|
+
const count = items.length;
|
|
140
|
+
expect(items.length).to.equal(count);
|
|
141
|
+
let opened = oneEvent(el, "sp-opened");
|
|
142
|
+
el.open = true;
|
|
143
|
+
await opened;
|
|
144
|
+
expect(el.open).to.be.true;
|
|
145
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
146
|
+
expect(items.length).to.equal(0);
|
|
147
|
+
let closed = oneEvent(el, "sp-closed");
|
|
148
|
+
el.open = false;
|
|
149
|
+
await closed;
|
|
150
|
+
expect(el.open).to.be.false;
|
|
151
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
152
|
+
expect(items.length).to.equal(count);
|
|
153
|
+
opened = oneEvent(el, "sp-opened");
|
|
154
|
+
el.open = true;
|
|
155
|
+
await opened;
|
|
156
|
+
expect(el.open).to.be.true;
|
|
157
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
158
|
+
expect(items.length).to.equal(0);
|
|
159
|
+
closed = oneEvent(el, "sp-closed");
|
|
160
|
+
el.open = false;
|
|
161
|
+
await closed;
|
|
162
|
+
expect(el.open).to.be.false;
|
|
163
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
164
|
+
expect(items.length).to.equal(count);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
46
167
|
//# sourceMappingURL=action-menu-sync.test.js.map
|
|
@@ -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,MAAM,kBAAkB;AACnC,UAA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G,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
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as stories from "../stories/action-menu.stories.js";
|
|
3
|
+
import { regressVisuals } from "../../../test/visual/test.js";
|
|
4
|
+
regressVisuals("ActionMenuStories", stories);
|
|
2
5
|
//# sourceMappingURL=action-menu.test-vrt.js.map
|
|
@@ -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,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
6
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
7
|
+
import {
|
|
8
|
+
elementUpdated,
|
|
9
|
+
expect,
|
|
10
|
+
fixture,
|
|
11
|
+
html,
|
|
12
|
+
oneEvent
|
|
13
|
+
} from "@open-wc/testing";
|
|
14
|
+
import { testForLitDevWarnings } from "../../../test/testing-helpers";
|
|
15
|
+
const deprecatedActionMenuFixture = async () => await fixture(
|
|
16
|
+
html`
|
|
2
17
|
<sp-action-menu label="More Actions">
|
|
3
18
|
<sp-menu>
|
|
4
19
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -10,7 +25,10 @@ import"@spectrum-web-components/action-menu/sp-action-menu.js";import"@spectrum-
|
|
|
10
25
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
11
26
|
</sp-menu>
|
|
12
27
|
</sp-action-menu>
|
|
13
|
-
`
|
|
28
|
+
`
|
|
29
|
+
);
|
|
30
|
+
const actionMenuFixture = async () => await fixture(
|
|
31
|
+
html`
|
|
14
32
|
<sp-action-menu label="More Actions">
|
|
15
33
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
16
34
|
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
@@ -20,7 +38,10 @@ import"@spectrum-web-components/action-menu/sp-action-menu.js";import"@spectrum-
|
|
|
20
38
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
21
39
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
22
40
|
</sp-action-menu>
|
|
23
|
-
`
|
|
41
|
+
`
|
|
42
|
+
);
|
|
43
|
+
const actionSubmenuFixture = async () => await fixture(
|
|
44
|
+
html`
|
|
24
45
|
<sp-action-menu label="More Actions">
|
|
25
46
|
<sp-menu-item>One</sp-menu-item>
|
|
26
47
|
<sp-menu-item>Two</sp-menu-item>
|
|
@@ -35,7 +56,19 @@ import"@spectrum-web-components/action-menu/sp-action-menu.js";import"@spectrum-
|
|
|
35
56
|
</sp-menu>
|
|
36
57
|
</sp-menu-item>
|
|
37
58
|
</sp-action-menu>
|
|
38
|
-
`
|
|
59
|
+
`
|
|
60
|
+
);
|
|
61
|
+
describe("Action menu", () => {
|
|
62
|
+
testForLitDevWarnings(async () => await actionMenuFixture());
|
|
63
|
+
it("loads", async () => {
|
|
64
|
+
const el = await actionMenuFixture();
|
|
65
|
+
await elementUpdated(el);
|
|
66
|
+
expect(el).to.not.be.undefined;
|
|
67
|
+
await expect(el).to.be.accessible();
|
|
68
|
+
});
|
|
69
|
+
it('loads - [slot="label"]', async () => {
|
|
70
|
+
const el = await fixture(
|
|
71
|
+
html`
|
|
39
72
|
<sp-action-menu>
|
|
40
73
|
<span slot="label">More Actions</span>
|
|
41
74
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -46,7 +79,14 @@ import"@spectrum-web-components/action-menu/sp-action-menu.js";import"@spectrum-
|
|
|
46
79
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
47
80
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
48
81
|
</sp-action-menu>
|
|
49
|
-
`
|
|
82
|
+
`
|
|
83
|
+
);
|
|
84
|
+
await elementUpdated(el);
|
|
85
|
+
await expect(el).to.be.accessible();
|
|
86
|
+
});
|
|
87
|
+
it("loads - [custom icon]", async () => {
|
|
88
|
+
const el = await fixture(
|
|
89
|
+
html`
|
|
50
90
|
<sp-action-menu label="More Actions">
|
|
51
91
|
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
52
92
|
<sp-menu-item>Deselect</sp-menu-item>
|
|
@@ -57,5 +97,116 @@ import"@spectrum-web-components/action-menu/sp-action-menu.js";import"@spectrum-
|
|
|
57
97
|
<sp-menu-item>Save Selection</sp-menu-item>
|
|
58
98
|
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
59
99
|
</sp-action-menu>
|
|
60
|
-
`
|
|
100
|
+
`
|
|
101
|
+
);
|
|
102
|
+
await elementUpdated(el);
|
|
103
|
+
await expect(el).to.be.accessible();
|
|
104
|
+
});
|
|
105
|
+
it("stays `quiet`", async () => {
|
|
106
|
+
const el = await actionMenuFixture();
|
|
107
|
+
await elementUpdated(el);
|
|
108
|
+
expect(el.quiet).to.be.true;
|
|
109
|
+
el.quiet = false;
|
|
110
|
+
await elementUpdated(el);
|
|
111
|
+
expect(el.quiet).to.be.true;
|
|
112
|
+
});
|
|
113
|
+
it("stay `valid`", async () => {
|
|
114
|
+
const el = await actionMenuFixture();
|
|
115
|
+
await elementUpdated(el);
|
|
116
|
+
expect(el.invalid).to.be.false;
|
|
117
|
+
el.invalid = true;
|
|
118
|
+
await elementUpdated(el);
|
|
119
|
+
expect(el.invalid).to.be.false;
|
|
120
|
+
});
|
|
121
|
+
it("focus()", async () => {
|
|
122
|
+
const el = await actionMenuFixture();
|
|
123
|
+
await elementUpdated(el);
|
|
124
|
+
el.focus();
|
|
125
|
+
expect(document.activeElement).to.equal(el);
|
|
126
|
+
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
127
|
+
const opened = oneEvent(el, "sp-opened");
|
|
128
|
+
el.open = true;
|
|
129
|
+
await opened;
|
|
130
|
+
expect(document.activeElement).to.not.equal(el);
|
|
131
|
+
const closed = oneEvent(el, "sp-closed");
|
|
132
|
+
el.open = false;
|
|
133
|
+
await closed;
|
|
134
|
+
expect(document.activeElement).to.equal(el);
|
|
135
|
+
expect(el.shadowRoot.activeElement).to.equal(el.focusElement);
|
|
136
|
+
});
|
|
137
|
+
it("opens unmeasured", async () => {
|
|
138
|
+
const el = await actionMenuFixture();
|
|
139
|
+
await elementUpdated(el);
|
|
140
|
+
const button = el.button;
|
|
141
|
+
button.click();
|
|
142
|
+
await elementUpdated(el);
|
|
143
|
+
expect(el.open).to.be.true;
|
|
144
|
+
});
|
|
145
|
+
it("opens unmeasured with deprecated syntax", async () => {
|
|
146
|
+
const el = await deprecatedActionMenuFixture();
|
|
147
|
+
await elementUpdated(el);
|
|
148
|
+
const button = el.button;
|
|
149
|
+
button.click();
|
|
150
|
+
await elementUpdated(el);
|
|
151
|
+
expect(el.open).to.be.true;
|
|
152
|
+
});
|
|
153
|
+
it("toggles open/close multiple time", async () => {
|
|
154
|
+
const el = await actionMenuFixture();
|
|
155
|
+
await elementUpdated(el);
|
|
156
|
+
let items = el.querySelectorAll("sp-menu-item");
|
|
157
|
+
const count = items.length;
|
|
158
|
+
expect(items.length).to.equal(count);
|
|
159
|
+
let opened = oneEvent(el, "sp-opened");
|
|
160
|
+
el.open = true;
|
|
161
|
+
await opened;
|
|
162
|
+
expect(el.open).to.be.true;
|
|
163
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
164
|
+
expect(items.length).to.equal(0);
|
|
165
|
+
let closed = oneEvent(el, "sp-closed");
|
|
166
|
+
el.open = false;
|
|
167
|
+
await closed;
|
|
168
|
+
expect(el.open).to.be.false;
|
|
169
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
170
|
+
expect(items.length).to.equal(count);
|
|
171
|
+
opened = oneEvent(el, "sp-opened");
|
|
172
|
+
el.open = true;
|
|
173
|
+
await opened;
|
|
174
|
+
expect(el.open).to.be.true;
|
|
175
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
176
|
+
expect(items.length).to.equal(0);
|
|
177
|
+
closed = oneEvent(el, "sp-closed");
|
|
178
|
+
el.open = false;
|
|
179
|
+
await closed;
|
|
180
|
+
expect(el.open).to.be.false;
|
|
181
|
+
items = el.querySelectorAll("sp-menu-item");
|
|
182
|
+
expect(items.length).to.equal(count);
|
|
183
|
+
});
|
|
184
|
+
it("allows submenu items to be selected", async () => {
|
|
185
|
+
const root = await actionSubmenuFixture();
|
|
186
|
+
const menuItem = root.querySelector("#item-with-submenu");
|
|
187
|
+
const submenu = menuItem.querySelector(
|
|
188
|
+
'sp-menu[slot="submenu"]'
|
|
189
|
+
);
|
|
190
|
+
const selectedItem = submenu.querySelector(
|
|
191
|
+
"#selected-item"
|
|
192
|
+
);
|
|
193
|
+
expect(selectedItem.selected, "item is not initially selected").to.be.true;
|
|
194
|
+
let opened = oneEvent(root, "sp-opened");
|
|
195
|
+
root.click();
|
|
196
|
+
await opened;
|
|
197
|
+
expect(root.open).to.be.true;
|
|
198
|
+
opened = oneEvent(menuItem, "sp-opened");
|
|
199
|
+
menuItem.dispatchEvent(
|
|
200
|
+
new PointerEvent("pointerenter", { bubbles: true })
|
|
201
|
+
);
|
|
202
|
+
await opened;
|
|
203
|
+
const overlays = document.querySelectorAll("active-overlay");
|
|
204
|
+
expect(overlays.length).to.equal(2);
|
|
205
|
+
await elementUpdated(submenu);
|
|
206
|
+
expect(
|
|
207
|
+
selectedItem.selected,
|
|
208
|
+
"initially selected item is no longer selected"
|
|
209
|
+
).to.be.true;
|
|
210
|
+
});
|
|
211
|
+
});
|
|
61
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,CAAC;AAC3D,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM,kB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@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
3
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
4
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
5
|
+
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
6
|
+
import { html } from "lit";
|
|
7
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
8
|
+
measureFixtureCreation(html`
|
|
2
9
|
<sp-action-menu>
|
|
3
10
|
<span slot="label">
|
|
4
11
|
Select a Country with a very long label, too long in fact
|
|
@@ -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
|
}
|