@spectrum-web-components/action-menu 1.1.0-beta.9 → 1.1.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/README.md CHANGED
@@ -189,7 +189,7 @@ In order to deliver an `<sp-action-menu>` without an icon, use the `label-only`
189
189
 
190
190
  ### No visible label
191
191
 
192
- The visible label that is be provided via the default `<slot>` interface can be ommitted in preference of an icon only interface. In this context be sure that the `<sp-action-menu>` continued to be accessible to screen readers by applying the `label` attribute. This will apply an `aria-label` attribute of the same value to the `<button>` element that toggles the menu list.
192
+ The visible label that is be provided via the default `<slot>` interface can be omitted in preference of an icon only interface. In this context be sure that the `<sp-action-menu>` continued to be accessible to screen readers by applying the `label` attribute. This will apply an `aria-label` attribute of the same value to the `<button>` element that toggles the menu list.
193
193
 
194
194
  <!-- prettier-ignore -->
195
195
  ```html
@@ -249,7 +249,7 @@ A custom icon can be supplied via the `icon` slot in order to replace the defaul
249
249
  </sp-action-menu>
250
250
  ```
251
251
 
252
- ### Selection.
252
+ ### Selection
253
253
 
254
254
  When `selects` is set to `single`, the `<sp-action-menu>` element will maintain one selected item after an initial selection is made.
255
255
 
@@ -272,13 +272,33 @@ When `selects` is set to `single`, the `<sp-action-menu>` element will maintain
272
272
  </sp-action-menu>
273
273
  ```
274
274
 
275
- ## Accessibility
275
+ ## Force Popover on Mobile Devices
276
276
 
277
- An `<sp-action-menu>` parent will ensure that the internal `<sp-menu>` features a role of `listbox` and contains children with the role `option`. Upon focusing the `<sp-action-menu>` using `ArrowDown` will also open the menu while throwing focus into first selected (or unselected when none are selected) menu item to assist in selecting of a new value.
277
+ On mobile, the menu can be exposed in either a `sp-popover` or `sp-tray`. By default, `sp-action-menu` will render an `sp-tray`. If you would like to render `sp-popover` on mobile, add the attribute `forcePopover` to the `sp-action-menu`.
278
+
279
+ Usage Guidance:
280
+
281
+ - Use a tray when a menu’s proximity to its trigger is considered to be less important to the experience, or for showing a volume of content that is too overwhelming for a popover.
282
+ - Use a popover when a menu’s proximity to its trigger is considered to be important to the experience, or for showing a volume of content that is manageable for a popover.
283
+
284
+ To see this functionality in action, load this page from your mobile device or use Chrome DevTools (or equivalent) and select a mobile device once the Device Toolbar (the phone/tablet icon) is active.
285
+
286
+ ```html
287
+ <sp-action-menu forcePopover>
288
+ <span slot="label">Action Menu</span>
289
+ <sp-menu-item>Deselect</sp-menu-item>
290
+ <sp-menu-item>Select Inverse</sp-menu-item>
291
+ <sp-menu-item>Feather...</sp-menu-item>
292
+ <sp-menu-item>Select and Mask...</sp-menu-item>
293
+ <sp-menu-divider></sp-menu-divider>
294
+ <sp-menu-item>Save Selection</sp-menu-item>
295
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
296
+ </sp-action-menu>
297
+ ```
278
298
 
279
299
  ## Adding tootip in action menu
280
300
 
281
- Tooltip in action menu can be attached via adding <sp-tooltip> and can be customized by using various parameters (e.g. placement, content, etc) as needed.
301
+ Tooltip in action menu can be attached via adding `<sp-tooltip>` and can be customized by using various parameters (e.g. placement, content, etc) as needed.
282
302
 
283
303
  ```html
284
304
  <sp-action-menu>
@@ -291,3 +311,7 @@ Tooltip in action menu can be attached via adding <sp-tooltip> and can be custom
291
311
  <sp-menu-item value="shape-3-parallelogram">Parallelogram</sp-menu-item>
292
312
  </sp-action-menu>
293
313
  ```
314
+
315
+ ## Accessibility
316
+
317
+ An `<sp-action-menu>` parent will ensure that the internal `<sp-menu>` features a role of `listbox` and contains children with the role `option`. Upon focusing the `<sp-action-menu>` using `ArrowDown` will also open the menu while throwing focus into first selected (or unselected when none are selected) menu item to assist in selecting of a new value.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/action-menu",
3
- "version": "1.1.0-beta.9",
3
+ "version": "1.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -61,15 +61,15 @@
61
61
  "lit-html"
62
62
  ],
63
63
  "dependencies": {
64
- "@spectrum-web-components/action-button": "^1.1.0-beta.9",
65
- "@spectrum-web-components/base": "^1.1.0-beta.9",
66
- "@spectrum-web-components/icon": "^1.1.0-beta.9",
67
- "@spectrum-web-components/icons-workflow": "^1.1.0-beta.9",
68
- "@spectrum-web-components/picker": "^1.1.0-beta.9",
69
- "@spectrum-web-components/shared": "^1.1.0-beta.9"
64
+ "@spectrum-web-components/action-button": "^1.1.1",
65
+ "@spectrum-web-components/base": "^1.1.1",
66
+ "@spectrum-web-components/icon": "^1.1.1",
67
+ "@spectrum-web-components/icons-workflow": "^1.1.1",
68
+ "@spectrum-web-components/picker": "^1.1.1",
69
+ "@spectrum-web-components/shared": "^1.1.1"
70
70
  },
71
71
  "devDependencies": {
72
- "@spectrum-css/actionmenu": "^7.0.0-s2-foundations.15"
72
+ "@spectrum-css/actionmenu": "7.0.0-s2-foundations.15"
73
73
  },
74
74
  "types": "./src/index.d.ts",
75
75
  "customElements": "custom-elements.json",
@@ -78,5 +78,5 @@
78
78
  "./**/*.dev.js",
79
79
  "./sync/sp-*.js"
80
80
  ],
81
- "gitHead": "56bdfbc0a26b76ff7c3ee454478d5ebd2a4d33dc"
81
+ "gitHead": "44870aa95001c1b995456d994ae31bbe7277fac9"
82
82
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["action-menu.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none}:host([dir=ltr]) ::slotted([slot=icon]),:host([dir=ltr]) .icon{margin-left:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir=rtl]) ::slotted([slot=icon]),:host([dir=rtl]) .icon{margin-right:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir]) slot[icon-only]::slotted([slot=icon]),:host([dir]) slot[icon-only] .icon{margin-inline:calc(( var(--custom-actionbutton-edge-to-text,var(--spectrum-actionbutton-edge-to-text)) - var(--custom-actionbutton-edge-to-visual-only,var(--spectrum-actionbutton-edge-to-visual-only)))*-1)}sp-overlay:not(:defined){display:none}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/*\nCopyright 2025 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none}:host([dir=ltr]) ::slotted([slot=icon]),:host([dir=ltr]) .icon{margin-left:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir=rtl]) ::slotted([slot=icon]),:host([dir=rtl]) .icon{margin-right:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir]) slot[icon-only]::slotted([slot=icon]),:host([dir]) slot[icon-only] .icon{margin-inline:calc(( var(--custom-actionbutton-edge-to-text,var(--spectrum-actionbutton-edge-to-text)) - var(--custom-actionbutton-edge-to-visual-only,var(--spectrum-actionbutton-edge-to-visual-only)))*-1)}sp-overlay:not(:defined){display:none}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["action-menu.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none}:host([dir=ltr]) ::slotted([slot=icon]),:host([dir=ltr]) .icon{margin-left:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir=rtl]) ::slotted([slot=icon]),:host([dir=rtl]) .icon{margin-right:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir]) slot[icon-only]::slotted([slot=icon]),:host([dir]) slot[icon-only] .icon{margin-inline:calc(( var(--custom-actionbutton-edge-to-text,var(--spectrum-actionbutton-edge-to-text)) - var(--custom-actionbutton-edge-to-visual-only,var(--spectrum-actionbutton-edge-to-visual-only)))*-1)}sp-overlay:not(:defined){display:none}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/*\nCopyright 2025 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none}:host([dir=ltr]) ::slotted([slot=icon]),:host([dir=ltr]) .icon{margin-left:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir=rtl]) ::slotted([slot=icon]),:host([dir=rtl]) .icon{margin-right:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir]) slot[icon-only]::slotted([slot=icon]),:host([dir]) slot[icon-only] .icon{margin-inline:calc(( var(--custom-actionbutton-edge-to-text,var(--spectrum-actionbutton-edge-to-text)) - var(--custom-actionbutton-edge-to-visual-only,var(--spectrum-actionbutton-edge-to-visual-only)))*-1)}sp-overlay:not(:defined){display:none}\n`;\nexport default styles;"],
5
5
  "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
6
6
  "names": ["css", "styles"]
7
7
  }
@@ -2,15 +2,15 @@
2
2
  import { html } from "@spectrum-web-components/base";
3
3
  import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
4
4
  import "@spectrum-web-components/action-menu/sp-action-menu.js";
5
- import "@spectrum-web-components/menu/sp-menu.js";
6
- import "@spectrum-web-components/menu/sp-menu-item.js";
7
- import "@spectrum-web-components/menu/sp-menu-group.js";
8
5
  import "@spectrum-web-components/menu/sp-menu-divider.js";
9
- import "@spectrum-web-components/tooltip/sp-tooltip.js";
6
+ import "@spectrum-web-components/menu/sp-menu-group.js";
7
+ import "@spectrum-web-components/menu/sp-menu-item.js";
8
+ import "@spectrum-web-components/menu/sp-menu.js";
10
9
  import { slottableRequest } from "@spectrum-web-components/overlay/src/slottable-request-directive.js";
11
- import { ActionMenuMarkup } from "./";
10
+ import "@spectrum-web-components/tooltip/sp-tooltip.js";
12
11
  import { makeOverBackground } from "../../button/stories/index.js";
13
12
  import { isOverlayOpen } from "../../overlay/stories/index.js";
13
+ import { ActionMenuMarkup } from "./";
14
14
  import "@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js";
15
15
  export default {
16
16
  component: "sp-action-menu",
@@ -141,6 +141,7 @@ export default {
141
141
  align: "start",
142
142
  visibleLabel: "More Actions",
143
143
  disabled: false,
144
+ forcePopover: false,
144
145
  open: false,
145
146
  quiet: false,
146
147
  tooltipDescription: "",
@@ -164,6 +165,34 @@ export const quiet = (args = {}) => Template(args);
164
165
  quiet.args = {
165
166
  quiet: true
166
167
  };
168
+ export const forcePopoverOnMobile = () => html`
169
+ <h1>Force Popover on Mobile</h1>
170
+ <p>
171
+ The forcePopover attribute overrides the mobile device functionality of
172
+ rendering a tray so that a popover will always render no matter the
173
+ device.
174
+ </p>
175
+ <ol>
176
+ <li>Open Chrome DevTools (or equivalent).</li>
177
+ <li>Toggle the Device Toolbar (the phone/tablet icon).</li>
178
+ <li>Select a device preset (e.g. iPhone 12).</li>
179
+ <li>
180
+ Chrome will set user-agent strings, simulate touch, and adjust DPI.
181
+ </li>
182
+ <li>Reload the page</li>
183
+ <li>Click the Action Menu and see a popover</li>
184
+ </ol>
185
+ <sp-action-menu forcePopover>
186
+ <span slot="label">Action Menu</span>
187
+ <sp-menu-item>Deselect</sp-menu-item>
188
+ <sp-menu-item>Select Inverse</sp-menu-item>
189
+ <sp-menu-item>Feather...</sp-menu-item>
190
+ <sp-menu-item>Select and Mask...</sp-menu-item>
191
+ <sp-menu-divider></sp-menu-divider>
192
+ <sp-menu-item>Save Selection</sp-menu-item>
193
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
194
+ </sp-action-menu>
195
+ `;
167
196
  export const labelOnly = ({
168
197
  align = "start",
169
198
  changeHandler = () => void 0,
@@ -367,6 +396,10 @@ export const groupsWithSelects = ({
367
396
  groupsWithSelects.swc_vrt = {
368
397
  skip: true
369
398
  };
399
+ groupsWithSelects.parameters = {
400
+ // Disables Chromatic's snapshotting on a global level
401
+ chromatic: { disableSnapshot: true }
402
+ };
370
403
  export const directive = () => {
371
404
  const renderSubmenu = () => html`
372
405
  <sp-menu-item>Submenu Item 1</sp-menu-item>
@@ -400,6 +433,10 @@ export const directive = () => {
400
433
  directive.swc_vrt = {
401
434
  skip: true
402
435
  };
436
+ directive.parameters = {
437
+ // Disables Chromatic's snapshotting on a global level
438
+ chromatic: { disableSnapshot: true }
439
+ };
403
440
  export const withScrollEvent = () => {
404
441
  function handleActionMenuScroll() {
405
442
  console.log("attached action menu scroll listener");
@@ -421,4 +458,7 @@ export const withScrollEvent = () => {
421
458
  </sp-action-menu>
422
459
  `;
423
460
  };
461
+ withScrollEvent.parameters = {
462
+ chromatic: { disableSnapshot: true }
463
+ };
424
464
  //# sourceMappingURL=action-menu.stories.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["action-menu.stories.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-group.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { slottableRequest } from '@spectrum-web-components/overlay/src/slottable-request-directive.js';\nimport { ActionMenuMarkup } from './';\nimport { makeOverBackground } from '../../button/stories/index.js';\nimport { isOverlayOpen } from '../../overlay/stories/index.js';\n\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport type { MenuItem } from '@spectrum-web-components/menu/src/MenuItem.js';\nimport { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport { Menu } from '@spectrum-web-components/menu';\nimport type { ActionMenu } from '@spectrum-web-components/action-menu';\n\nexport default {\n component: 'sp-action-menu',\n title: 'Action menu',\n argTypes: {\n onChange: { action: 'change' },\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the menu is open or not.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: 'boolean',\n },\n visibleLabel: {\n name: 'Visible Label',\n description: 'The placeholder content for the picker.',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: 'text',\n },\n tooltipDescription: {\n name: 'Tooltip Description',\n type: { name: 'string', required: false },\n description: 'Tooltip description',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: {\n type: 'text',\n },\n },\n tooltipPlacement: {\n name: 'Tooltip Placement',\n type: { name: 'string', required: false },\n description: 'Tooltip Placement.',\n table: {\n defaultValue: { summary: 'bottom' },\n },\n control: {\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n type: 'select',\n },\n },\n quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\n description: 'Quiet rendering',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n staticColorValue: {\n name: 'static-color',\n type: { name: 'string', required: false },\n description:\n 'The visual static color variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'none' },\n },\n control: {\n type: 'select',\n labels: {\n white: 'white',\n black: 'black',\n none: undefined,\n },\n options: ['white', 'black', 'none'],\n },\n },\n align: {\n name: 'align',\n type: { name: 'string', required: false },\n description: 'Alignment of the Action Menu',\n table: {\n defaultValue: { summary: 'start' },\n },\n control: {\n type: 'select',\n labels: {\n start: 'start',\n end: 'end',\n },\n },\n options: ['start', 'end'],\n },\n },\n args: {\n align: 'start',\n visibleLabel: 'More Actions',\n disabled: false,\n open: false,\n quiet: false,\n tooltipDescription: '',\n tooltipPlacement: 'bottom',\n static: undefined,\n },\n};\n\ninterface StoryArgs {\n align?: 'start' | 'end';\n visibleLabel?: string;\n disabled?: boolean;\n open?: boolean;\n customIcon?: string | TemplateResult;\n selects?: 'single';\n selected?: boolean;\n quiet?: boolean;\n staticValue?: 'white' | 'black' | undefined;\n tooltipDescription?: string | 'none';\n tooltipPlacement?: Placement;\n}\n\nconst Template = (args: StoryArgs = {}): TemplateResult =>\n ActionMenuMarkup(args);\n\nexport const Default = (args: StoryArgs = {}): TemplateResult => Template(args);\n\nexport const staticWhite = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticWhite.args = {\n staticValue: 'white',\n};\nstaticWhite.decorators = [makeOverBackground()];\nexport const staticBlack = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticBlack.args = {\n staticValue: 'black',\n};\nstaticBlack.decorators = [makeOverBackground()];\nexport const quiet = (args: StoryArgs = {}): TemplateResult => Template(args);\nquiet.args = {\n quiet: true,\n};\n\nexport const labelOnly = ({\n align = 'start',\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = false,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n} = {}): TemplateResult => html`\n <sp-action-menu\n ?disabled=${disabled}\n ?open=${open}\n size=${size}\n @change=${(event: Event & { target: Menu }): void => {\n navigator.clipboard.writeText(event.target.value);\n changeHandler(event);\n }}\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n style=${ifDefined(align === 'end' ? 'float: inline-end;' : undefined)}\n >\n <span slot=\"label-only\">Label Only</span>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-action-menu>\n`;\n\nexport const selects = (args: StoryArgs = {}): TemplateResult =>\n Template({\n ...args,\n selects: 'single',\n selected: true,\n });\nselects.args = {\n open: true,\n};\nselects.decorators = [isOverlayOpen];\n\nexport const iconOnly = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\niconOnly.args = {\n visibleLabel: '',\n};\n\nexport const tooltipDescriptionAndPlacement = (\n args: StoryArgs = {}\n): TemplateResult => Template(args);\ntooltipDescriptionAndPlacement.args = {\n tooltipDescription: 'Your tooltip string here',\n visibleLabel: '',\n tooltipPlacement: 'bottom',\n} as StoryArgs;\n\nexport const customIcon = (args: StoryArgs): TemplateResult => Template(args);\ncustomIcon.args = {\n customIcon: html`\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n `,\n visibleLabel: '',\n};\n\nexport const submenu = ({ align = 'start' } = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=\"More Actions\"\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item>Two</sp-menu-item>\n <sp-menu-item>\n Select some items\n <sp-menu slot=\"submenu\" selects=\"multiple\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected>B</sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `;\n};\n\nexport const controlled = ({ align = 'start' } = {}): TemplateResult => {\n const state = {\n snap: true,\n grid: false,\n guides: true,\n latestChange: '',\n };\n function toggle(prop: 'snap' | 'grid' | 'guides') {\n return (event: Event): void => {\n const item = event.target as MenuItem;\n state[prop] = !state[prop];\n // in Lit-based usage, this would be handled via render():\n // <sp-menu-item ?selected=${this.isSomethingSelected}>\n item.selected = state[prop];\n };\n }\n function onChange(event: Event): void {\n state.latestChange = (event.target as MenuItem).value;\n logState();\n }\n function logState(): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('state-json')!.textContent =\n `application state: ${JSON.stringify(state)}`;\n }\n return html`\n <sp-action-menu\n label=\"View\"\n @change=${onChange}\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n <sp-menu-item value=\"action\" @click=${() => alert('action')}>\n Non-selectable action\n </sp-menu-item>\n <sp-menu-item\n value=\"snap\"\n ?selected=${state.snap}\n @click=${toggle('snap')}\n >\n Snap\n </sp-menu-item>\n <sp-menu-item>\n Show\n <sp-menu\n slot=\"submenu\"\n selects=\"multiple\"\n @change=${(event: Event) => event.preventDefault()}\n >\n <sp-menu-item\n value=\"grid\"\n ?selected=${state.grid}\n @click=${toggle('grid')}\n >\n Grid\n </sp-menu-item>\n <sp-menu-item\n value=\"guides\"\n ?selected=${state.guides}\n @click=${toggle('guides')}\n >\n Guides\n </sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n <span id=\"state-json\"></span>\n `;\n};\n\nexport const groups = ({\n align = 'start',\n onChange,\n}: {\n align: 'start' | 'end';\n onChange(value: string): void;\n}): TemplateResult => html`\n <sp-action-menu\n @change=${({ target: { value } }: Event & { target: ActionMenu }) =>\n onChange(value)}\n open\n style=${ifDefined(align === 'end' ? 'float: inline-end;' : undefined)}\n >\n <sp-menu-group id=\"cms\">\n <span slot=\"header\">cms</span>\n <sp-menu-item value=\"updateAllSiteContent\">\n Update All Content\n </sp-menu-item>\n <sp-menu-item value=\"refreshAllXDs\">Refresh All XDs</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"ssg\">\n <span slot=\"header\">ssg</span>\n <sp-menu-item value=\"clearCache\">Clear Cache</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"vrt\">\n <span slot=\"header\">vrt</span>\n <sp-menu-item value=\"vrt-contributions\">Contributions</sp-menu-item>\n <sp-menu-item value=\"vrt-internal\">Internal</sp-menu-item>\n <sp-menu-item value=\"vrt-public\">Public</sp-menu-item>\n <sp-menu-item value=\"vrt-patterns\">Patterns</sp-menu-item>\n <sp-menu-item value=\"vrt\">All</sp-menu-item>\n </sp-menu-group>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-group id=\"misc\">\n <sp-menu-item value=\"logout\">Logout</sp-menu-item>\n </sp-menu-group>\n </sp-action-menu>\n`;\n\ngroups.decorators = [isOverlayOpen];\n\nexport const groupsWithSelects = ({\n onChange,\n}: {\n onChange(value: string): void;\n}): TemplateResult => {\n return html`\n <sp-action-menu\n @change=${({ target: { value } }: Event & { target: ActionMenu }) =>\n onChange(value)}\n label=\"Filter or Sort\"\n >\n <sp-menu-group selects=\"single\">\n <span slot=\"header\">Sort By</span>\n <sp-menu-item>Name</sp-menu-item>\n <sp-menu-item>Created</sp-menu-item>\n <sp-menu-item>Modified</sp-menu-item>\n </sp-menu-group>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-group selects=\"multiple\">\n <sp-menu-item>Reverse Order</sp-menu-item>\n </sp-menu-group>\n </sp-action-menu>\n `;\n};\n\ngroupsWithSelects.swc_vrt = {\n skip: true,\n};\n\nexport const directive = (): TemplateResult => {\n const renderSubmenu = (): TemplateResult => html`\n <sp-menu-item>Submenu Item 1</sp-menu-item>\n <sp-menu-item>Submenu Item 2</sp-menu-item>\n <sp-menu-item>Submenu Item 3</sp-menu-item>\n <sp-menu-item>Submenu Item 4</sp-menu-item>\n `;\n const renderOptions = (): TemplateResult => html`\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>\n Feather...\n <sp-menu\n slot=\"submenu\"\n ${slottableRequest(renderSubmenu)}\n ></sp-menu>\n </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 `;\n return html`\n <sp-action-menu ${slottableRequest(renderOptions)}>\n <span slot=\"label\">\n Select a Country with a very long label, too long in fact\n </span>\n </sp-action-menu>\n `;\n};\n\ndirective.swc_vrt = {\n skip: true,\n};\n\nexport const withScrollEvent = (): TemplateResult => {\n function handleActionMenuScroll(): void {\n console.log('attached action menu scroll listener');\n }\n\n function renderMenuItems(): TemplateResult[] {\n return Array.from(\n { length: 30 },\n (_, i) => html`\n <sp-menu-item style=\"width: 100%;\">\n This is an Action Menu Item ${i + 1}\n </sp-menu-item>\n `\n );\n }\n\n return html`\n <sp-action-menu @scroll=${handleActionMenuScroll} open>\n <span slot=\"label\">This is an Action Menu</span>\n ${renderMenuItems()}\n </sp-action-menu>\n `;\n};\n"],
5
- "mappings": ";AAWA,SAAS,YAA4B;AACrC,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AACP,OAAO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MAC3B,SAAS,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAe/B;AAEA,kBAAkB,UAAU;AAAA,EACxB,MAAM;AACV;AAEO,aAAM,YAAY,MAAsB;AAC3C,QAAM,gBAAgB,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAM5C,QAAM,gBAAgB,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAO9B,iBAAiB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ7C,SAAO;AAAA,0BACe,iBAAiB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMzD;AAEA,UAAU,UAAU;AAAA,EAChB,MAAM;AACV;AAEO,aAAM,kBAAkB,MAAsB;AACjD,WAAS,yBAA+B;AACpC,YAAQ,IAAI,sCAAsC;AAAA,EACtD;AAEA,WAAS,kBAAoC;AACzC,WAAO,MAAM;AAAA,MACT,EAAE,QAAQ,GAAG;AAAA,MACb,CAAC,GAAG,MAAM;AAAA;AAAA,kDAE4B,IAAI,CAAC;AAAA;AAAA;AAAA,IAG/C;AAAA,EACJ;AAEA,SAAO;AAAA,kCACuB,sBAAsB;AAAA;AAAA,cAE1C,gBAAgB,CAAC;AAAA;AAAA;AAG/B;",
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';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-group.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport { slottableRequest } from '@spectrum-web-components/overlay/src/slottable-request-directive.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { makeOverBackground } from '../../button/stories/index.js';\nimport { isOverlayOpen } from '../../overlay/stories/index.js';\nimport { ActionMenuMarkup } from './';\n\nimport type { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';\nimport { Menu } from '@spectrum-web-components/menu';\nimport type { MenuItem } from '@spectrum-web-components/menu/src/MenuItem.js';\nimport { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\n\nexport default {\n component: 'sp-action-menu',\n title: 'Action menu',\n argTypes: {\n onChange: { action: 'change' },\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the menu is open or not.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: 'boolean',\n },\n visibleLabel: {\n name: 'Visible Label',\n description: 'The placeholder content for the picker.',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: 'text',\n },\n tooltipDescription: {\n name: 'Tooltip Description',\n type: { name: 'string', required: false },\n description: 'Tooltip description',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: {\n type: 'text',\n },\n },\n tooltipPlacement: {\n name: 'Tooltip Placement',\n type: { name: 'string', required: false },\n description: 'Tooltip Placement.',\n table: {\n defaultValue: { summary: 'bottom' },\n },\n control: {\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n type: 'select',\n },\n },\n quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\n description: 'Quiet rendering',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n staticColorValue: {\n name: 'static-color',\n type: { name: 'string', required: false },\n description:\n 'The visual static color variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'none' },\n },\n control: {\n type: 'select',\n labels: {\n white: 'white',\n black: 'black',\n none: undefined,\n },\n options: ['white', 'black', 'none'],\n },\n },\n align: {\n name: 'align',\n type: { name: 'string', required: false },\n description: 'Alignment of the Action Menu',\n table: {\n defaultValue: { summary: 'start' },\n },\n control: {\n type: 'select',\n labels: {\n start: 'start',\n end: 'end',\n },\n },\n options: ['start', 'end'],\n },\n },\n args: {\n align: 'start',\n visibleLabel: 'More Actions',\n disabled: false,\n forcePopover: false,\n open: false,\n quiet: false,\n tooltipDescription: '',\n tooltipPlacement: 'bottom',\n static: undefined,\n },\n};\n\ninterface StoryArgs {\n align?: 'start' | 'end';\n visibleLabel?: string;\n disabled?: boolean;\n open?: boolean;\n customIcon?: string | TemplateResult;\n selects?: 'single';\n selected?: boolean;\n quiet?: boolean;\n staticValue?: 'white' | 'black' | undefined;\n tooltipDescription?: string | 'none';\n tooltipPlacement?: Placement;\n forcePopover?: boolean;\n}\n\nconst Template = (args: StoryArgs = {}): TemplateResult =>\n ActionMenuMarkup(args);\n\nexport const Default = (args: StoryArgs = {}): TemplateResult => Template(args);\n\nexport const staticWhite = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticWhite.args = {\n staticValue: 'white',\n};\nstaticWhite.decorators = [makeOverBackground()];\nexport const staticBlack = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\nstaticBlack.args = {\n staticValue: 'black',\n};\nstaticBlack.decorators = [makeOverBackground()];\nexport const quiet = (args: StoryArgs = {}): TemplateResult => Template(args);\nquiet.args = {\n quiet: true,\n};\n\nexport const forcePopoverOnMobile = (): TemplateResult => html`\n <h1>Force Popover on Mobile</h1>\n <p>\n The forcePopover attribute overrides the mobile device functionality of\n rendering a tray so that a popover will always render no matter the\n device.\n </p>\n <ol>\n <li>Open Chrome DevTools (or equivalent).</li>\n <li>Toggle the Device Toolbar (the phone/tablet icon).</li>\n <li>Select a device preset (e.g. iPhone 12).</li>\n <li>\n Chrome will set user-agent strings, simulate touch, and adjust DPI.\n </li>\n <li>Reload the page</li>\n <li>Click the Action Menu and see a popover</li>\n </ol>\n <sp-action-menu forcePopover>\n <span slot=\"label\">Action Menu</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`;\nexport const labelOnly = ({\n align = 'start',\n changeHandler = (() => undefined) as (event: Event) => void,\n disabled = false,\n open = false,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n} = {}): TemplateResult => html`\n <sp-action-menu\n ?disabled=${disabled}\n ?open=${open}\n size=${size}\n @change=${(event: Event & { target: Menu }): void => {\n navigator.clipboard.writeText(event.target.value);\n changeHandler(event);\n }}\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n style=${ifDefined(align === 'end' ? 'float: inline-end;' : undefined)}\n >\n <span slot=\"label-only\">Label Only</span>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-action-menu>\n`;\n\nexport const selects = (args: StoryArgs = {}): TemplateResult =>\n Template({\n ...args,\n selects: 'single',\n selected: true,\n });\nselects.args = {\n open: true,\n};\nselects.decorators = [isOverlayOpen];\n\nexport const iconOnly = (args: StoryArgs = {}): TemplateResult =>\n Template(args);\niconOnly.args = {\n visibleLabel: '',\n};\n\nexport const tooltipDescriptionAndPlacement = (\n args: StoryArgs = {}\n): TemplateResult => Template(args);\ntooltipDescriptionAndPlacement.args = {\n tooltipDescription: 'Your tooltip string here',\n visibleLabel: '',\n tooltipPlacement: 'bottom',\n} as StoryArgs;\n\nexport const customIcon = (args: StoryArgs): TemplateResult => Template(args);\ncustomIcon.args = {\n customIcon: html`\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n `,\n visibleLabel: '',\n};\n\nexport const submenu = ({ align = 'start' } = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=\"More Actions\"\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item>Two</sp-menu-item>\n <sp-menu-item>\n Select some items\n <sp-menu slot=\"submenu\" selects=\"multiple\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected>B</sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `;\n};\n\nexport const controlled = ({ align = 'start' } = {}): TemplateResult => {\n const state = {\n snap: true,\n grid: false,\n guides: true,\n latestChange: '',\n };\n function toggle(prop: 'snap' | 'grid' | 'guides') {\n return (event: Event): void => {\n const item = event.target as MenuItem;\n state[prop] = !state[prop];\n // in Lit-based usage, this would be handled via render():\n // <sp-menu-item ?selected=${this.isSomethingSelected}>\n item.selected = state[prop];\n };\n }\n function onChange(event: Event): void {\n state.latestChange = (event.target as MenuItem).value;\n logState();\n }\n function logState(): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n document.getElementById('state-json')!.textContent =\n `application state: ${JSON.stringify(state)}`;\n }\n return html`\n <sp-action-menu\n label=\"View\"\n @change=${onChange}\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n <sp-menu-item value=\"action\" @click=${() => alert('action')}>\n Non-selectable action\n </sp-menu-item>\n <sp-menu-item\n value=\"snap\"\n ?selected=${state.snap}\n @click=${toggle('snap')}\n >\n Snap\n </sp-menu-item>\n <sp-menu-item>\n Show\n <sp-menu\n slot=\"submenu\"\n selects=\"multiple\"\n @change=${(event: Event) => event.preventDefault()}\n >\n <sp-menu-item\n value=\"grid\"\n ?selected=${state.grid}\n @click=${toggle('grid')}\n >\n Grid\n </sp-menu-item>\n <sp-menu-item\n value=\"guides\"\n ?selected=${state.guides}\n @click=${toggle('guides')}\n >\n Guides\n </sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n <span id=\"state-json\"></span>\n `;\n};\n\nexport const groups = ({\n align = 'start',\n onChange,\n}: {\n align: 'start' | 'end';\n onChange(value: string): void;\n}): TemplateResult => html`\n <sp-action-menu\n @change=${({ target: { value } }: Event & { target: ActionMenu }) =>\n onChange(value)}\n open\n style=${ifDefined(align === 'end' ? 'float: inline-end;' : undefined)}\n >\n <sp-menu-group id=\"cms\">\n <span slot=\"header\">cms</span>\n <sp-menu-item value=\"updateAllSiteContent\">\n Update All Content\n </sp-menu-item>\n <sp-menu-item value=\"refreshAllXDs\">Refresh All XDs</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"ssg\">\n <span slot=\"header\">ssg</span>\n <sp-menu-item value=\"clearCache\">Clear Cache</sp-menu-item>\n </sp-menu-group>\n <sp-menu-group id=\"vrt\">\n <span slot=\"header\">vrt</span>\n <sp-menu-item value=\"vrt-contributions\">Contributions</sp-menu-item>\n <sp-menu-item value=\"vrt-internal\">Internal</sp-menu-item>\n <sp-menu-item value=\"vrt-public\">Public</sp-menu-item>\n <sp-menu-item value=\"vrt-patterns\">Patterns</sp-menu-item>\n <sp-menu-item value=\"vrt\">All</sp-menu-item>\n </sp-menu-group>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-group id=\"misc\">\n <sp-menu-item value=\"logout\">Logout</sp-menu-item>\n </sp-menu-group>\n </sp-action-menu>\n`;\n\ngroups.decorators = [isOverlayOpen];\n\nexport const groupsWithSelects = ({\n onChange,\n}: {\n onChange(value: string): void;\n}): TemplateResult => {\n return html`\n <sp-action-menu\n @change=${({ target: { value } }: Event & { target: ActionMenu }) =>\n onChange(value)}\n label=\"Filter or Sort\"\n >\n <sp-menu-group selects=\"single\">\n <span slot=\"header\">Sort By</span>\n <sp-menu-item>Name</sp-menu-item>\n <sp-menu-item>Created</sp-menu-item>\n <sp-menu-item>Modified</sp-menu-item>\n </sp-menu-group>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-group selects=\"multiple\">\n <sp-menu-item>Reverse Order</sp-menu-item>\n </sp-menu-group>\n </sp-action-menu>\n `;\n};\n\ngroupsWithSelects.swc_vrt = {\n skip: true,\n};\n\ngroupsWithSelects.parameters = {\n // Disables Chromatic's snapshotting on a global level\n chromatic: { disableSnapshot: true },\n};\n\nexport const directive = (): TemplateResult => {\n const renderSubmenu = (): TemplateResult => html`\n <sp-menu-item>Submenu Item 1</sp-menu-item>\n <sp-menu-item>Submenu Item 2</sp-menu-item>\n <sp-menu-item>Submenu Item 3</sp-menu-item>\n <sp-menu-item>Submenu Item 4</sp-menu-item>\n `;\n const renderOptions = (): TemplateResult => html`\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>\n Feather...\n <sp-menu\n slot=\"submenu\"\n ${slottableRequest(renderSubmenu)}\n ></sp-menu>\n </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 `;\n return html`\n <sp-action-menu ${slottableRequest(renderOptions)}>\n <span slot=\"label\">\n Select a Country with a very long label, too long in fact\n </span>\n </sp-action-menu>\n `;\n};\n\ndirective.swc_vrt = {\n skip: true,\n};\n\ndirective.parameters = {\n // Disables Chromatic's snapshotting on a global level\n chromatic: { disableSnapshot: true },\n};\n\nexport const withScrollEvent = (): TemplateResult => {\n function handleActionMenuScroll(): void {\n console.log('attached action menu scroll listener');\n }\n\n function renderMenuItems(): TemplateResult[] {\n return Array.from(\n { length: 30 },\n (_, i) => html`\n <sp-menu-item style=\"width: 100%;\">\n This is an Action Menu Item ${i + 1}\n </sp-menu-item>\n `\n );\n }\n\n return html`\n <sp-action-menu @scroll=${handleActionMenuScroll} open>\n <span slot=\"label\">This is an Action Menu</span>\n ${renderMenuItems()}\n </sp-action-menu>\n `;\n};\n\nwithScrollEvent.parameters = {\n chromatic: { disableSnapshot: true },\n};\n"],
5
+ "mappings": ";AAWA,SAAS,YAA4B;AACrC,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,wBAAwB;AACjC,OAAO;AACP,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AAGjC,OAAO;AAKP,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,IACN,UAAU,EAAE,QAAQ,SAAS;AAAA,IAC7B,UAAU;AAAA,MACN,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,MACzC,aACI;AAAA,MACJ,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,UAAU;AAAA,QAC3B,cAAc,EAAE,SAAS,MAAM;AAAA,MACnC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,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AAAA;AAAA;AAAA;AAAA;AAAA;AAM5C,QAAM,gBAAgB,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAO9B,iBAAiB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ7C,SAAO;AAAA,0BACe,iBAAiB,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMzD;AAEA,UAAU,UAAU;AAAA,EAChB,MAAM;AACV;AAEA,UAAU,aAAa;AAAA;AAAA,EAEnB,WAAW,EAAE,iBAAiB,KAAK;AACvC;AAEO,aAAM,kBAAkB,MAAsB;AACjD,WAAS,yBAA+B;AACpC,YAAQ,IAAI,sCAAsC;AAAA,EACtD;AAEA,WAAS,kBAAoC;AACzC,WAAO,MAAM;AAAA,MACT,EAAE,QAAQ,GAAG;AAAA,MACb,CAAC,GAAG,MAAM;AAAA;AAAA,kDAE4B,IAAI,CAAC;AAAA;AAAA;AAAA,IAG/C;AAAA,EACJ;AAEA,SAAO;AAAA,kCACuB,sBAAsB;AAAA;AAAA,cAE1C,gBAAgB,CAAC;AAAA;AAAA;AAG/B;AAEA,gBAAgB,aAAa;AAAA,EACzB,WAAW,EAAE,iBAAiB,KAAK;AACvC;",
6
6
  "names": ["selects"]
7
7
  }
package/stories/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
3
2
  import { html, nothing } from "@spectrum-web-components/base";
3
+ import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
4
4
  import "@spectrum-web-components/action-menu/sp-action-menu.js";
5
5
  import "@spectrum-web-components/icon/sp-icon.js";
6
6
  import "@spectrum-web-components/menu/sp-menu-divider.js";
@@ -12,6 +12,7 @@ export const ActionMenuMarkup = ({
12
12
  onChange = () => void 0,
13
13
  changeHandler = () => void 0,
14
14
  disabled = false,
15
+ forcePopover = false,
15
16
  open = false,
16
17
  quiet = false,
17
18
  staticValue = "",
@@ -29,6 +30,7 @@ export const ActionMenuMarkup = ({
29
30
  ?disabled=${disabled}
30
31
  ?open=${open}
31
32
  ?quiet=${quiet}
33
+ ?forcePopover=${forcePopover}
32
34
  static-color=${ifDefined(
33
35
  staticValue === "none" ? void 0 : staticValue
34
36
  )}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { html, nothing, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport type { ActionMenu } from '@spectrum-web-components/action-menu';\n\nexport const ActionMenuMarkup = ({\n align = 'start',\n ariaLabel = 'More Actions',\n onChange = (() => undefined) as (value: string) => void,\n changeHandler = (() => undefined) as (value: string) => void,\n disabled = false,\n open = false,\n quiet = false,\n staticValue = '',\n visibleLabel = '',\n customIcon = '' as string | TemplateResult,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n tooltipDescription = '',\n tooltipPlacement = 'bottom' as Placement,\n} = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=${ariaLabel}\n ?disabled=${disabled}\n ?open=${open}\n ?quiet=${quiet}\n static-color=${ifDefined(\n staticValue === 'none'\n ? undefined\n : (staticValue as 'black' | 'white')\n )}\n size=${size}\n @change=${(event: Event & { target: ActionMenu }) => {\n changeHandler(event.target.value);\n onChange(event.target.value);\n }}\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n ${customIcon ? customIcon : nothing}\n ${visibleLabel\n ? html`\n <span slot=\"label\">${visibleLabel}</span>\n `\n : nothing}\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n ${tooltipDescription\n ? html`\n <sp-tooltip\n slot=\"tooltip\"\n self-managed\n placement=${tooltipPlacement}\n >\n ${tooltipDescription}\n </sp-tooltip>\n `\n : html``}\n </sp-action-menu>\n `;\n};\n"],
5
- "mappings": ";AAYA,SAAS,iBAAiB;AAC1B,SAAS,MAAM,eAA+B;AAE9C,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAIA,aAAM,mBAAmB,CAAC;AAAA,EAC7B,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAY,MAAM;AAAA,EAClB,gBAAiB,MAAM;AAAA,EACvB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,mBAAmB;AACvB,IAAI,CAAC,MAAsB;AACvB,SAAO;AAAA;AAAA,oBAES,SAAS;AAAA,wBACL,QAAQ;AAAA,oBACZ,IAAI;AAAA,qBACH,KAAK;AAAA,2BACC;AAAA,IACX,gBAAgB,SACV,SACC;AAAA,EACX,CAAC;AAAA,mBACM,IAAI;AAAA,sBACD,CAAC,UAA0C;AACjD,kBAAc,MAAM,OAAO,KAAK;AAChC,aAAS,MAAM,OAAO,KAAK;AAAA,EAC/B,CAAC;AAAA,uBACU,UAAU,UAAU,MAAS;AAAA,oBAChC,WAAW,mBAAmB,EAAE;AAAA,oBAChC;AAAA,IACJ,UAAU,QAAQ,uBAAuB;AAAA,EAC7C,CAAC;AAAA;AAAA,cAEC,aAAa,aAAa,OAAO;AAAA,cACjC,eACI;AAAA,2CACyB,YAAY;AAAA,sBAErC,OAAO;AAAA;AAAA,sCAEa,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAMhC,qBACI;AAAA;AAAA;AAAA;AAAA,sCAIoB,gBAAgB;AAAA;AAAA,4BAE1B,kBAAkB;AAAA;AAAA,sBAG5B,MAAM;AAAA;AAAA;AAGxB;",
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 { html, nothing, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport type { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\n\nexport const ActionMenuMarkup = ({\n align = 'start',\n ariaLabel = 'More Actions',\n onChange = (() => undefined) as (value: string) => void,\n changeHandler = (() => undefined) as (value: string) => void,\n disabled = false,\n forcePopover = false,\n open = false,\n quiet = false,\n staticValue = '',\n visibleLabel = '',\n customIcon = '' as string | TemplateResult,\n size = 'm' as 'm' | 's' | 'l' | 'xl' | 'xxl',\n selects = '' as 'single',\n selected = false,\n tooltipDescription = '',\n tooltipPlacement = 'bottom' as Placement,\n} = {}): TemplateResult => {\n return html`\n <sp-action-menu\n label=${ariaLabel}\n ?disabled=${disabled}\n ?open=${open}\n ?quiet=${quiet}\n ?forcePopover=${forcePopover}\n static-color=${ifDefined(\n staticValue === 'none'\n ? undefined\n : (staticValue as 'black' | 'white')\n )}\n size=${size}\n @change=${(event: Event & { target: ActionMenu }) => {\n changeHandler(event.target.value);\n onChange(event.target.value);\n }}\n .selects=${selects ? selects : undefined}\n value=${selected ? 'Select Inverse' : ''}\n style=${ifDefined(\n align === 'end' ? 'float: inline-end;' : undefined\n )}\n >\n ${customIcon ? customIcon : nothing}\n ${visibleLabel\n ? html`\n <span slot=\"label\">${visibleLabel}</span>\n `\n : nothing}\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item ?selected=${selected}>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n ${tooltipDescription\n ? html`\n <sp-tooltip\n slot=\"tooltip\"\n self-managed\n placement=${tooltipPlacement}\n >\n ${tooltipDescription}\n </sp-tooltip>\n `\n : html``}\n </sp-action-menu>\n `;\n};\n"],
5
+ "mappings": ";AAYA,SAAS,MAAM,eAA+B;AAC9C,SAAS,iBAAiB;AAG1B,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,OAAO;AAEA,aAAM,mBAAmB,CAAC;AAAA,EAC7B,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAY,MAAM;AAAA,EAClB,gBAAiB,MAAM;AAAA,EACvB,WAAW;AAAA,EACX,eAAe;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,mBAAmB;AACvB,IAAI,CAAC,MAAsB;AACvB,SAAO;AAAA;AAAA,oBAES,SAAS;AAAA,wBACL,QAAQ;AAAA,oBACZ,IAAI;AAAA,qBACH,KAAK;AAAA,4BACE,YAAY;AAAA,2BACb;AAAA,IACX,gBAAgB,SACV,SACC;AAAA,EACX,CAAC;AAAA,mBACM,IAAI;AAAA,sBACD,CAAC,UAA0C;AACjD,kBAAc,MAAM,OAAO,KAAK;AAChC,aAAS,MAAM,OAAO,KAAK;AAAA,EAC/B,CAAC;AAAA,uBACU,UAAU,UAAU,MAAS;AAAA,oBAChC,WAAW,mBAAmB,EAAE;AAAA,oBAChC;AAAA,IACJ,UAAU,QAAQ,uBAAuB;AAAA,EAC7C,CAAC;AAAA;AAAA,cAEC,aAAa,aAAa,OAAO;AAAA,cACjC,eACI;AAAA,2CACyB,YAAY;AAAA,sBAErC,OAAO;AAAA;AAAA,sCAEa,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAMhC,qBACI;AAAA;AAAA;AAAA;AAAA,sCAIoB,gBAAgB;AAAA;AAAA,4BAE1B,kBAAkB;AAAA;AAAA,sBAG5B,MAAM;AAAA;AAAA;AAGxB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ import {
3
+ elementUpdated,
4
+ expect,
5
+ fixture,
6
+ html,
7
+ nextFrame,
8
+ oneEvent
9
+ } from "@open-wc/testing";
10
+ import "@spectrum-web-components/action-menu/sync/sp-action-menu.js";
11
+ import "@spectrum-web-components/menu/sp-menu-divider.js";
12
+ import "@spectrum-web-components/menu/sp-menu-item.js";
13
+ import { setViewport } from "@web/test-runner-commands";
14
+ import { spreadProps } from "../../../test/lit-helpers.js";
15
+ import { sendMouse } from "../../../test/plugins/browser.js";
16
+ describe("ActionMenu, responsive", () => {
17
+ let el;
18
+ const actionMenuFixture = async (args) => {
19
+ const test = await fixture(html`
20
+ <div>
21
+ <sp-action-menu id="action-menu" ${spreadProps(args || {})}>
22
+ <span slot="label">Action Menu</span>
23
+ <sp-menu-item>Deselect</sp-menu-item>
24
+ <sp-menu-item>Select Inverse</sp-menu-item>
25
+ <sp-menu-item>Feather...</sp-menu-item>
26
+ <sp-menu-item>Select and Mask...</sp-menu-item>
27
+ <sp-menu-divider></sp-menu-divider>
28
+ <sp-menu-item>Save Selection</sp-menu-item>
29
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
30
+ </sp-action-menu>
31
+ </div>
32
+ `);
33
+ return test.querySelector("sp-action-menu");
34
+ };
35
+ describe("container", () => {
36
+ beforeEach(async () => {
37
+ el = await actionMenuFixture();
38
+ await elementUpdated(el);
39
+ });
40
+ it("is a Tray in mobile", async () => {
41
+ el.isMobile.matches = true;
42
+ el.bindEvents();
43
+ await setViewport({ width: 360, height: 640 });
44
+ await nextFrame();
45
+ const opened = oneEvent(el, "sp-opened");
46
+ const boundingRect = el.button.getBoundingClientRect();
47
+ sendMouse({
48
+ steps: [
49
+ {
50
+ type: "click",
51
+ position: [
52
+ boundingRect.x + boundingRect.width / 2,
53
+ boundingRect.y + boundingRect.height / 2
54
+ ]
55
+ }
56
+ ]
57
+ });
58
+ await opened;
59
+ const tray = el.shadowRoot.querySelector("sp-tray");
60
+ const popover = el.shadowRoot.querySelector("sp-popover");
61
+ expect(tray).to.not.be.null;
62
+ expect(popover).to.be.null;
63
+ });
64
+ it("is a Popover in desktop", async () => {
65
+ await setViewport({ width: 701, height: 640 });
66
+ await nextFrame();
67
+ await nextFrame();
68
+ const opened = oneEvent(el, "sp-opened");
69
+ el.open = true;
70
+ await opened;
71
+ const popover = el.shadowRoot.querySelector("sp-popover");
72
+ const tray = el.shadowRoot.querySelector("sp-tray");
73
+ expect(popover).to.not.be.null;
74
+ expect(tray).to.be.null;
75
+ });
76
+ });
77
+ describe("forcePopover", () => {
78
+ beforeEach(async () => {
79
+ el = await actionMenuFixture({ forcePopover: true });
80
+ await elementUpdated(el);
81
+ });
82
+ it("is a Popover in mobile", async () => {
83
+ el.isMobile.matches = true;
84
+ el.bindEvents();
85
+ await setViewport({ width: 360, height: 640 });
86
+ await nextFrame();
87
+ const opened = oneEvent(el, "sp-opened");
88
+ const boundingRect = el.button.getBoundingClientRect();
89
+ sendMouse({
90
+ steps: [
91
+ {
92
+ type: "click",
93
+ position: [
94
+ boundingRect.x + boundingRect.width / 2,
95
+ boundingRect.y + boundingRect.height / 2
96
+ ]
97
+ }
98
+ ]
99
+ });
100
+ await opened;
101
+ const tray = el.shadowRoot.querySelector("sp-tray");
102
+ const popover = el.shadowRoot.querySelector("sp-popover");
103
+ expect(tray).to.be.null;
104
+ expect(popover).to.not.be.null;
105
+ });
106
+ it("is a Popover in desktop", async () => {
107
+ await setViewport({ width: 701, height: 640 });
108
+ await nextFrame();
109
+ await nextFrame();
110
+ const opened = oneEvent(el, "sp-opened");
111
+ el.open = true;
112
+ await opened;
113
+ const popover = el.shadowRoot.querySelector("sp-popover");
114
+ const tray = el.shadowRoot.querySelector("sp-tray");
115
+ expect(popover).to.not.be.null;
116
+ expect(tray).to.be.null;
117
+ });
118
+ });
119
+ });
120
+ //# sourceMappingURL=action-menu-responsive.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["action-menu-responsive.test.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/action-menu/sync/sp-action-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport { setViewport } from '@web/test-runner-commands';\nimport { spreadProps } from '../../../test/lit-helpers.js';\nimport { sendMouse } from '../../../test/plugins/browser.js';\n\ndescribe('ActionMenu, responsive', () => {\n let el: ActionMenu;\n const actionMenuFixture = async (args?: {\n forcePopover: boolean;\n }): Promise<ActionMenu> => {\n const test = await fixture<HTMLDivElement>(html`\n <div>\n <sp-action-menu id=\"action-menu\" ${spreadProps(args || {})}>\n <span slot=\"label\">Action Menu</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 </div>\n `);\n\n return test.querySelector('sp-action-menu') as ActionMenu;\n };\n\n describe('container', () => {\n beforeEach(async () => {\n el = await actionMenuFixture();\n await elementUpdated(el);\n });\n\n it('is a Tray in mobile', async () => {\n /**\n * This is a hack to set the `isMobile` property to true so that we can test the MobileController\n */\n el.isMobile.matches = true;\n el.bindEvents();\n\n /**\n * While we can set the view port, but not `(hover: none) and (pointer: coarse)`\n * which prevents us from testing this at unit time. Hopefully there will be\n * a future version of Playwright and/or @web/test-runner that does allow this.\n * See: https://github.com/microsoft/playwright/issues/11781\n **/\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n\n const opened = oneEvent(el, 'sp-opened');\n\n const boundingRect = el.button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n ],\n });\n\n await opened;\n\n const tray = el.shadowRoot.querySelector('sp-tray');\n const popover = el.shadowRoot.querySelector('sp-popover');\n\n expect(tray).to.not.be.null;\n expect(popover).to.be.null;\n });\n\n it('is a Popover in desktop', async () => {\n await setViewport({ width: 701, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n await nextFrame();\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n const popover = el.shadowRoot.querySelector('sp-popover');\n const tray = el.shadowRoot.querySelector('sp-tray');\n\n expect(popover).to.not.be.null;\n expect(tray).to.be.null;\n });\n });\n\n describe('forcePopover', () => {\n beforeEach(async () => {\n el = await actionMenuFixture({ forcePopover: true });\n await elementUpdated(el);\n });\n\n it('is a Popover in mobile', async () => {\n /**\n * This is a hack to set the `isMobile` property to true so that we can test the MobileController\n */\n el.isMobile.matches = true;\n el.bindEvents();\n\n /**\n * While we can set the view port, but not `(hover: none) and (pointer: coarse)`\n * which prevents us from testing this at unit time. Hopefully there will be\n * a future version of Playwright and/or @web/test-runner that does allow this.\n * See: https://github.com/microsoft/playwright/issues/11781\n **/\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n\n const opened = oneEvent(el, 'sp-opened');\n\n const boundingRect = el.button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n ],\n });\n\n await opened;\n\n const tray = el.shadowRoot.querySelector('sp-tray');\n const popover = el.shadowRoot.querySelector('sp-popover');\n\n expect(tray).to.be.null;\n expect(popover).to.not.be.null;\n });\n\n it('is a Popover in desktop', async () => {\n await setViewport({ width: 701, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n await nextFrame();\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n const popover = el.shadowRoot.querySelector('sp-popover');\n const tray = el.shadowRoot.querySelector('sp-tray');\n\n expect(popover).to.not.be.null;\n expect(tray).to.be.null;\n });\n });\n});\n"],
5
+ "mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B,MAAM;AACrC,MAAI;AACJ,QAAM,oBAAoB,OAAO,SAEN;AACvB,UAAM,OAAO,MAAM,QAAwB;AAAA;AAAA,mDAEA,YAAY,QAAQ,CAAC,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAWjE;AAED,WAAO,KAAK,cAAc,gBAAgB;AAAA,EAC9C;AAEA,WAAS,aAAa,MAAM;AACxB,eAAW,YAAY;AACnB,WAAK,MAAM,kBAAkB;AAC7B,YAAM,eAAe,EAAE;AAAA,IAC3B,CAAC;AAED,OAAG,uBAAuB,YAAY;AAIlC,SAAG,SAAS,UAAU;AACtB,SAAG,WAAW;AAQd,YAAM,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI,CAAC;AAE7C,YAAM,UAAU;AAEhB,YAAM,SAAS,SAAS,IAAI,WAAW;AAEvC,YAAM,eAAe,GAAG,OAAO,sBAAsB;AACrD,gBAAU;AAAA,QACN,OAAO;AAAA,UACH;AAAA,YACI,MAAM;AAAA,YACN,UAAU;AAAA,cACN,aAAa,IAAI,aAAa,QAAQ;AAAA,cACtC,aAAa,IAAI,aAAa,SAAS;AAAA,YAC3C;AAAA,UACJ;AAAA,QACJ;A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AW,cAAc,YAAY;AAExD,aAAO,IAAI,EAAE,GAAG,GAAG;AACnB,aAAO,OAAO,EAAE,GAAG,IAAI,GAAG;AAAA,IAC9B,CAAC;AAED,OAAG,2BAA2B,YAAY;AACtC,YAAM,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI,CAAC;AAE7C,YAAM,UAAU;AAChB,YAAM,UAAU;AAEhB,YAAM,SAAS,SAAS,IAAI,WAAW;AACvC,SAAG,OAAO;AACV,YAAM;AAEN,YAAM,UAAU,GAAG,WAAW,cAAc,YAAY;AACxD,YAAM,OAAO,GAAG,WAAW,cAAc,SAAS;AAElD,aAAO,OAAO,EAAE,GAAG,IAAI,GAAG;AAC1B,aAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACvB,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
6
+ "names": []
7
+ }
package/test/index.js CHANGED
@@ -22,7 +22,7 @@ import { findDescribedNode } from "../../../test/testing-helpers-a11y.js";
22
22
  import { sendMouse } from "../../../test/plugins/browser.js";
23
23
  import { sendKeys, setViewport } from "@web/test-runner-commands";
24
24
  import { isWebKit } from "@spectrum-web-components/shared";
25
- import { SAFARI_FOCUS_RING_CLASS } from "@spectrum-web-components/picker/src/MobileController.js";
25
+ import { SAFARI_FOCUS_RING_CLASS } from "@spectrum-web-components/picker/src/InteractionController.js";
26
26
  ignoreResizeObserverLoopError(before, after);
27
27
  const deprecatedActionMenuFixture = async () => await fixture(html`
28
28
  <sp-action-menu label="More Actions">
package/test/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n aTimeout,\n elementUpdated,\n expect,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers';\n\nimport { spy } from 'sinon';\n\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport type { Menu, MenuItem } from '@spectrum-web-components/menu';\nimport {\n fixture,\n ignoreResizeObserverLoopError,\n} from '../../../test/testing-helpers.js';\nimport '@spectrum-web-components/dialog/sp-dialog-base.js';\nimport {\n iconOnly,\n tooltipDescriptionAndPlacement,\n} from '../stories/action-menu.stories.js';\nimport { findDescribedNode } from '../../../test/testing-helpers-a11y.js';\nimport type { Tooltip } from '@spectrum-web-components/tooltip';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport type { TestablePicker } from '../../picker/test/index.js';\nimport type { Overlay } from '@spectrum-web-components/overlay';\nimport { sendKeys, setViewport } from '@web/test-runner-commands';\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport { isWebKit } from '@spectrum-web-components/shared';\nimport { SAFARI_FOCUS_RING_CLASS } from '@spectrum-web-components/picker/src/MobileController.js';\n\nignoreResizeObserverLoopError(before, after);\n\nconst deprecatedActionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(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\nconst actionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(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\nconst actionSubmenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected id=\"root-selected-item\">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=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `);\n\nexport const testActionMenu = (mode: 'sync' | 'async'): void => {\n describe(`Action menu: ${mode}`, () => {\n testForLitDevWarnings(async () => await actionMenuFixture());\n it('loads', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [slot=\"label\"]', async () => {\n const el = await fixture<ActionMenu>(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 await elementUpdated(el);\n await nextFrame();\n await nextFrame();\n\n await expect(el).to.be.accessible();\n });\n it('loads - [custom icon]', async () => {\n const el = await fixture<ActionMenu>(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 await elementUpdated(el);\n await nextFrame();\n await nextFrame();\n\n await expect(el).to.be.accessible();\n });\n it('dispatches change events, no [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${({\n target: { value },\n }: Event & { target: ActionMenu }) => {\n changeSpy(value);\n }}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-action-menu>\n `);\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await elementUpdated(el);\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(1);\n expect(changeSpy.calledWith('Deselect')).to.be.true;\n });\n it('closes when Menu Item has [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${() => {\n changeSpy();\n }}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item href=\"#\">Deselect</sp-menu-item>\n <sp-menu-item href=\"#\">Select Inverse</sp-menu-item>\n <sp-menu-item href=\"#\">Feather...</sp-menu-item>\n <sp-menu-item href=\"#\">Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item href=\"#\">Save Selection</sp-menu-item>\n <sp-menu-item href=\"#\" disabled>\n Make Work Path\n </sp-menu-item>\n </sp-action-menu>\n `);\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(0);\n });\n it('can be `quiet`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.quiet).to.be.false;\n\n el.quiet = true;\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n });\n it('can be `staticColor`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.staticColor == undefined).to.be.true;\n\n el.staticColor = 'black';\n await elementUpdated(el);\n\n expect(el.staticColor == 'black').to.be.true;\n\n el.staticColor = 'white';\n await elementUpdated(el);\n\n expect(el.staticColor == 'white').to.be.true;\n });\n it('stay `valid`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.invalid).to.be.false;\n\n el.invalid = true;\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n });\n it('focus()', async () => {\n const el = await actionMenuFixture();\n\n el.focus();\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n });\n it('manages focus-ring styles', async () => {\n if (!isWebKit()) {\n return;\n }\n\n const el = await actionMenuFixture();\n\n /**\n * This is a hack to set the `isMobile` property to true so that we can test the MobileController\n */\n el.isMobile.matches = true;\n el.bindEvents();\n\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n\n let opened = oneEvent(el, 'sp-opened');\n\n const boundingRect = el.button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n ],\n });\n\n await opened;\n\n const tray = el.shadowRoot.querySelector('sp-tray');\n expect(tray).to.not.be.null;\n\n // Make a selection\n let closed = oneEvent(el, 'sp-closed');\n\n const firstItem = el.querySelector('sp-menu-item') as MenuItem;\n firstItem.click();\n\n await elementUpdated(el);\n await closed;\n\n // expect the tray to be closed\n expect(el.open).to.be.false;\n\n const button = el.shadowRoot.querySelector(\n '#button'\n ) as HTMLButtonElement;\n expect(button).to.not.be.null;\n\n // we should have SAFARI_FOCUS_RING_CLASS in the classList\n expect(button.classList.contains(SAFARI_FOCUS_RING_CLASS)).to.be\n .true;\n\n // picker should still have focus\n expect(document.activeElement === el).to.be.true;\n\n // click outside (0,0)\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [0, 0],\n },\n ],\n });\n\n // picker should not have focus\n expect(document.activeElement === el).to.be.false;\n\n // Let's use keyboard to open the tray now\n opened = oneEvent(el, 'sp-opened');\n await sendKeys({\n press: 'Tab',\n });\n await sendKeys({\n press: 'Enter',\n });\n await elementUpdated(el);\n await opened;\n\n // Make a selection again\n closed = oneEvent(el, 'sp-closed');\n firstItem.click();\n await elementUpdated(el);\n await closed;\n\n // expect the tray to be closed\n expect(el.open).to.be.false;\n\n // we should not have SAFARI_FOCUS_RING_CLASS in the classList\n expect(button.classList.contains(SAFARI_FOCUS_RING_CLASS)).to.be\n .false;\n });\n it('opens unmeasured', async () => {\n const el = await actionMenuFixture();\n\n const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.not.have.attribute('aria-expanded', 'true');\n expect(button).to.not.have.attribute('aria-controls', 'menu');\n\n el.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n });\n it('opens repeatedly with Menu in the correct location', async function () {\n const el = await fixture<ActionMenu>(\n iconOnly({\n ...iconOnly.args,\n align: 'end',\n })\n );\n\n await elementUpdated(el);\n\n el.focus();\n await elementUpdated(el);\n let opened = oneEvent(el, 'sp-opened');\n await sendKeys({ press: 'ArrowRight' });\n await sendKeys({ press: 'ArrowLeft' });\n await sendKeys({ press: 'Space' });\n await opened;\n\n const firstRect = (\n el as unknown as { overlayElement: Overlay }\n ).overlayElement.dialogEl.getBoundingClientRect();\n\n let closed = oneEvent(el, 'sp-closed');\n await sendKeys({ press: 'Space' });\n await closed;\n\n opened = oneEvent(el, 'sp-opened');\n await sendKeys({ press: 'Space' });\n await opened;\n\n const secondRect = (\n el as unknown as { overlayElement: Overlay }\n ).overlayElement.dialogEl.getBoundingClientRect();\n\n closed = oneEvent(el, 'sp-closed');\n await sendKeys({ press: 'Space' });\n await closed;\n\n expect(firstRect).to.deep.equal(secondRect);\n });\n it('opens and selects in a single pointer button interaction', async () => {\n const el = await actionMenuFixture();\n const thirdItem = el.querySelector(\n 'sp-menu-item:nth-of-type(3)'\n ) as MenuItem;\n const boundingRect = el.button.getBoundingClientRect();\n\n expect(el.value).to.not.equal(thirdItem.value);\n const opened = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n {\n type: 'down',\n },\n ],\n });\n await opened;\n\n const thirdItemRect = thirdItem.getBoundingClientRect();\n const closed = oneEvent(el, 'sp-closed');\n let selected = '';\n el.addEventListener('change', (event: Event) => {\n selected = (event.target as ActionMenu).value;\n });\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n thirdItemRect.x + thirdItemRect.width / 2,\n thirdItemRect.y + thirdItemRect.height / 2,\n ],\n },\n {\n type: 'up',\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n expect(selected).to.equal(thirdItem.value);\n });\n it('has attribute aria-describedby', async () => {\n const name = 'sp-picker';\n const description = 'Rendering a Picker';\n\n const el = await fixture(html`\n <sp-action-menu label=${name}>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <span slot=\"description\">${description}</span>\n </sp-action-menu>\n `);\n\n await elementUpdated(el);\n\n await findDescribedNode(name, description);\n });\n it('opens unmeasured with deprecated syntax', async () => {\n const el = await deprecatedActionMenuFixture();\n\n el.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('toggles open/close multiple time', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n let opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n let closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n });\n it('allows submenu items to be selected', async () => {\n const root = await actionSubmenuFixture();\n const menuItem = root.querySelector('#item-with-submenu') as Menu;\n const submenu = menuItem.querySelector(\n 'sp-menu[slot=\"submenu\"]'\n ) as Menu;\n const selectedItem = submenu.querySelector(\n '#sub-selected-item'\n ) as MenuItem;\n\n expect(selectedItem.selected, 'item should be initially selected')\n .to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n expect(root.open).to.be.true;\n\n opened = oneEvent(menuItem, 'sp-opened');\n menuItem.dispatchEvent(\n new PointerEvent('pointerenter', { bubbles: true })\n );\n await opened;\n\n await elementUpdated(submenu);\n expect(\n selectedItem.selected,\n 'initially selected item should maintain selection'\n ).to.be.true;\n });\n it('allows top-level selection state to change', async () => {\n let selected = true;\n const handleChange = (\n event: Event & { target: ActionMenu }\n ): void => {\n if (event.target.value === 'test') {\n selected = !selected;\n\n event.target.updateComplete.then(() => {\n event.target.value = selected ? 'test' : '';\n });\n }\n };\n const root = await fixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\" @change=${handleChange}>\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected value=\"test\" id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `);\n\n const unselectedItem = root.querySelector(\n 'sp-menu-item'\n ) as MenuItem;\n const selectedItem = root.querySelector(\n '#root-selected-item'\n ) as MenuItem;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n let closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n expect(root.open).to.be.false;\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking unselected\n // (no event listener: should remain selected = false)\n closed = oneEvent(root, 'sp-closed');\n unselectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.false;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n });\n it('shows tooltip', async function () {\n const openSpy = spy();\n const el = await fixture<ActionMenu>(\n tooltipDescriptionAndPlacement(\n tooltipDescriptionAndPlacement.args\n )\n );\n const tooltip = el.querySelector('sp-tooltip') as Tooltip;\n const rect = el.getBoundingClientRect();\n tooltip.addEventListener('sp-opened', () => openSpy());\n await elementUpdated(tooltip);\n\n await nextFrame();\n await nextFrame();\n\n const overlay = tooltip.shadowRoot.querySelector(\n 'sp-overlay'\n ) as Overlay;\n await elementUpdated(overlay);\n\n expect(overlay.triggerElement === el.button).to.be.true;\n let open = oneEvent(tooltip, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n await open;\n\n expect(tooltip.open).to.be.true;\n\n const close = oneEvent(tooltip, 'sp-closed');\n open = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await close;\n await open;\n\n expect(tooltip.open, 'tooltip still open').to.be.false;\n expect(el.open, 'menu not open').to.be.true;\n\n const menu = (el as unknown as TestablePicker).optionsMenu;\n const menuRect = menu.getBoundingClientRect();\n\n await sendMouse({\n steps: [\n {\n position: [\n menuRect.left + menuRect.width / 2,\n menuRect.top + menuRect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n\n await aTimeout(150);\n\n expect(openSpy.callCount).to.equal(1);\n });\n it('opens, then closes, on subsequent clicks', async function () {\n const el = await actionMenuFixture();\n const rect = el.getBoundingClientRect();\n\n await nextFrame();\n await nextFrame();\n\n const open = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await open;\n\n expect(el.open).to.be.true;\n await aTimeout(50);\n expect(el.open).to.be.true;\n\n const close = oneEvent(el, 'sp-closed');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await close;\n\n expect(el.open).to.be.false;\n await aTimeout(50);\n expect(el.open).to.be.false;\n });\n it('should handle scroll event', async () => {\n const renderMenuItems = (): TemplateResult[] =>\n Array.from(\n { length: 30 },\n (_, i) => html`\n <sp-menu-item style=\"width: 100%;\">\n Menu Item ${i + 1}\n </sp-menu-item>\n `\n );\n const handleActionMenuScroll = spy();\n const el = await fixture<ActionMenu>(html`\n <sp-action-menu @scroll=${() => handleActionMenuScroll()}>\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 ${renderMenuItems()}\n </sp-action-menu>\n `);\n\n await elementUpdated(el);\n\n expect(handleActionMenuScroll.called).to.be.false;\n\n el.dispatchEvent(\n new Event('scroll', { cancelable: true, composed: true })\n );\n expect(handleActionMenuScroll).to.have.been.called;\n });\n });\n};\n"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n aTimeout,\n elementUpdated,\n expect,\n html,\n nextFrame,\n oneEvent,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers';\n\nimport { spy } from 'sinon';\n\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport type { Menu, MenuItem } from '@spectrum-web-components/menu';\nimport {\n fixture,\n ignoreResizeObserverLoopError,\n} from '../../../test/testing-helpers.js';\nimport '@spectrum-web-components/dialog/sp-dialog-base.js';\nimport {\n iconOnly,\n tooltipDescriptionAndPlacement,\n} from '../stories/action-menu.stories.js';\nimport { findDescribedNode } from '../../../test/testing-helpers-a11y.js';\nimport type { Tooltip } from '@spectrum-web-components/tooltip';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport type { TestablePicker } from '../../picker/test/index.js';\nimport type { Overlay } from '@spectrum-web-components/overlay';\nimport { sendKeys, setViewport } from '@web/test-runner-commands';\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport { isWebKit } from '@spectrum-web-components/shared';\nimport { SAFARI_FOCUS_RING_CLASS } from '@spectrum-web-components/picker/src/InteractionController.js';\n\nignoreResizeObserverLoopError(before, after);\n\nconst deprecatedActionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(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\nconst actionMenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(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\nconst actionSubmenuFixture = async (): Promise<ActionMenu> =>\n await fixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected id=\"root-selected-item\">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=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `);\n\nexport const testActionMenu = (mode: 'sync' | 'async'): void => {\n describe(`Action menu: ${mode}`, () => {\n testForLitDevWarnings(async () => await actionMenuFixture());\n it('loads', async () => {\n const el = await actionMenuFixture();\n await elementUpdated(el);\n\n expect(el).to.not.be.undefined;\n\n await expect(el).to.be.accessible();\n });\n it('loads - [slot=\"label\"]', async () => {\n const el = await fixture<ActionMenu>(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 await elementUpdated(el);\n await nextFrame();\n await nextFrame();\n\n await expect(el).to.be.accessible();\n });\n it('loads - [custom icon]', async () => {\n const el = await fixture<ActionMenu>(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 await elementUpdated(el);\n await nextFrame();\n await nextFrame();\n\n await expect(el).to.be.accessible();\n });\n it('dispatches change events, no [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${({\n target: { value },\n }: Event & { target: ActionMenu }) => {\n changeSpy(value);\n }}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-action-menu>\n `);\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await elementUpdated(el);\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(1);\n expect(changeSpy.calledWith('Deselect')).to.be.true;\n });\n it('closes when Menu Item has [href]', async () => {\n const changeSpy = spy();\n\n const el = await fixture<ActionMenu>(html`\n <sp-action-menu\n label=\"More Actions\"\n @change=${() => {\n changeSpy();\n }}\n >\n <sp-icon-settings slot=\"icon\"></sp-icon-settings>\n <sp-menu-item href=\"#\">Deselect</sp-menu-item>\n <sp-menu-item href=\"#\">Select Inverse</sp-menu-item>\n <sp-menu-item href=\"#\">Feather...</sp-menu-item>\n <sp-menu-item href=\"#\">Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item href=\"#\">Save Selection</sp-menu-item>\n <sp-menu-item href=\"#\" disabled>\n Make Work Path\n </sp-menu-item>\n </sp-action-menu>\n `);\n\n expect(changeSpy.callCount).to.equal(0);\n expect(el.open).to.be.false;\n\n const menuItem2 = el.querySelector(\n 'sp-menu-item:nth-child(2)'\n ) as MenuItem;\n\n const opened = oneEvent(el, 'sp-opened');\n el.click();\n await opened;\n\n expect(el.open).to.be.true;\n\n const closed = oneEvent(el, 'sp-closed');\n menuItem2.click();\n await closed;\n\n expect(el.open).to.be.false;\n expect(changeSpy.callCount).to.equal(0);\n });\n it('can be `quiet`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.quiet).to.be.false;\n\n el.quiet = true;\n await elementUpdated(el);\n\n expect(el.quiet).to.be.true;\n });\n it('can be `staticColor`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.staticColor == undefined).to.be.true;\n\n el.staticColor = 'black';\n await elementUpdated(el);\n\n expect(el.staticColor == 'black').to.be.true;\n\n el.staticColor = 'white';\n await elementUpdated(el);\n\n expect(el.staticColor == 'white').to.be.true;\n });\n it('stay `valid`', async () => {\n const el = await actionMenuFixture();\n\n expect(el.invalid).to.be.false;\n\n el.invalid = true;\n await elementUpdated(el);\n\n expect(el.invalid).to.be.false;\n });\n it('focus()', async () => {\n const el = await actionMenuFixture();\n\n el.focus();\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n\n const opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n const closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(document.activeElement).to.equal(el);\n expect(el.shadowRoot.activeElement).to.equal(el.focusElement);\n });\n it('manages focus-ring styles', async () => {\n if (!isWebKit()) {\n return;\n }\n\n const el = await actionMenuFixture();\n\n /**\n * This is a hack to set the `isMobile` property to true so that we can test the MobileController\n */\n el.isMobile.matches = true;\n el.bindEvents();\n\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n\n let opened = oneEvent(el, 'sp-opened');\n\n const boundingRect = el.button.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n ],\n });\n\n await opened;\n\n const tray = el.shadowRoot.querySelector('sp-tray');\n expect(tray).to.not.be.null;\n\n // Make a selection\n let closed = oneEvent(el, 'sp-closed');\n\n const firstItem = el.querySelector('sp-menu-item') as MenuItem;\n firstItem.click();\n\n await elementUpdated(el);\n await closed;\n\n // expect the tray to be closed\n expect(el.open).to.be.false;\n\n const button = el.shadowRoot.querySelector(\n '#button'\n ) as HTMLButtonElement;\n expect(button).to.not.be.null;\n\n // we should have SAFARI_FOCUS_RING_CLASS in the classList\n expect(button.classList.contains(SAFARI_FOCUS_RING_CLASS)).to.be\n .true;\n\n // picker should still have focus\n expect(document.activeElement === el).to.be.true;\n\n // click outside (0,0)\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [0, 0],\n },\n ],\n });\n\n // picker should not have focus\n expect(document.activeElement === el).to.be.false;\n\n // Let's use keyboard to open the tray now\n opened = oneEvent(el, 'sp-opened');\n await sendKeys({\n press: 'Tab',\n });\n await sendKeys({\n press: 'Enter',\n });\n await elementUpdated(el);\n await opened;\n\n // Make a selection again\n closed = oneEvent(el, 'sp-closed');\n firstItem.click();\n await elementUpdated(el);\n await closed;\n\n // expect the tray to be closed\n expect(el.open).to.be.false;\n\n // we should not have SAFARI_FOCUS_RING_CLASS in the classList\n expect(button.classList.contains(SAFARI_FOCUS_RING_CLASS)).to.be\n .false;\n });\n it('opens unmeasured', async () => {\n const el = await actionMenuFixture();\n\n const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.not.have.attribute('aria-expanded', 'true');\n expect(button).to.not.have.attribute('aria-controls', 'menu');\n\n el.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n });\n it('opens repeatedly with Menu in the correct location', async function () {\n const el = await fixture<ActionMenu>(\n iconOnly({\n ...iconOnly.args,\n align: 'end',\n })\n );\n\n await elementUpdated(el);\n\n el.focus();\n await elementUpdated(el);\n let opened = oneEvent(el, 'sp-opened');\n await sendKeys({ press: 'ArrowRight' });\n await sendKeys({ press: 'ArrowLeft' });\n await sendKeys({ press: 'Space' });\n await opened;\n\n const firstRect = (\n el as unknown as { overlayElement: Overlay }\n ).overlayElement.dialogEl.getBoundingClientRect();\n\n let closed = oneEvent(el, 'sp-closed');\n await sendKeys({ press: 'Space' });\n await closed;\n\n opened = oneEvent(el, 'sp-opened');\n await sendKeys({ press: 'Space' });\n await opened;\n\n const secondRect = (\n el as unknown as { overlayElement: Overlay }\n ).overlayElement.dialogEl.getBoundingClientRect();\n\n closed = oneEvent(el, 'sp-closed');\n await sendKeys({ press: 'Space' });\n await closed;\n\n expect(firstRect).to.deep.equal(secondRect);\n });\n it('opens and selects in a single pointer button interaction', async () => {\n const el = await actionMenuFixture();\n const thirdItem = el.querySelector(\n 'sp-menu-item:nth-of-type(3)'\n ) as MenuItem;\n const boundingRect = el.button.getBoundingClientRect();\n\n expect(el.value).to.not.equal(thirdItem.value);\n const opened = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n {\n type: 'down',\n },\n ],\n });\n await opened;\n\n const thirdItemRect = thirdItem.getBoundingClientRect();\n const closed = oneEvent(el, 'sp-closed');\n let selected = '';\n el.addEventListener('change', (event: Event) => {\n selected = (event.target as ActionMenu).value;\n });\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n thirdItemRect.x + thirdItemRect.width / 2,\n thirdItemRect.y + thirdItemRect.height / 2,\n ],\n },\n {\n type: 'up',\n },\n ],\n });\n await closed;\n\n expect(el.open).to.be.false;\n expect(selected).to.equal(thirdItem.value);\n });\n it('has attribute aria-describedby', async () => {\n const name = 'sp-picker';\n const description = 'Rendering a Picker';\n\n const el = await fixture(html`\n <sp-action-menu label=${name}>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <span slot=\"description\">${description}</span>\n </sp-action-menu>\n `);\n\n await elementUpdated(el);\n\n await findDescribedNode(name, description);\n });\n it('opens unmeasured with deprecated syntax', async () => {\n const el = await deprecatedActionMenuFixture();\n\n el.click();\n await elementUpdated(el);\n expect(el.open).to.be.true;\n });\n it('toggles open/close multiple time', async () => {\n const el = await actionMenuFixture();\n\n await elementUpdated(el);\n\n const button = el.button as HTMLButtonElement;\n expect(button).to.have.attribute('aria-haspopup', 'true');\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n let opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n let closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n\n opened = oneEvent(el, 'sp-opened');\n el.open = true;\n await opened;\n\n expect(el.open).to.be.true;\n expect(button).to.have.attribute('aria-expanded', 'true');\n expect(button).to.have.attribute('aria-controls', 'menu');\n\n closed = oneEvent(el, 'sp-closed');\n el.open = false;\n await closed;\n\n expect(el.open).to.be.false;\n expect(button).to.have.attribute('aria-expanded', 'false');\n expect(button).not.to.have.attribute('aria-controls');\n });\n it('allows submenu items to be selected', async () => {\n const root = await actionSubmenuFixture();\n const menuItem = root.querySelector('#item-with-submenu') as Menu;\n const submenu = menuItem.querySelector(\n 'sp-menu[slot=\"submenu\"]'\n ) as Menu;\n const selectedItem = submenu.querySelector(\n '#sub-selected-item'\n ) as MenuItem;\n\n expect(selectedItem.selected, 'item should be initially selected')\n .to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n expect(root.open).to.be.true;\n\n opened = oneEvent(menuItem, 'sp-opened');\n menuItem.dispatchEvent(\n new PointerEvent('pointerenter', { bubbles: true })\n );\n await opened;\n\n await elementUpdated(submenu);\n expect(\n selectedItem.selected,\n 'initially selected item should maintain selection'\n ).to.be.true;\n });\n it('allows top-level selection state to change', async () => {\n let selected = true;\n const handleChange = (\n event: Event & { target: ActionMenu }\n ): void => {\n if (event.target.value === 'test') {\n selected = !selected;\n\n event.target.updateComplete.then(() => {\n event.target.value = selected ? 'test' : '';\n });\n }\n };\n const root = await fixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\" @change=${handleChange}>\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item selected value=\"test\" id=\"root-selected-item\">\n Two\n </sp-menu-item>\n <sp-menu-item id=\"item-with-submenu\">\n B should be selected\n <sp-menu slot=\"submenu\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected id=\"sub-selected-item\">\n B\n </sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n `);\n\n const unselectedItem = root.querySelector(\n 'sp-menu-item'\n ) as MenuItem;\n const selectedItem = root.querySelector(\n '#root-selected-item'\n ) as MenuItem;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n\n let opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n let closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n expect(root.open).to.be.false;\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n // close by clicking unselected\n // (no event listener: should remain selected = false)\n closed = oneEvent(root, 'sp-closed');\n unselectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.false;\n\n // close by clicking selected\n // (with event listener: should set selected = false)\n closed = oneEvent(root, 'sp-closed');\n selectedItem.click();\n await closed;\n\n opened = oneEvent(root, 'sp-opened');\n root.click();\n await opened;\n\n expect(unselectedItem.textContent).to.include('One');\n expect(unselectedItem.selected).to.be.false;\n expect(selectedItem.textContent).to.include('Two');\n expect(selectedItem.selected).to.be.true;\n });\n it('shows tooltip', async function () {\n const openSpy = spy();\n const el = await fixture<ActionMenu>(\n tooltipDescriptionAndPlacement(\n tooltipDescriptionAndPlacement.args\n )\n );\n const tooltip = el.querySelector('sp-tooltip') as Tooltip;\n const rect = el.getBoundingClientRect();\n tooltip.addEventListener('sp-opened', () => openSpy());\n await elementUpdated(tooltip);\n\n await nextFrame();\n await nextFrame();\n\n const overlay = tooltip.shadowRoot.querySelector(\n 'sp-overlay'\n ) as Overlay;\n await elementUpdated(overlay);\n\n expect(overlay.triggerElement === el.button).to.be.true;\n let open = oneEvent(tooltip, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n await open;\n\n expect(tooltip.open).to.be.true;\n\n const close = oneEvent(tooltip, 'sp-closed');\n open = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await close;\n await open;\n\n expect(tooltip.open, 'tooltip still open').to.be.false;\n expect(el.open, 'menu not open').to.be.true;\n\n const menu = (el as unknown as TestablePicker).optionsMenu;\n const menuRect = menu.getBoundingClientRect();\n\n await sendMouse({\n steps: [\n {\n position: [\n menuRect.left + menuRect.width / 2,\n menuRect.top + menuRect.height / 2,\n ],\n type: 'move',\n },\n ],\n });\n\n await aTimeout(150);\n\n expect(openSpy.callCount).to.equal(1);\n });\n it('opens, then closes, on subsequent clicks', async function () {\n const el = await actionMenuFixture();\n const rect = el.getBoundingClientRect();\n\n await nextFrame();\n await nextFrame();\n\n const open = oneEvent(el, 'sp-opened');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await open;\n\n expect(el.open).to.be.true;\n await aTimeout(50);\n expect(el.open).to.be.true;\n\n const close = oneEvent(el, 'sp-closed');\n await sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n },\n ],\n });\n await close;\n\n expect(el.open).to.be.false;\n await aTimeout(50);\n expect(el.open).to.be.false;\n });\n it('should handle scroll event', async () => {\n const renderMenuItems = (): TemplateResult[] =>\n Array.from(\n { length: 30 },\n (_, i) => html`\n <sp-menu-item style=\"width: 100%;\">\n Menu Item ${i + 1}\n </sp-menu-item>\n `\n );\n const handleActionMenuScroll = spy();\n const el = await fixture<ActionMenu>(html`\n <sp-action-menu @scroll=${() => handleActionMenuScroll()}>\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 ${renderMenuItems()}\n </sp-action-menu>\n `);\n\n await elementUpdated(el);\n\n expect(handleActionMenuScroll.called).to.be.false;\n\n el.dispatchEvent(\n new Event('scroll', { cancelable: true, composed: true })\n );\n expect(handleActionMenuScroll).to.have.been.called;\n });\n });\n};\n"],
5
5
  "mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,6BAA6B;AAEtC,SAAS,WAAW;AAIpB;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,OAAO;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,yBAAyB;AAElC,SAAS,iBAAiB;AAG1B,SAAS,UAAU,mBAAmB;AAEtC,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AAExC,8BAA8B,QAAQ,KAAK;AAE3C,MAAM,8BAA8B,YAChC,MAAM,QAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAYzB;AAEL,MAAM,oBAAoB,YACtB,MAAM,QAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAUzB;AAEL,MAAM,uBAAuB,YACzB,MAAM,QAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAezB;AAEE,aAAM,iBAAiB,CAAC,SAAiC;AAC5D,WAAS,gBAAgB,IAAI,IAAI,MAAM;AACnC,0BAAsB,YAAY,MAAM,kBAAkB,CAAC;AAC3D,OAAG,SAAS,YAAY;AACpB,YAAM,KAAK,MAAM,kBAAkB;AACnC,YAAM,eAAe,EAAE;AAEvB,aAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,YAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,IACtC,CAAC;AACD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