@spectrum-web-components/menu 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +451 -155
- package/package.json +9 -9
- package/src/Menu.d.ts +16 -6
- package/src/Menu.dev.js +178 -64
- package/src/Menu.dev.js.map +2 -2
- package/src/Menu.js +7 -3
- package/src/Menu.js.map +3 -3
- package/src/MenuGroup.d.ts +0 -2
- package/src/MenuGroup.dev.js +8 -12
- package/src/MenuGroup.dev.js.map +2 -2
- package/src/MenuGroup.js +3 -5
- package/src/MenuGroup.js.map +3 -3
- package/src/MenuItem.d.ts +29 -23
- package/src/MenuItem.dev.js +204 -212
- package/src/MenuItem.dev.js.map +3 -3
- package/src/MenuItem.js +35 -18
- package/src/MenuItem.js.map +3 -3
- package/src/menu-item.css.dev.js +1 -1
- package/src/menu-item.css.dev.js.map +1 -1
- package/src/menu-item.css.js +1 -1
- package/src/menu-item.css.js.map +1 -1
- package/src/menu.css.dev.js +1 -1
- package/src/menu.css.dev.js.map +1 -1
- package/src/menu.css.js +1 -1
- package/src/menu.css.js.map +1 -1
- package/stories/index.js +4 -0
- package/stories/index.js.map +2 -2
- package/stories/submenu.stories.js +117 -104
- package/stories/submenu.stories.js.map +3 -3
- package/test/menu-group.test.js +14 -1
- package/test/menu-group.test.js.map +2 -2
- package/test/menu-item.test.js +22 -0
- package/test/menu-item.test.js.map +2 -2
- package/test/menu-selects.test.js +3 -1
- package/test/menu-selects.test.js.map +2 -2
- package/test/menu.test.js +9 -1
- package/test/menu.test.js.map +2 -2
- package/test/submenu.test.js +208 -84
- package/test/submenu.test.js.map +2 -2
package/src/MenuItem.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["MenuItem.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n ObserveSlotPresence,\n ObserveSlotText,\n} from '@spectrum-web-components/shared';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-checkmark100.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport { openOverlay } from '@spectrum-web-components/overlay/src/loader.js';\nimport { OverlayCloseEvent } from '@spectrum-web-components/overlay/src/overlay-events.js';\n\nimport menuItemStyles from './menu-item.css.js';\nimport checkmarkStyles from '@spectrum-web-components/icon/src/spectrum-icon-checkmark.css.js';\nimport type { Menu } from './Menu.dev.js'\nimport type { OverlayOpenCloseDetail } from '@spectrum-web-components/overlay';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\n\n/**\n * Duration during which a pointing device can leave an `<sp-menu-item>` element\n * and return to it or to the submenu opened from it before closing that submenu.\n **/\nconst POINTERLEAVE_TIMEOUT = 100;\n\nexport class MenuItemRemovedEvent extends Event {\n constructor() {\n super('sp-menu-item-removed', {\n bubbles: true,\n composed: true,\n });\n }\n get item(): MenuItem {\n return this._item;\n }\n _item!: MenuItem;\n focused = false;\n reset(item: MenuItem): void {\n this._item = item;\n }\n}\n\nexport class MenuItemAddedOrUpdatedEvent extends Event {\n constructor() {\n super('sp-menu-item-added-or-updated', {\n bubbles: true,\n composed: true,\n });\n }\n set focusRoot(root: Menu | undefined) {\n this.item.menuData.focusRoot = this.item.menuData.focusRoot || root;\n }\n set selectionRoot(root: Menu) {\n this.item.menuData.selectionRoot =\n this.item.menuData.selectionRoot || root;\n }\n get item(): MenuItem {\n return this._item;\n }\n _item!: MenuItem;\n set currentAncestorWithSelects(ancestor: Menu | undefined) {\n this._currentAncestorWithSelects = ancestor;\n }\n get currentAncestorWithSelects(): Menu | undefined {\n return this._currentAncestorWithSelects;\n }\n _currentAncestorWithSelects?: Menu;\n reset(item: MenuItem): void {\n this._item = item;\n this._currentAncestorWithSelects = undefined;\n item.menuData = {\n focusRoot: undefined,\n selectionRoot: undefined,\n };\n }\n}\n\nexport type MenuItemChildren = { icon: Element[]; content: Node[] };\n\nlet addOrUpdateEvent = new MenuItemAddedOrUpdatedEvent();\nlet removeEvent = new MenuItemRemovedEvent();\n/**\n * Code to cleanup these global events async in batches\n */\nlet addOrUpdateEventRafId = 0;\nfunction resetAddOrUpdateEvent(): void {\n if (addOrUpdateEventRafId === 0) {\n addOrUpdateEventRafId = requestAnimationFrame(() => {\n addOrUpdateEvent = new MenuItemAddedOrUpdatedEvent();\n addOrUpdateEventRafId = 0;\n });\n }\n}\nlet removeEventEventtRafId = 0;\nfunction resetRemoveEvent(): void {\n if (removeEventEventtRafId === 0) {\n removeEventEventtRafId = requestAnimationFrame(() => {\n removeEvent = new MenuItemRemovedEvent();\n removeEventEventtRafId = 0;\n });\n }\n}\n\n/**\n * @element sp-menu-item\n *\n * @slot - text content to display within the Menu Item\n * @slot icon - icon element to be placed at the start of the Menu Item\n * @slot value - content placed at the end of the Menu Item like values, keyboard shortcuts, etc.\n * @slot submenu - content placed in a submenu\n * @fires sp-menu-item-added - announces the item has been added so a parent menu can take ownerships\n * @fires sp-menu-item-removed - announces when removed from the DOM so the parent menu can remove ownership and update selected state\n */\nexport class MenuItem extends LikeAnchor(\n ObserveSlotText(ObserveSlotPresence(Focusable, '[slot=\"icon\"]'))\n) {\n public static override get styles(): CSSResultArray {\n return [menuItemStyles, checkmarkStyles, chevronStyles];\n }\n\n static instanceCount = 0;\n\n private isInSubmenu = false;\n\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ type: String })\n public get value(): string {\n return this._value || this.itemText;\n }\n\n public set value(value: string) {\n if (value === this._value) {\n return;\n }\n this._value = value || '';\n if (this._value) {\n this.setAttribute('value', this._value);\n } else {\n this.removeAttribute('value');\n }\n }\n\n private _value = '';\n\n /**\n * @private\n */\n public get itemText(): string {\n return this.itemChildren.content.reduce(\n (acc, node) => acc + (node.textContent || '').trim(),\n ''\n );\n }\n\n @property({ type: Boolean, reflect: true, attribute: 'has-submenu' })\n public hasSubmenu = false;\n\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'no-wrap',\n hasChanged() {\n return false;\n },\n })\n public noWrap = false;\n\n @query('.anchor')\n private anchorElement!: HTMLAnchorElement;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n public get itemChildren(): MenuItemChildren {\n if (this._itemChildren) {\n return this._itemChildren;\n }\n\n const iconSlot = this.shadowRoot?.querySelector(\n 'slot[name=\"icon\"]'\n ) as HTMLSlotElement;\n const icon = !iconSlot\n ? []\n : iconSlot.assignedElements().map((element) => {\n const newElement = element.cloneNode(true) as HTMLElement;\n newElement.removeAttribute('slot');\n newElement.classList.toggle('icon');\n return newElement;\n });\n const contentSlot = this.shadowRoot?.querySelector(\n 'slot:not([name])'\n ) as HTMLSlotElement;\n const content = !contentSlot\n ? []\n : contentSlot.assignedNodes().map((node) => node.cloneNode(true));\n this._itemChildren = { icon, content };\n\n return this._itemChildren;\n }\n\n private _itemChildren?: MenuItemChildren;\n\n constructor() {\n super();\n this.proxyFocus = this.proxyFocus.bind(this);\n\n this.addEventListener('click', this.handleClickCapture, {\n capture: true,\n });\n\n new MutationController(this, {\n config: {\n characterData: true,\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.breakItemChildrenCache();\n },\n });\n }\n\n @property({ type: Boolean })\n public open = false;\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n\n super.click();\n }\n\n private handleClickCapture(event: Event): void | boolean {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n return false;\n }\n }\n\n private proxyFocus(): void {\n this.focus();\n }\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n this.anchorElement.click();\n handled = true;\n }\n return handled;\n }\n\n protected breakItemChildrenCache(): void {\n this._itemChildren = undefined;\n this.triggerUpdate();\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.selected\n ? html`\n <sp-icon-checkmark100\n id=\"selected\"\n class=\"spectrum-UIIcon-Checkmark100 \n icon \n checkmark\n ${this.hasIcon\n ? 'checkmark--withAdjacentIcon'\n : ''}\"\n ></sp-icon-checkmark100>\n `\n : html``}\n <slot name=\"icon\"></slot>\n <div id=\"label\">\n <slot id=\"slot\"></slot>\n </div>\n <slot name=\"value\"></slot>\n ${this.href && this.href.length > 0\n ? super.renderAnchor({\n id: 'button',\n ariaHidden: true,\n className: 'button anchor hidden',\n })\n : html``}\n\n <slot\n hidden\n name=\"submenu\"\n @slotchange=${this.manageSubmenu}\n ></slot>\n ${this.hasSubmenu\n ? html`\n <sp-icon-chevron100\n class=\"spectrum-UIIcon-ChevronRight100\n chevron\n icon\"\n ></sp-icon-chevron100>\n `\n : html``}\n `;\n }\n\n protected manageSubmenu(event: Event & { target: HTMLSlotElement }): void {\n const assignedElements = event.target.assignedElements({\n flatten: true,\n });\n this.hasSubmenu = this.open || !!assignedElements;\n if (this.hasSubmenu) {\n this.setAttribute('aria-haspopup', 'true');\n }\n }\n\n private handleRemoveActive(event: Event): void {\n if (\n (event.type === 'pointerleave' && this.hasSubmenu) ||\n this.hasSubmenu ||\n this.open\n ) {\n return;\n }\n this.active = false;\n }\n\n private handlePointerdown(): void {\n this.active = true;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('tabindex', '-1');\n this.addEventListener('pointerdown', this.handlePointerdown);\n if (!this.hasAttribute('id')) {\n this.id = `sp-menu-item-${MenuItem.instanceCount++}`;\n }\n this.addEventListener('pointerenter', this.closeOverlaysForRoot);\n }\n\n protected closeOverlaysForRoot(): void {\n if (this.open) return;\n const overalyCloseEvent = new OverlayCloseEvent({\n root: this.menuData.focusRoot,\n });\n this.dispatchEvent(overalyCloseEvent);\n }\n\n public closeOverlay?: () => Promise<void>;\n\n protected handleSubmenuClick(): void {\n this.openOverlay();\n }\n\n protected handlePointerenter(): void {\n if (this.leaveTimeout) {\n clearTimeout(this.leaveTimeout);\n delete this.leaveTimeout;\n return;\n }\n this.openOverlay();\n }\n\n protected leaveTimeout?: ReturnType<typeof setTimeout>;\n\n protected handlePointerleave(): void {\n if (this.hasSubmenu && this.open) {\n this.leaveTimeout = setTimeout(() => {\n delete this.leaveTimeout;\n if (this.closeOverlay) this.closeOverlay();\n }, POINTERLEAVE_TIMEOUT);\n }\n }\n\n /**\n * When there is a `change` event in the submenu for this item\n * then we \"click\" this item to cascade the selection up the\n * menu tree allowing all submenus between the initial selection\n * and the root of the tree to have their selection changes and\n * be closed.\n */\n protected handleSubmenuChange = (): void => {\n this.menuData.selectionRoot?.selectOrToggleItem(this);\n };\n\n protected handleSubmenuPointerenter = (): void => {\n if (this.leaveTimeout) {\n clearTimeout(this.leaveTimeout);\n delete this.leaveTimeout;\n }\n };\n\n public async openOverlay(): Promise<void> {\n if (!this.hasSubmenu || this.open || this.disabled) {\n return;\n }\n this.open = true;\n this.active = true;\n this.setAttribute('aria-expanded', 'true');\n const submenu = (\n this.shadowRoot.querySelector(\n 'slot[name=\"submenu\"]'\n ) as HTMLSlotElement\n ).assignedElements()[0] as Menu;\n submenu.addEventListener(\n 'pointerenter',\n this.handleSubmenuPointerenter\n );\n submenu.addEventListener('change', this.handleSubmenuChange);\n if (!submenu.id) {\n submenu.setAttribute('id', `${this.id}-submenu`);\n }\n this.setAttribute('aria-controls', submenu.id);\n const popover = document.createElement('sp-popover');\n const returnSubmenu = reparentChildren([submenu], popover, {\n position: 'beforeend',\n prepareCallback: (el) => {\n const slotName = el.slot;\n el.tabIndex = 0;\n el.removeAttribute('slot');\n el.isSubmenu = true;\n return (el) => {\n el.tabIndex = -1;\n el.slot = slotName;\n el.isSubmenu = false;\n };\n },\n });\n const closeOverlay = openOverlay(this, 'click', popover, {\n placement: this.isLTR ? 'right-start' : 'left-start',\n receivesFocus: 'auto',\n root: this.menuData.focusRoot,\n });\n const closeSubmenu = async (): Promise<void> => {\n this.setAttribute('aria-expanded', 'false');\n delete this.closeOverlay;\n (await closeOverlay)();\n };\n this.closeOverlay = closeSubmenu;\n const cleanup = (event: CustomEvent<OverlayOpenCloseDetail>): void => {\n event.stopPropagation();\n delete this.closeOverlay;\n returnSubmenu();\n this.open = false;\n this.active = false;\n };\n this.addEventListener('sp-closed', cleanup as EventListener, {\n once: true,\n });\n popover.addEventListener('change', closeSubmenu);\n }\n\n updateAriaSelected(): void {\n const role = this.getAttribute('role');\n if (role === 'option') {\n this.setAttribute(\n 'aria-selected',\n this.selected ? 'true' : 'false'\n );\n } else if (role === 'menuitemcheckbox' || role === 'menuitemradio') {\n this.setAttribute('aria-checked', this.selected ? 'true' : 'false');\n }\n }\n\n public setRole(role: string): void {\n this.setAttribute('role', role);\n this.updateAriaSelected();\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n super.updated(changes);\n if (changes.has('label')) {\n this.setAttribute('aria-label', this.label || '');\n }\n if (changes.has('active')) {\n if (this.active) {\n this.addEventListener('pointerup', this.handleRemoveActive);\n this.addEventListener('pointerleave', this.handleRemoveActive);\n this.addEventListener('pointercancel', this.handleRemoveActive);\n } else {\n this.removeEventListener('pointerup', this.handleRemoveActive);\n this.removeEventListener(\n 'pointerleave',\n this.handleRemoveActive\n );\n this.removeEventListener(\n 'pointercancel',\n this.handleRemoveActive\n );\n }\n }\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n if (changes.has('selected')) {\n this.updateAriaSelected();\n }\n if (changes.has('hasSubmenu')) {\n if (this.hasSubmenu) {\n this.addEventListener('click', this.handleSubmenuClick);\n this.addEventListener('pointerenter', this.handlePointerenter);\n this.addEventListener('pointerleave', this.handlePointerleave);\n } else if (!this.closeOverlay) {\n this.removeEventListener('click', this.handleSubmenuClick);\n this.removeEventListener(\n 'pointerenter',\n this.handlePointerenter\n );\n this.removeEventListener(\n 'pointerleave',\n this.handlePointerleave\n );\n }\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.isInSubmenu = !!this.closest('[slot=\"submenu\"]');\n if (this.isInSubmenu) {\n return;\n }\n addOrUpdateEvent.reset(this);\n this.dispatchEvent(addOrUpdateEvent);\n resetAddOrUpdateEvent();\n this._parentElement = this.parentElement as HTMLElement;\n }\n\n _parentElement!: HTMLElement;\n\n public override disconnectedCallback(): void {\n if (!this.isInSubmenu && this._parentElement) {\n removeEvent.reset(this);\n this._parentElement.dispatchEvent(removeEvent);\n resetRemoveEvent();\n }\n this.isInSubmenu = false;\n this._itemChildren = undefined;\n super.disconnectedCallback();\n }\n\n public async triggerUpdate(): Promise<void> {\n if (this.isInSubmenu) {\n return;\n }\n await new Promise((ready) => requestAnimationFrame(ready));\n addOrUpdateEvent.reset(this);\n this.dispatchEvent(addOrUpdateEvent);\n resetAddOrUpdateEvent();\n }\n\n public menuData: {\n focusRoot?: Menu;\n selectionRoot?: Menu;\n } = {\n focusRoot: undefined,\n selectionRoot: undefined,\n };\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-menu-item-added-or-updated': MenuItemAddedOrUpdatedEvent;\n 'sp-menu-item-removed': MenuItemRemovedEvent;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,OAGG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AACP,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,OAAO;AACP,OAAO,mBAAmB;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n ObserveSlotPresence,\n ObserveSlotText,\n} from '@spectrum-web-components/shared';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-checkmark100.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\n\nimport menuItemStyles from './menu-item.css.js';\nimport checkmarkStyles from '@spectrum-web-components/icon/src/spectrum-icon-checkmark.css.js';\nimport type { Menu } from './Menu.dev.js'\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\nimport type { Overlay } from 'overlay/src/Overlay.js';\n\n/**\n * Duration during which a pointing device can leave an `<sp-menu-item>` element\n * and return to it or to the submenu opened from it before closing that submenu.\n **/\nconst POINTERLEAVE_TIMEOUT = 100;\n\ntype MenuCascadeItem = {\n hadFocusRoot: boolean;\n ancestorWithSelects?: HTMLElement;\n};\n\nexport class MenuItemAddedOrUpdatedEvent extends Event {\n constructor(item: MenuItem) {\n super('sp-menu-item-added-or-updated', {\n bubbles: true,\n composed: true,\n });\n this.clear(item);\n }\n clear(item: MenuItem): void {\n this._item = item;\n this.currentAncestorWithSelects = undefined;\n item.menuData = {\n cleanupSteps: [],\n focusRoot: undefined,\n selectionRoot: undefined,\n parentMenu: undefined,\n };\n this.menuCascade = new WeakMap<HTMLElement, MenuCascadeItem>();\n }\n menuCascade = new WeakMap<HTMLElement, MenuCascadeItem>();\n get item(): MenuItem {\n return this._item;\n }\n private _item!: MenuItem;\n currentAncestorWithSelects?: Menu;\n}\n\nexport type MenuItemChildren = { icon: Element[]; content: Node[] };\n\n/**\n * @element sp-menu-item\n *\n * @slot - text content to display within the Menu Item\n * @slot icon - icon element to be placed at the start of the Menu Item\n * @slot value - content placed at the end of the Menu Item like values, keyboard shortcuts, etc.\n * @slot submenu - content placed in a submenu\n * @fires sp-menu-item-added - announces the item has been added so a parent menu can take ownerships\n */\nexport class MenuItem extends LikeAnchor(\n ObserveSlotText(ObserveSlotPresence(Focusable, '[slot=\"icon\"]'))\n) {\n public static override get styles(): CSSResultArray {\n return [menuItemStyles, checkmarkStyles, chevronStyles];\n }\n\n abortControllerPointer!: AbortController;\n\n abortControllerSubmenu!: AbortController;\n\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ type: String })\n public get value(): string {\n return this._value || this.itemText;\n }\n\n public set value(value: string) {\n if (value === this._value) {\n return;\n }\n this._value = value || '';\n if (this._value) {\n this.setAttribute('value', this._value);\n } else {\n this.removeAttribute('value');\n }\n }\n\n private _value = '';\n\n /**\n * @private\n */\n public get itemText(): string {\n return this.itemChildren.content.reduce(\n (acc, node) => acc + (node.textContent || '').trim(),\n ''\n );\n }\n\n @property({ type: Boolean, reflect: true, attribute: 'has-submenu' })\n public hasSubmenu = false;\n\n @query('slot:not([name])')\n contentSlot!: HTMLSlotElement;\n\n @query('slot[name=\"icon\"]')\n iconSlot!: HTMLSlotElement;\n\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'no-wrap',\n hasChanged() {\n return false;\n },\n })\n public noWrap = false;\n\n @query('.anchor')\n private anchorElement!: HTMLAnchorElement;\n\n @query('sp-overlay')\n public overlayElement!: Overlay;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n public get itemChildren(): MenuItemChildren {\n if (this._itemChildren) {\n return this._itemChildren;\n }\n const icon = this.iconSlot.assignedElements().map((element) => {\n const newElement = element.cloneNode(true) as HTMLElement;\n newElement.removeAttribute('slot');\n newElement.classList.toggle('icon');\n return newElement;\n });\n const content = this.contentSlot\n .assignedNodes()\n .map((node) => node.cloneNode(true));\n this._itemChildren = { icon, content };\n\n return this._itemChildren;\n }\n\n private _itemChildren?: MenuItemChildren;\n\n constructor() {\n super();\n this.addEventListener('click', this.handleClickCapture, {\n capture: true,\n });\n\n new MutationController(this, {\n config: {\n characterData: true,\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.breakItemChildrenCache();\n },\n });\n }\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n\n super.click();\n }\n\n private handleClickCapture(event: Event): void | boolean {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n return false;\n }\n }\n\n private proxyFocus = (): void => {\n this.focus();\n };\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n this.anchorElement.click();\n handled = true;\n }\n return handled;\n }\n\n protected breakItemChildrenCache(): void {\n this._itemChildren = undefined;\n this.triggerUpdate();\n }\n\n protected renderSubmenu(): TemplateResult {\n const slot = html`\n <slot\n name=\"submenu\"\n @slotchange=${this.manageSubmenu}\n @sp-menu-item-added-or-updated=${{\n handleEvent: (event: MenuItemAddedOrUpdatedEvent) => {\n event.clear(event.item);\n },\n capture: true,\n }}\n @focusin=${(event: Event) => event.stopPropagation()}\n ></slot>\n `;\n if (!this.hasSubmenu) {\n return slot;\n }\n import('@spectrum-web-components/overlay/sp-overlay.js');\n import('@spectrum-web-components/popover/sp-popover.js');\n return html`\n <sp-overlay\n .triggerElement=${this as HTMLElement}\n ?disabled=${!this.hasSubmenu}\n ?open=${this.hasSubmenu && this.open}\n .placement=${this.isLTR ? 'right-start' : 'left-start'}\n .offset=${[-10, -4] as [number, number]}\n .type=${'auto'}\n @close=${(event: Event) => event.stopPropagation()}\n >\n <sp-popover\n @change=${(event: Event) => {\n this.handleSubmenuChange(event);\n this.open = false;\n }}\n @pointerenter=${this.handleSubmenuPointerenter}\n @pointerleave=${this.handleSubmenuPointerleave}\n @sp-menu-item-added-or-updated=${(event: Event) =>\n event.stopPropagation()}\n >\n ${slot}\n </sp-popover>\n </sp-overlay>\n <sp-icon-chevron100\n class=\"spectrum-UIIcon-ChevronRight100 chevron icon\"\n ></sp-icon-chevron100>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.selected\n ? html`\n <sp-icon-checkmark100\n id=\"selected\"\n class=\"spectrum-UIIcon-Checkmark100 \n icon \n checkmark\n ${this.hasIcon\n ? 'checkmark--withAdjacentIcon'\n : ''}\"\n ></sp-icon-checkmark100>\n `\n : html``}\n <slot name=\"icon\"></slot>\n <div id=\"label\">\n <slot id=\"slot\"></slot>\n </div>\n <slot name=\"value\"></slot>\n ${this.href && this.href.length > 0\n ? super.renderAnchor({\n id: 'button',\n ariaHidden: true,\n className: 'button anchor hidden',\n })\n : html``}\n ${this.renderSubmenu()}\n `;\n }\n\n protected manageSubmenu(event: Event & { target: HTMLSlotElement }): void {\n const assignedElements = event.target.assignedElements({\n flatten: true,\n });\n this.hasSubmenu = !!assignedElements.length;\n if (this.hasSubmenu) {\n this.setAttribute('aria-haspopup', 'true');\n }\n }\n\n private handleRemoveActive(): void {\n if (this.open) {\n return;\n }\n this.active = false;\n }\n\n private handlePointerdown(event: PointerEvent): void {\n this.active = true;\n if (event.target === this && this.hasSubmenu && this.open) {\n this.addEventListener('focus', this.handleSubmenuFocus, {\n once: true,\n });\n this.overlayElement.addEventListener(\n 'beforetoggle',\n this.handleBeforetoggle\n );\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('tabindex', '-1');\n this.addEventListener('pointerdown', this.handlePointerdown);\n this.addEventListener('pointerenter', this.closeOverlaysForRoot);\n if (!this.hasAttribute('id')) {\n this.id = `sp-menu-item-${crypto.randomUUID().slice(0, 8)}`;\n }\n }\n\n protected closeOverlaysForRoot(): void {\n if (this.open) return;\n this.menuData.parentMenu?.closeDescendentOverlays();\n }\n\n protected handleSubmenuClick(event: Event): void {\n if (event.composedPath().includes(this.overlayElement)) {\n return;\n }\n this.openOverlay();\n }\n\n protected handleSubmenuFocus(): void {\n requestAnimationFrame(() => {\n // Wait till after `closeDescendentOverlays` has happened in Menu\n // to reopen (keey open) the direct descendent of this Menu Item\n this.overlayElement.open = this.open;\n });\n }\n\n protected handleBeforetoggle = (event: Event): void => {\n if ((event as Event & { newState: string }).newState === 'closed') {\n this.open = true;\n this.overlayElement.manuallyKeepOpen();\n this.overlayElement.removeEventListener(\n 'beforetoggle',\n this.handleBeforetoggle\n );\n }\n };\n\n protected handlePointerenter(): void {\n if (this.leaveTimeout) {\n clearTimeout(this.leaveTimeout);\n delete this.leaveTimeout;\n return;\n }\n this.openOverlay();\n }\n\n protected leaveTimeout?: ReturnType<typeof setTimeout>;\n protected recentlyLeftChild = false;\n\n protected handlePointerleave(): void {\n if (this.open && !this.recentlyLeftChild) {\n this.leaveTimeout = setTimeout(() => {\n delete this.leaveTimeout;\n this.open = false;\n }, POINTERLEAVE_TIMEOUT);\n }\n }\n\n /**\n * When there is a `change` event in the submenu for this item\n * then we \"click\" this item to cascade the selection up the\n * menu tree allowing all submenus between the initial selection\n * and the root of the tree to have their selection changes and\n * be closed.\n */\n protected handleSubmenuChange(event: Event): void {\n event.stopPropagation();\n this.menuData.selectionRoot?.selectOrToggleItem(this);\n }\n\n protected handleSubmenuPointerenter(): void {\n this.recentlyLeftChild = true;\n }\n\n protected async handleSubmenuPointerleave(): Promise<void> {\n requestAnimationFrame(() => {\n this.recentlyLeftChild = false;\n });\n }\n\n protected handleSubmenuOpen(event: Event): void {\n this.focused = false;\n const parentOverlay = event.composedPath().find((el) => {\n return (\n el !== this.overlayElement &&\n (el as HTMLElement).localName === 'sp-overlay'\n );\n }) as Overlay;\n this.overlayElement.parentOverlayToForceClose = parentOverlay;\n }\n\n protected cleanup(): void {\n this.open = false;\n this.active = false;\n }\n\n public async openOverlay(): Promise<void> {\n if (!this.hasSubmenu || this.open || this.disabled) {\n return;\n }\n this.open = true;\n this.active = true;\n this.setAttribute('aria-expanded', 'true');\n this.addEventListener('sp-closed', this.cleanup, {\n once: true,\n });\n }\n\n updateAriaSelected(): void {\n const role = this.getAttribute('role');\n if (role === 'option') {\n this.setAttribute(\n 'aria-selected',\n this.selected ? 'true' : 'false'\n );\n } else if (role === 'menuitemcheckbox' || role === 'menuitemradio') {\n this.setAttribute('aria-checked', this.selected ? 'true' : 'false');\n }\n }\n\n public setRole(role: string): void {\n this.setAttribute('role', role);\n this.updateAriaSelected();\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n super.updated(changes);\n if (\n changes.has('label') &&\n (this.label || typeof changes.get('label') !== 'undefined')\n ) {\n this.setAttribute('aria-label', this.label || '');\n }\n if (\n changes.has('active') &&\n (this.active || typeof changes.get('active') !== 'undefined')\n ) {\n if (this.active) {\n this.menuData.selectionRoot?.closeDescendentOverlays();\n this.abortControllerPointer = new AbortController();\n const options = { signal: this.abortControllerPointer.signal };\n this.addEventListener(\n 'pointerup',\n this.handleRemoveActive,\n options\n );\n this.addEventListener(\n 'pointerleave',\n this.handleRemoveActive,\n options\n );\n this.addEventListener(\n 'pointercancel',\n this.handleRemoveActive,\n options\n );\n } else {\n this.abortControllerPointer?.abort();\n }\n }\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n if (changes.has('selected')) {\n this.updateAriaSelected();\n }\n if (\n changes.has('hasSubmenu') &&\n (this.hasSubmenu ||\n typeof changes.get('hasSubmenu') !== 'undefined')\n ) {\n if (this.hasSubmenu) {\n this.abortControllerSubmenu = new AbortController();\n const options = { signal: this.abortControllerSubmenu.signal };\n this.addEventListener(\n 'click',\n this.handleSubmenuClick,\n options\n );\n this.addEventListener(\n 'pointerenter',\n this.handlePointerenter,\n options\n );\n this.addEventListener(\n 'pointerleave',\n this.handlePointerleave,\n options\n );\n this.addEventListener(\n 'sp-opened',\n this.handleSubmenuOpen,\n options\n );\n } else {\n this.abortControllerSubmenu?.abort();\n }\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.triggerUpdate();\n }\n\n _parentElement!: HTMLElement;\n\n public override disconnectedCallback(): void {\n this.menuData.cleanupSteps.forEach((removal) => removal(this));\n super.disconnectedCallback();\n }\n\n private willDispatchUpdate = false;\n\n public async triggerUpdate(): Promise<void> {\n if (this.willDispatchUpdate) {\n return;\n }\n this.willDispatchUpdate = true;\n await new Promise((ready) => requestAnimationFrame(ready));\n this.dispatchUpdate();\n }\n\n public dispatchUpdate(): void {\n this.dispatchEvent(new MenuItemAddedOrUpdatedEvent(this));\n this.willDispatchUpdate = false;\n }\n\n public menuData: {\n focusRoot?: Menu;\n parentMenu?: Menu;\n selectionRoot?: Menu;\n cleanupSteps: ((item: MenuItem) => void)[];\n } = {\n focusRoot: undefined,\n parentMenu: undefined,\n selectionRoot: undefined,\n cleanupSteps: [],\n };\n}\n\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AAA,EADP,MAAM,SAAS;AAAA,GApEP,SAqED;AAGD;AAAA,EADN,MAAM,YAAY;AAAA,GAvEV,SAwEF;AAiDA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAxHjC,SAyHF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/src/MenuItem.js
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
|
|
1
|
+
"use strict";var h=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var r=(d,a,e,t)=>{for(var i=t>1?void 0:t?c(a,e):a,o=d.length-1,n;o>=0;o--)(n=d[o])&&(i=(t?n(a,e,i):n(i))||i);return t&&i&&h(a,e,i),i};import{html as l}from"@spectrum-web-components/base";import{ObserveSlotPresence as p,ObserveSlotText as m}from"@spectrum-web-components/shared";import{property as s,query as u}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-checkmark100.js";import{LikeAnchor as v}from"@spectrum-web-components/shared/src/like-anchor.js";import{Focusable as b}from"@spectrum-web-components/shared/src/focusable.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js";import f from"@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js";import E from"./menu-item.css.js";import y from"@spectrum-web-components/icon/src/spectrum-icon-checkmark.css.js";import{MutationController as g}from"@lit-labs/observers/mutation-controller.js";const S=100;export class MenuItemAddedOrUpdatedEvent extends Event{constructor(e){super("sp-menu-item-added-or-updated",{bubbles:!0,composed:!0});this.menuCascade=new WeakMap;this.clear(e)}clear(e){this._item=e,this.currentAncestorWithSelects=void 0,e.menuData={cleanupSteps:[],focusRoot:void 0,selectionRoot:void 0,parentMenu:void 0},this.menuCascade=new WeakMap}get item(){return this._item}}export class MenuItem extends v(m(p(b,'[slot="icon"]'))){constructor(){super();this.active=!1;this.focused=!1;this.selected=!1;this._value="";this.hasSubmenu=!1;this.noWrap=!1;this.open=!1;this.proxyFocus=()=>{this.focus()};this.handleBeforetoggle=e=>{e.newState==="closed"&&(this.open=!0,this.overlayElement.manuallyKeepOpen(),this.overlayElement.removeEventListener("beforetoggle",this.handleBeforetoggle))};this.recentlyLeftChild=!1;this.willDispatchUpdate=!1;this.menuData={focusRoot:void 0,parentMenu:void 0,selectionRoot:void 0,cleanupSteps:[]};this.addEventListener("click",this.handleClickCapture,{capture:!0}),new g(this,{config:{characterData:!0,childList:!0,subtree:!0},callback:()=>{this.breakItemChildrenCache()}})}static get styles(){return[E,y,f]}get value(){return this._value||this.itemText}set value(e){e!==this._value&&(this._value=e||"",this._value?this.setAttribute("value",this._value):this.removeAttribute("value"))}get itemText(){return this.itemChildren.content.reduce((e,t)=>e+(t.textContent||"").trim(),"")}get focusElement(){return this}get hasIcon(){return this.slotContentIsPresent}get itemChildren(){if(this._itemChildren)return this._itemChildren;const e=this.iconSlot.assignedElements().map(i=>{const o=i.cloneNode(!0);return o.removeAttribute("slot"),o.classList.toggle("icon"),o}),t=this.contentSlot.assignedNodes().map(i=>i.cloneNode(!0));return this._itemChildren={icon:e,content:t},this._itemChildren}click(){this.disabled||this.shouldProxyClick()||super.click()}handleClickCapture(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),!1}shouldProxyClick(){let e=!1;return this.anchorElement&&(this.anchorElement.click(),e=!0),e}breakItemChildrenCache(){this._itemChildren=void 0,this.triggerUpdate()}renderSubmenu(){const e=l`
|
|
2
|
+
<slot
|
|
3
|
+
name="submenu"
|
|
4
|
+
@slotchange=${this.manageSubmenu}
|
|
5
|
+
@sp-menu-item-added-or-updated=${{handleEvent:t=>{t.clear(t.item)},capture:!0}}
|
|
6
|
+
@focusin=${t=>t.stopPropagation()}
|
|
7
|
+
></slot>
|
|
8
|
+
`;return this.hasSubmenu?(import("@spectrum-web-components/overlay/sp-overlay.js"),import("@spectrum-web-components/popover/sp-popover.js"),l`
|
|
9
|
+
<sp-overlay
|
|
10
|
+
.triggerElement=${this}
|
|
11
|
+
?disabled=${!this.hasSubmenu}
|
|
12
|
+
?open=${this.hasSubmenu&&this.open}
|
|
13
|
+
.placement=${this.isLTR?"right-start":"left-start"}
|
|
14
|
+
.offset=${[-10,-4]}
|
|
15
|
+
.type=${"auto"}
|
|
16
|
+
@close=${t=>t.stopPropagation()}
|
|
17
|
+
>
|
|
18
|
+
<sp-popover
|
|
19
|
+
@change=${t=>{this.handleSubmenuChange(t),this.open=!1}}
|
|
20
|
+
@pointerenter=${this.handleSubmenuPointerenter}
|
|
21
|
+
@pointerleave=${this.handleSubmenuPointerleave}
|
|
22
|
+
@sp-menu-item-added-or-updated=${t=>t.stopPropagation()}
|
|
23
|
+
>
|
|
24
|
+
${e}
|
|
25
|
+
</sp-popover>
|
|
26
|
+
</sp-overlay>
|
|
27
|
+
<sp-icon-chevron100
|
|
28
|
+
class="spectrum-UIIcon-ChevronRight100 chevron icon"
|
|
29
|
+
></sp-icon-chevron100>
|
|
30
|
+
`):e}render(){return l`
|
|
31
|
+
${this.selected?l`
|
|
3
32
|
<sp-icon-checkmark100
|
|
4
33
|
id="selected"
|
|
5
34
|
class="spectrum-UIIcon-Checkmark100
|
|
@@ -7,25 +36,13 @@
|
|
|
7
36
|
checkmark
|
|
8
37
|
${this.hasIcon?"checkmark--withAdjacentIcon":""}"
|
|
9
38
|
></sp-icon-checkmark100>
|
|
10
|
-
`:
|
|
39
|
+
`:l``}
|
|
11
40
|
<slot name="icon"></slot>
|
|
12
41
|
<div id="label">
|
|
13
42
|
<slot id="slot"></slot>
|
|
14
43
|
</div>
|
|
15
44
|
<slot name="value"></slot>
|
|
16
|
-
${this.href&&this.href.length>0?super.renderAnchor({id:"button",ariaHidden:!0,className:"button anchor hidden"}):
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
hidden
|
|
20
|
-
name="submenu"
|
|
21
|
-
@slotchange=${this.manageSubmenu}
|
|
22
|
-
></slot>
|
|
23
|
-
${this.hasSubmenu?c`
|
|
24
|
-
<sp-icon-chevron100
|
|
25
|
-
class="spectrum-UIIcon-ChevronRight100
|
|
26
|
-
chevron
|
|
27
|
-
icon"
|
|
28
|
-
></sp-icon-chevron100>
|
|
29
|
-
`:c``}
|
|
30
|
-
`}manageSubmenu(e){const t=e.target.assignedElements({flatten:!0});this.hasSubmenu=this.open||!!t,this.hasSubmenu&&this.setAttribute("aria-haspopup","true")}handleRemoveActive(e){e.type==="pointerleave"&&this.hasSubmenu||this.hasSubmenu||this.open||(this.active=!1)}handlePointerdown(){this.active=!0}firstUpdated(e){super.firstUpdated(e),this.setAttribute("tabindex","-1"),this.addEventListener("pointerdown",this.handlePointerdown),this.hasAttribute("id")||(this.id=`sp-menu-item-${n.instanceCount++}`),this.addEventListener("pointerenter",this.closeOverlaysForRoot)}closeOverlaysForRoot(){if(this.open)return;const e=new O({root:this.menuData.focusRoot});this.dispatchEvent(e)}handleSubmenuClick(){this.openOverlay()}handlePointerenter(){if(this.leaveTimeout){clearTimeout(this.leaveTimeout),delete this.leaveTimeout;return}this.openOverlay()}handlePointerleave(){this.hasSubmenu&&this.open&&(this.leaveTimeout=setTimeout(()=>{delete this.leaveTimeout,this.closeOverlay&&this.closeOverlay()},_))}async openOverlay(){if(!this.hasSubmenu||this.open||this.disabled)return;this.open=!0,this.active=!0,this.setAttribute("aria-expanded","true");const e=this.shadowRoot.querySelector('slot[name="submenu"]').assignedElements()[0];e.addEventListener("pointerenter",this.handleSubmenuPointerenter),e.addEventListener("change",this.handleSubmenuChange),e.id||e.setAttribute("id",`${this.id}-submenu`),this.setAttribute("aria-controls",e.id);const t=document.createElement("sp-popover"),i=x([e],t,{position:"beforeend",prepareCallback:s=>{const d=s.slot;return s.tabIndex=0,s.removeAttribute("slot"),s.isSubmenu=!0,v=>{v.tabIndex=-1,v.slot=d,v.isSubmenu=!1}}}),l=I(this,"click",t,{placement:this.isLTR?"right-start":"left-start",receivesFocus:"auto",root:this.menuData.focusRoot}),r=async()=>{this.setAttribute("aria-expanded","false"),delete this.closeOverlay,(await l)()};this.closeOverlay=r;const p=s=>{s.stopPropagation(),delete this.closeOverlay,i(),this.open=!1,this.active=!1};this.addEventListener("sp-closed",p,{once:!0}),t.addEventListener("change",r)}updateAriaSelected(){const e=this.getAttribute("role");e==="option"?this.setAttribute("aria-selected",this.selected?"true":"false"):(e==="menuitemcheckbox"||e==="menuitemradio")&&this.setAttribute("aria-checked",this.selected?"true":"false")}setRole(e){this.setAttribute("role",e),this.updateAriaSelected()}updated(e){super.updated(e),e.has("label")&&this.setAttribute("aria-label",this.label||""),e.has("active")&&(this.active?(this.addEventListener("pointerup",this.handleRemoveActive),this.addEventListener("pointerleave",this.handleRemoveActive),this.addEventListener("pointercancel",this.handleRemoveActive)):(this.removeEventListener("pointerup",this.handleRemoveActive),this.removeEventListener("pointerleave",this.handleRemoveActive),this.removeEventListener("pointercancel",this.handleRemoveActive))),this.anchorElement&&(this.anchorElement.addEventListener("focus",this.proxyFocus),this.anchorElement.tabIndex=-1),e.has("selected")&&this.updateAriaSelected(),e.has("hasSubmenu")&&(this.hasSubmenu?(this.addEventListener("click",this.handleSubmenuClick),this.addEventListener("pointerenter",this.handlePointerenter),this.addEventListener("pointerleave",this.handlePointerleave)):this.closeOverlay||(this.removeEventListener("click",this.handleSubmenuClick),this.removeEventListener("pointerenter",this.handlePointerenter),this.removeEventListener("pointerleave",this.handlePointerleave)))}connectedCallback(){super.connectedCallback(),this.isInSubmenu=!!this.closest('[slot="submenu"]'),!this.isInSubmenu&&(h.reset(this),this.dispatchEvent(h),S(),this._parentElement=this.parentElement)}disconnectedCallback(){!this.isInSubmenu&&this._parentElement&&(b.reset(this),this._parentElement.dispatchEvent(b),D()),this.isInSubmenu=!1,this._itemChildren=void 0,super.disconnectedCallback()}async triggerUpdate(){this.isInSubmenu||(await new Promise(e=>requestAnimationFrame(e)),h.reset(this),this.dispatchEvent(h),S())}};n.instanceCount=0,o([u({type:Boolean,reflect:!0})],n.prototype,"active",2),o([u({type:Boolean,reflect:!0})],n.prototype,"focused",2),o([u({type:Boolean,reflect:!0})],n.prototype,"selected",2),o([u({type:String})],n.prototype,"value",1),o([u({type:Boolean,reflect:!0,attribute:"has-submenu"})],n.prototype,"hasSubmenu",2),o([u({type:Boolean,reflect:!0,attribute:"no-wrap",hasChanged(){return!1}})],n.prototype,"noWrap",2),o([R(".anchor")],n.prototype,"anchorElement",2),o([u({type:Boolean})],n.prototype,"open",2);export let MenuItem=n;
|
|
45
|
+
${this.href&&this.href.length>0?super.renderAnchor({id:"button",ariaHidden:!0,className:"button anchor hidden"}):l``}
|
|
46
|
+
${this.renderSubmenu()}
|
|
47
|
+
`}manageSubmenu(e){const t=e.target.assignedElements({flatten:!0});this.hasSubmenu=!!t.length,this.hasSubmenu&&this.setAttribute("aria-haspopup","true")}handleRemoveActive(){this.open||(this.active=!1)}handlePointerdown(e){this.active=!0,e.target===this&&this.hasSubmenu&&this.open&&(this.addEventListener("focus",this.handleSubmenuFocus,{once:!0}),this.overlayElement.addEventListener("beforetoggle",this.handleBeforetoggle))}firstUpdated(e){super.firstUpdated(e),this.setAttribute("tabindex","-1"),this.addEventListener("pointerdown",this.handlePointerdown),this.addEventListener("pointerenter",this.closeOverlaysForRoot),this.hasAttribute("id")||(this.id=`sp-menu-item-${crypto.randomUUID().slice(0,8)}`)}closeOverlaysForRoot(){var e;this.open||(e=this.menuData.parentMenu)==null||e.closeDescendentOverlays()}handleSubmenuClick(e){e.composedPath().includes(this.overlayElement)||this.openOverlay()}handleSubmenuFocus(){requestAnimationFrame(()=>{this.overlayElement.open=this.open})}handlePointerenter(){if(this.leaveTimeout){clearTimeout(this.leaveTimeout),delete this.leaveTimeout;return}this.openOverlay()}handlePointerleave(){this.open&&!this.recentlyLeftChild&&(this.leaveTimeout=setTimeout(()=>{delete this.leaveTimeout,this.open=!1},S))}handleSubmenuChange(e){var t;e.stopPropagation(),(t=this.menuData.selectionRoot)==null||t.selectOrToggleItem(this)}handleSubmenuPointerenter(){this.recentlyLeftChild=!0}async handleSubmenuPointerleave(){requestAnimationFrame(()=>{this.recentlyLeftChild=!1})}handleSubmenuOpen(e){this.focused=!1;const t=e.composedPath().find(i=>i!==this.overlayElement&&i.localName==="sp-overlay");this.overlayElement.parentOverlayToForceClose=t}cleanup(){this.open=!1,this.active=!1}async openOverlay(){!this.hasSubmenu||this.open||this.disabled||(this.open=!0,this.active=!0,this.setAttribute("aria-expanded","true"),this.addEventListener("sp-closed",this.cleanup,{once:!0}))}updateAriaSelected(){const e=this.getAttribute("role");e==="option"?this.setAttribute("aria-selected",this.selected?"true":"false"):(e==="menuitemcheckbox"||e==="menuitemradio")&&this.setAttribute("aria-checked",this.selected?"true":"false")}setRole(e){this.setAttribute("role",e),this.updateAriaSelected()}updated(e){var t,i,o;if(super.updated(e),e.has("label")&&(this.label||typeof e.get("label")!="undefined")&&this.setAttribute("aria-label",this.label||""),e.has("active")&&(this.active||typeof e.get("active")!="undefined"))if(this.active){(t=this.menuData.selectionRoot)==null||t.closeDescendentOverlays(),this.abortControllerPointer=new AbortController;const n={signal:this.abortControllerPointer.signal};this.addEventListener("pointerup",this.handleRemoveActive,n),this.addEventListener("pointerleave",this.handleRemoveActive,n),this.addEventListener("pointercancel",this.handleRemoveActive,n)}else(i=this.abortControllerPointer)==null||i.abort();if(this.anchorElement&&(this.anchorElement.addEventListener("focus",this.proxyFocus),this.anchorElement.tabIndex=-1),e.has("selected")&&this.updateAriaSelected(),e.has("hasSubmenu")&&(this.hasSubmenu||typeof e.get("hasSubmenu")!="undefined"))if(this.hasSubmenu){this.abortControllerSubmenu=new AbortController;const n={signal:this.abortControllerSubmenu.signal};this.addEventListener("click",this.handleSubmenuClick,n),this.addEventListener("pointerenter",this.handlePointerenter,n),this.addEventListener("pointerleave",this.handlePointerleave,n),this.addEventListener("sp-opened",this.handleSubmenuOpen,n)}else(o=this.abortControllerSubmenu)==null||o.abort()}connectedCallback(){super.connectedCallback(),this.triggerUpdate()}disconnectedCallback(){this.menuData.cleanupSteps.forEach(e=>e(this)),super.disconnectedCallback()}async triggerUpdate(){this.willDispatchUpdate||(this.willDispatchUpdate=!0,await new Promise(e=>requestAnimationFrame(e)),this.dispatchUpdate())}dispatchUpdate(){this.dispatchEvent(new MenuItemAddedOrUpdatedEvent(this)),this.willDispatchUpdate=!1}}r([s({type:Boolean,reflect:!0})],MenuItem.prototype,"active",2),r([s({type:Boolean,reflect:!0})],MenuItem.prototype,"focused",2),r([s({type:Boolean,reflect:!0})],MenuItem.prototype,"selected",2),r([s({type:String})],MenuItem.prototype,"value",1),r([s({type:Boolean,reflect:!0,attribute:"has-submenu"})],MenuItem.prototype,"hasSubmenu",2),r([u("slot:not([name])")],MenuItem.prototype,"contentSlot",2),r([u('slot[name="icon"]')],MenuItem.prototype,"iconSlot",2),r([s({type:Boolean,reflect:!0,attribute:"no-wrap",hasChanged(){return!1}})],MenuItem.prototype,"noWrap",2),r([u(".anchor")],MenuItem.prototype,"anchorElement",2),r([u("sp-overlay")],MenuItem.prototype,"overlayElement",2),r([s({type:Boolean,reflect:!0})],MenuItem.prototype,"open",2);
|
|
31
48
|
//# sourceMappingURL=MenuItem.js.map
|
package/src/MenuItem.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["MenuItem.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n ObserveSlotPresence,\n ObserveSlotText,\n} from '@spectrum-web-components/shared';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-checkmark100.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport { openOverlay } from '@spectrum-web-components/overlay/src/loader.js';\nimport { OverlayCloseEvent } from '@spectrum-web-components/overlay/src/overlay-events.js';\n\nimport menuItemStyles from './menu-item.css.js';\nimport checkmarkStyles from '@spectrum-web-components/icon/src/spectrum-icon-checkmark.css.js';\nimport type { Menu } from './Menu.js';\nimport type { OverlayOpenCloseDetail } from '@spectrum-web-components/overlay';\nimport { reparentChildren } from '@spectrum-web-components/shared/src/reparent-children.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\n\n/**\n * Duration during which a pointing device can leave an `<sp-menu-item>` element\n * and return to it or to the submenu opened from it before closing that submenu.\n **/\nconst POINTERLEAVE_TIMEOUT = 100;\n\nexport class MenuItemRemovedEvent extends Event {\n constructor() {\n super('sp-menu-item-removed', {\n bubbles: true,\n composed: true,\n });\n }\n get item(): MenuItem {\n return this._item;\n }\n _item!: MenuItem;\n focused = false;\n reset(item: MenuItem): void {\n this._item = item;\n }\n}\n\nexport class MenuItemAddedOrUpdatedEvent extends Event {\n constructor() {\n super('sp-menu-item-added-or-updated', {\n bubbles: true,\n composed: true,\n });\n }\n set focusRoot(root: Menu | undefined) {\n this.item.menuData.focusRoot = this.item.menuData.focusRoot || root;\n }\n set selectionRoot(root: Menu) {\n this.item.menuData.selectionRoot =\n this.item.menuData.selectionRoot || root;\n }\n get item(): MenuItem {\n return this._item;\n }\n _item!: MenuItem;\n set currentAncestorWithSelects(ancestor: Menu | undefined) {\n this._currentAncestorWithSelects = ancestor;\n }\n get currentAncestorWithSelects(): Menu | undefined {\n return this._currentAncestorWithSelects;\n }\n _currentAncestorWithSelects?: Menu;\n reset(item: MenuItem): void {\n this._item = item;\n this._currentAncestorWithSelects = undefined;\n item.menuData = {\n focusRoot: undefined,\n selectionRoot: undefined,\n };\n }\n}\n\nexport type MenuItemChildren = { icon: Element[]; content: Node[] };\n\nlet addOrUpdateEvent = new MenuItemAddedOrUpdatedEvent();\nlet removeEvent = new MenuItemRemovedEvent();\n/**\n * Code to cleanup these global events async in batches\n */\nlet addOrUpdateEventRafId = 0;\nfunction resetAddOrUpdateEvent(): void {\n if (addOrUpdateEventRafId === 0) {\n addOrUpdateEventRafId = requestAnimationFrame(() => {\n addOrUpdateEvent = new MenuItemAddedOrUpdatedEvent();\n addOrUpdateEventRafId = 0;\n });\n }\n}\nlet removeEventEventtRafId = 0;\nfunction resetRemoveEvent(): void {\n if (removeEventEventtRafId === 0) {\n removeEventEventtRafId = requestAnimationFrame(() => {\n removeEvent = new MenuItemRemovedEvent();\n removeEventEventtRafId = 0;\n });\n }\n}\n\n/**\n * @element sp-menu-item\n *\n * @slot - text content to display within the Menu Item\n * @slot icon - icon element to be placed at the start of the Menu Item\n * @slot value - content placed at the end of the Menu Item like values, keyboard shortcuts, etc.\n * @slot submenu - content placed in a submenu\n * @fires sp-menu-item-added - announces the item has been added so a parent menu can take ownerships\n * @fires sp-menu-item-removed - announces when removed from the DOM so the parent menu can remove ownership and update selected state\n */\nexport class MenuItem extends LikeAnchor(\n ObserveSlotText(ObserveSlotPresence(Focusable, '[slot=\"icon\"]'))\n) {\n public static override get styles(): CSSResultArray {\n return [menuItemStyles, checkmarkStyles, chevronStyles];\n }\n\n static instanceCount = 0;\n\n private isInSubmenu = false;\n\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ type: String })\n public get value(): string {\n return this._value || this.itemText;\n }\n\n public set value(value: string) {\n if (value === this._value) {\n return;\n }\n this._value = value || '';\n if (this._value) {\n this.setAttribute('value', this._value);\n } else {\n this.removeAttribute('value');\n }\n }\n\n private _value = '';\n\n /**\n * @private\n */\n public get itemText(): string {\n return this.itemChildren.content.reduce(\n (acc, node) => acc + (node.textContent || '').trim(),\n ''\n );\n }\n\n @property({ type: Boolean, reflect: true, attribute: 'has-submenu' })\n public hasSubmenu = false;\n\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'no-wrap',\n hasChanged() {\n return false;\n },\n })\n public noWrap = false;\n\n @query('.anchor')\n private anchorElement!: HTMLAnchorElement;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n public get itemChildren(): MenuItemChildren {\n if (this._itemChildren) {\n return this._itemChildren;\n }\n\n const iconSlot = this.shadowRoot?.querySelector(\n 'slot[name=\"icon\"]'\n ) as HTMLSlotElement;\n const icon = !iconSlot\n ? []\n : iconSlot.assignedElements().map((element) => {\n const newElement = element.cloneNode(true) as HTMLElement;\n newElement.removeAttribute('slot');\n newElement.classList.toggle('icon');\n return newElement;\n });\n const contentSlot = this.shadowRoot?.querySelector(\n 'slot:not([name])'\n ) as HTMLSlotElement;\n const content = !contentSlot\n ? []\n : contentSlot.assignedNodes().map((node) => node.cloneNode(true));\n this._itemChildren = { icon, content };\n\n return this._itemChildren;\n }\n\n private _itemChildren?: MenuItemChildren;\n\n constructor() {\n super();\n this.proxyFocus = this.proxyFocus.bind(this);\n\n this.addEventListener('click', this.handleClickCapture, {\n capture: true,\n });\n\n new MutationController(this, {\n config: {\n characterData: true,\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.breakItemChildrenCache();\n },\n });\n }\n\n @property({ type: Boolean })\n public open = false;\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n\n super.click();\n }\n\n private handleClickCapture(event: Event): void | boolean {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n return false;\n }\n }\n\n private proxyFocus(): void {\n this.focus();\n }\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n this.anchorElement.click();\n handled = true;\n }\n return handled;\n }\n\n protected breakItemChildrenCache(): void {\n this._itemChildren = undefined;\n this.triggerUpdate();\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.selected\n ? html`\n <sp-icon-checkmark100\n id=\"selected\"\n class=\"spectrum-UIIcon-Checkmark100 \n icon \n checkmark\n ${this.hasIcon\n ? 'checkmark--withAdjacentIcon'\n : ''}\"\n ></sp-icon-checkmark100>\n `\n : html``}\n <slot name=\"icon\"></slot>\n <div id=\"label\">\n <slot id=\"slot\"></slot>\n </div>\n <slot name=\"value\"></slot>\n ${this.href && this.href.length > 0\n ? super.renderAnchor({\n id: 'button',\n ariaHidden: true,\n className: 'button anchor hidden',\n })\n : html``}\n\n <slot\n hidden\n name=\"submenu\"\n @slotchange=${this.manageSubmenu}\n ></slot>\n ${this.hasSubmenu\n ? html`\n <sp-icon-chevron100\n class=\"spectrum-UIIcon-ChevronRight100\n chevron\n icon\"\n ></sp-icon-chevron100>\n `\n : html``}\n `;\n }\n\n protected manageSubmenu(event: Event & { target: HTMLSlotElement }): void {\n const assignedElements = event.target.assignedElements({\n flatten: true,\n });\n this.hasSubmenu = this.open || !!assignedElements;\n if (this.hasSubmenu) {\n this.setAttribute('aria-haspopup', 'true');\n }\n }\n\n private handleRemoveActive(event: Event): void {\n if (\n (event.type === 'pointerleave' && this.hasSubmenu) ||\n this.hasSubmenu ||\n this.open\n ) {\n return;\n }\n this.active = false;\n }\n\n private handlePointerdown(): void {\n this.active = true;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('tabindex', '-1');\n this.addEventListener('pointerdown', this.handlePointerdown);\n if (!this.hasAttribute('id')) {\n this.id = `sp-menu-item-${MenuItem.instanceCount++}`;\n }\n this.addEventListener('pointerenter', this.closeOverlaysForRoot);\n }\n\n protected closeOverlaysForRoot(): void {\n if (this.open) return;\n const overalyCloseEvent = new OverlayCloseEvent({\n root: this.menuData.focusRoot,\n });\n this.dispatchEvent(overalyCloseEvent);\n }\n\n public closeOverlay?: () => Promise<void>;\n\n protected handleSubmenuClick(): void {\n this.openOverlay();\n }\n\n protected handlePointerenter(): void {\n if (this.leaveTimeout) {\n clearTimeout(this.leaveTimeout);\n delete this.leaveTimeout;\n return;\n }\n this.openOverlay();\n }\n\n protected leaveTimeout?: ReturnType<typeof setTimeout>;\n\n protected handlePointerleave(): void {\n if (this.hasSubmenu && this.open) {\n this.leaveTimeout = setTimeout(() => {\n delete this.leaveTimeout;\n if (this.closeOverlay) this.closeOverlay();\n }, POINTERLEAVE_TIMEOUT);\n }\n }\n\n /**\n * When there is a `change` event in the submenu for this item\n * then we \"click\" this item to cascade the selection up the\n * menu tree allowing all submenus between the initial selection\n * and the root of the tree to have their selection changes and\n * be closed.\n */\n protected handleSubmenuChange = (): void => {\n this.menuData.selectionRoot?.selectOrToggleItem(this);\n };\n\n protected handleSubmenuPointerenter = (): void => {\n if (this.leaveTimeout) {\n clearTimeout(this.leaveTimeout);\n delete this.leaveTimeout;\n }\n };\n\n public async openOverlay(): Promise<void> {\n if (!this.hasSubmenu || this.open || this.disabled) {\n return;\n }\n this.open = true;\n this.active = true;\n this.setAttribute('aria-expanded', 'true');\n const submenu = (\n this.shadowRoot.querySelector(\n 'slot[name=\"submenu\"]'\n ) as HTMLSlotElement\n ).assignedElements()[0] as Menu;\n submenu.addEventListener(\n 'pointerenter',\n this.handleSubmenuPointerenter\n );\n submenu.addEventListener('change', this.handleSubmenuChange);\n if (!submenu.id) {\n submenu.setAttribute('id', `${this.id}-submenu`);\n }\n this.setAttribute('aria-controls', submenu.id);\n const popover = document.createElement('sp-popover');\n const returnSubmenu = reparentChildren([submenu], popover, {\n position: 'beforeend',\n prepareCallback: (el) => {\n const slotName = el.slot;\n el.tabIndex = 0;\n el.removeAttribute('slot');\n el.isSubmenu = true;\n return (el) => {\n el.tabIndex = -1;\n el.slot = slotName;\n el.isSubmenu = false;\n };\n },\n });\n const closeOverlay = openOverlay(this, 'click', popover, {\n placement: this.isLTR ? 'right-start' : 'left-start',\n receivesFocus: 'auto',\n root: this.menuData.focusRoot,\n });\n const closeSubmenu = async (): Promise<void> => {\n this.setAttribute('aria-expanded', 'false');\n delete this.closeOverlay;\n (await closeOverlay)();\n };\n this.closeOverlay = closeSubmenu;\n const cleanup = (event: CustomEvent<OverlayOpenCloseDetail>): void => {\n event.stopPropagation();\n delete this.closeOverlay;\n returnSubmenu();\n this.open = false;\n this.active = false;\n };\n this.addEventListener('sp-closed', cleanup as EventListener, {\n once: true,\n });\n popover.addEventListener('change', closeSubmenu);\n }\n\n updateAriaSelected(): void {\n const role = this.getAttribute('role');\n if (role === 'option') {\n this.setAttribute(\n 'aria-selected',\n this.selected ? 'true' : 'false'\n );\n } else if (role === 'menuitemcheckbox' || role === 'menuitemradio') {\n this.setAttribute('aria-checked', this.selected ? 'true' : 'false');\n }\n }\n\n public setRole(role: string): void {\n this.setAttribute('role', role);\n this.updateAriaSelected();\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n super.updated(changes);\n if (changes.has('label')) {\n this.setAttribute('aria-label', this.label || '');\n }\n if (changes.has('active')) {\n if (this.active) {\n this.addEventListener('pointerup', this.handleRemoveActive);\n this.addEventListener('pointerleave', this.handleRemoveActive);\n this.addEventListener('pointercancel', this.handleRemoveActive);\n } else {\n this.removeEventListener('pointerup', this.handleRemoveActive);\n this.removeEventListener(\n 'pointerleave',\n this.handleRemoveActive\n );\n this.removeEventListener(\n 'pointercancel',\n this.handleRemoveActive\n );\n }\n }\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n if (changes.has('selected')) {\n this.updateAriaSelected();\n }\n if (changes.has('hasSubmenu')) {\n if (this.hasSubmenu) {\n this.addEventListener('click', this.handleSubmenuClick);\n this.addEventListener('pointerenter', this.handlePointerenter);\n this.addEventListener('pointerleave', this.handlePointerleave);\n } else if (!this.closeOverlay) {\n this.removeEventListener('click', this.handleSubmenuClick);\n this.removeEventListener(\n 'pointerenter',\n this.handlePointerenter\n );\n this.removeEventListener(\n 'pointerleave',\n this.handlePointerleave\n );\n }\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.isInSubmenu = !!this.closest('[slot=\"submenu\"]');\n if (this.isInSubmenu) {\n return;\n }\n addOrUpdateEvent.reset(this);\n this.dispatchEvent(addOrUpdateEvent);\n resetAddOrUpdateEvent();\n this._parentElement = this.parentElement as HTMLElement;\n }\n\n _parentElement!: HTMLElement;\n\n public override disconnectedCallback(): void {\n if (!this.isInSubmenu && this._parentElement) {\n removeEvent.reset(this);\n this._parentElement.dispatchEvent(removeEvent);\n resetRemoveEvent();\n }\n this.isInSubmenu = false;\n this._itemChildren = undefined;\n super.disconnectedCallback();\n }\n\n public async triggerUpdate(): Promise<void> {\n if (this.isInSubmenu) {\n return;\n }\n await new Promise((ready) => requestAnimationFrame(ready));\n addOrUpdateEvent.reset(this);\n this.dispatchEvent(addOrUpdateEvent);\n resetAddOrUpdateEvent();\n }\n\n public menuData: {\n focusRoot?: Menu;\n selectionRoot?: Menu;\n } = {\n focusRoot: undefined,\n selectionRoot: undefined,\n };\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-menu-item-added-or-updated': MenuItemAddedOrUpdatedEvent;\n 'sp-menu-item-removed': MenuItemRemovedEvent;\n }\n}\n"],
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OACI,uBAAAC,EACA,mBAAAC,MACG,kCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDAEP,MAAO,kEACP,OAAS,cAAAC,MAAkB,qDAC3B,OAAS,aAAAC,MAAiB,mDAC1B,MAAO,gEACP,OAAOC,MAAmB,
|
|
6
|
-
"names": ["html", "ObserveSlotPresence", "ObserveSlotText", "property", "query", "LikeAnchor", "Focusable", "chevronStyles", "
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n ObserveSlotPresence,\n ObserveSlotText,\n} from '@spectrum-web-components/shared';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-checkmark100.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\n\nimport menuItemStyles from './menu-item.css.js';\nimport checkmarkStyles from '@spectrum-web-components/icon/src/spectrum-icon-checkmark.css.js';\nimport type { Menu } from './Menu.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\nimport type { Overlay } from 'overlay/src/Overlay.js';\n\n/**\n * Duration during which a pointing device can leave an `<sp-menu-item>` element\n * and return to it or to the submenu opened from it before closing that submenu.\n **/\nconst POINTERLEAVE_TIMEOUT = 100;\n\ntype MenuCascadeItem = {\n hadFocusRoot: boolean;\n ancestorWithSelects?: HTMLElement;\n};\n\nexport class MenuItemAddedOrUpdatedEvent extends Event {\n constructor(item: MenuItem) {\n super('sp-menu-item-added-or-updated', {\n bubbles: true,\n composed: true,\n });\n this.clear(item);\n }\n clear(item: MenuItem): void {\n this._item = item;\n this.currentAncestorWithSelects = undefined;\n item.menuData = {\n cleanupSteps: [],\n focusRoot: undefined,\n selectionRoot: undefined,\n parentMenu: undefined,\n };\n this.menuCascade = new WeakMap<HTMLElement, MenuCascadeItem>();\n }\n menuCascade = new WeakMap<HTMLElement, MenuCascadeItem>();\n get item(): MenuItem {\n return this._item;\n }\n private _item!: MenuItem;\n currentAncestorWithSelects?: Menu;\n}\n\nexport type MenuItemChildren = { icon: Element[]; content: Node[] };\n\n/**\n * @element sp-menu-item\n *\n * @slot - text content to display within the Menu Item\n * @slot icon - icon element to be placed at the start of the Menu Item\n * @slot value - content placed at the end of the Menu Item like values, keyboard shortcuts, etc.\n * @slot submenu - content placed in a submenu\n * @fires sp-menu-item-added - announces the item has been added so a parent menu can take ownerships\n */\nexport class MenuItem extends LikeAnchor(\n ObserveSlotText(ObserveSlotPresence(Focusable, '[slot=\"icon\"]'))\n) {\n public static override get styles(): CSSResultArray {\n return [menuItemStyles, checkmarkStyles, chevronStyles];\n }\n\n abortControllerPointer!: AbortController;\n\n abortControllerSubmenu!: AbortController;\n\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n @property({ type: Boolean, reflect: true })\n public focused = false;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ type: String })\n public get value(): string {\n return this._value || this.itemText;\n }\n\n public set value(value: string) {\n if (value === this._value) {\n return;\n }\n this._value = value || '';\n if (this._value) {\n this.setAttribute('value', this._value);\n } else {\n this.removeAttribute('value');\n }\n }\n\n private _value = '';\n\n /**\n * @private\n */\n public get itemText(): string {\n return this.itemChildren.content.reduce(\n (acc, node) => acc + (node.textContent || '').trim(),\n ''\n );\n }\n\n @property({ type: Boolean, reflect: true, attribute: 'has-submenu' })\n public hasSubmenu = false;\n\n @query('slot:not([name])')\n contentSlot!: HTMLSlotElement;\n\n @query('slot[name=\"icon\"]')\n iconSlot!: HTMLSlotElement;\n\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'no-wrap',\n hasChanged() {\n return false;\n },\n })\n public noWrap = false;\n\n @query('.anchor')\n private anchorElement!: HTMLAnchorElement;\n\n @query('sp-overlay')\n public overlayElement!: Overlay;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n public get itemChildren(): MenuItemChildren {\n if (this._itemChildren) {\n return this._itemChildren;\n }\n const icon = this.iconSlot.assignedElements().map((element) => {\n const newElement = element.cloneNode(true) as HTMLElement;\n newElement.removeAttribute('slot');\n newElement.classList.toggle('icon');\n return newElement;\n });\n const content = this.contentSlot\n .assignedNodes()\n .map((node) => node.cloneNode(true));\n this._itemChildren = { icon, content };\n\n return this._itemChildren;\n }\n\n private _itemChildren?: MenuItemChildren;\n\n constructor() {\n super();\n this.addEventListener('click', this.handleClickCapture, {\n capture: true,\n });\n\n new MutationController(this, {\n config: {\n characterData: true,\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.breakItemChildrenCache();\n },\n });\n }\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n\n super.click();\n }\n\n private handleClickCapture(event: Event): void | boolean {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n return false;\n }\n }\n\n private proxyFocus = (): void => {\n this.focus();\n };\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n this.anchorElement.click();\n handled = true;\n }\n return handled;\n }\n\n protected breakItemChildrenCache(): void {\n this._itemChildren = undefined;\n this.triggerUpdate();\n }\n\n protected renderSubmenu(): TemplateResult {\n const slot = html`\n <slot\n name=\"submenu\"\n @slotchange=${this.manageSubmenu}\n @sp-menu-item-added-or-updated=${{\n handleEvent: (event: MenuItemAddedOrUpdatedEvent) => {\n event.clear(event.item);\n },\n capture: true,\n }}\n @focusin=${(event: Event) => event.stopPropagation()}\n ></slot>\n `;\n if (!this.hasSubmenu) {\n return slot;\n }\n import('@spectrum-web-components/overlay/sp-overlay.js');\n import('@spectrum-web-components/popover/sp-popover.js');\n return html`\n <sp-overlay\n .triggerElement=${this as HTMLElement}\n ?disabled=${!this.hasSubmenu}\n ?open=${this.hasSubmenu && this.open}\n .placement=${this.isLTR ? 'right-start' : 'left-start'}\n .offset=${[-10, -4] as [number, number]}\n .type=${'auto'}\n @close=${(event: Event) => event.stopPropagation()}\n >\n <sp-popover\n @change=${(event: Event) => {\n this.handleSubmenuChange(event);\n this.open = false;\n }}\n @pointerenter=${this.handleSubmenuPointerenter}\n @pointerleave=${this.handleSubmenuPointerleave}\n @sp-menu-item-added-or-updated=${(event: Event) =>\n event.stopPropagation()}\n >\n ${slot}\n </sp-popover>\n </sp-overlay>\n <sp-icon-chevron100\n class=\"spectrum-UIIcon-ChevronRight100 chevron icon\"\n ></sp-icon-chevron100>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.selected\n ? html`\n <sp-icon-checkmark100\n id=\"selected\"\n class=\"spectrum-UIIcon-Checkmark100 \n icon \n checkmark\n ${this.hasIcon\n ? 'checkmark--withAdjacentIcon'\n : ''}\"\n ></sp-icon-checkmark100>\n `\n : html``}\n <slot name=\"icon\"></slot>\n <div id=\"label\">\n <slot id=\"slot\"></slot>\n </div>\n <slot name=\"value\"></slot>\n ${this.href && this.href.length > 0\n ? super.renderAnchor({\n id: 'button',\n ariaHidden: true,\n className: 'button anchor hidden',\n })\n : html``}\n ${this.renderSubmenu()}\n `;\n }\n\n protected manageSubmenu(event: Event & { target: HTMLSlotElement }): void {\n const assignedElements = event.target.assignedElements({\n flatten: true,\n });\n this.hasSubmenu = !!assignedElements.length;\n if (this.hasSubmenu) {\n this.setAttribute('aria-haspopup', 'true');\n }\n }\n\n private handleRemoveActive(): void {\n if (this.open) {\n return;\n }\n this.active = false;\n }\n\n private handlePointerdown(event: PointerEvent): void {\n this.active = true;\n if (event.target === this && this.hasSubmenu && this.open) {\n this.addEventListener('focus', this.handleSubmenuFocus, {\n once: true,\n });\n this.overlayElement.addEventListener(\n 'beforetoggle',\n this.handleBeforetoggle\n );\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('tabindex', '-1');\n this.addEventListener('pointerdown', this.handlePointerdown);\n this.addEventListener('pointerenter', this.closeOverlaysForRoot);\n if (!this.hasAttribute('id')) {\n this.id = `sp-menu-item-${crypto.randomUUID().slice(0, 8)}`;\n }\n }\n\n protected closeOverlaysForRoot(): void {\n if (this.open) return;\n this.menuData.parentMenu?.closeDescendentOverlays();\n }\n\n protected handleSubmenuClick(event: Event): void {\n if (event.composedPath().includes(this.overlayElement)) {\n return;\n }\n this.openOverlay();\n }\n\n protected handleSubmenuFocus(): void {\n requestAnimationFrame(() => {\n // Wait till after `closeDescendentOverlays` has happened in Menu\n // to reopen (keey open) the direct descendent of this Menu Item\n this.overlayElement.open = this.open;\n });\n }\n\n protected handleBeforetoggle = (event: Event): void => {\n if ((event as Event & { newState: string }).newState === 'closed') {\n this.open = true;\n this.overlayElement.manuallyKeepOpen();\n this.overlayElement.removeEventListener(\n 'beforetoggle',\n this.handleBeforetoggle\n );\n }\n };\n\n protected handlePointerenter(): void {\n if (this.leaveTimeout) {\n clearTimeout(this.leaveTimeout);\n delete this.leaveTimeout;\n return;\n }\n this.openOverlay();\n }\n\n protected leaveTimeout?: ReturnType<typeof setTimeout>;\n protected recentlyLeftChild = false;\n\n protected handlePointerleave(): void {\n if (this.open && !this.recentlyLeftChild) {\n this.leaveTimeout = setTimeout(() => {\n delete this.leaveTimeout;\n this.open = false;\n }, POINTERLEAVE_TIMEOUT);\n }\n }\n\n /**\n * When there is a `change` event in the submenu for this item\n * then we \"click\" this item to cascade the selection up the\n * menu tree allowing all submenus between the initial selection\n * and the root of the tree to have their selection changes and\n * be closed.\n */\n protected handleSubmenuChange(event: Event): void {\n event.stopPropagation();\n this.menuData.selectionRoot?.selectOrToggleItem(this);\n }\n\n protected handleSubmenuPointerenter(): void {\n this.recentlyLeftChild = true;\n }\n\n protected async handleSubmenuPointerleave(): Promise<void> {\n requestAnimationFrame(() => {\n this.recentlyLeftChild = false;\n });\n }\n\n protected handleSubmenuOpen(event: Event): void {\n this.focused = false;\n const parentOverlay = event.composedPath().find((el) => {\n return (\n el !== this.overlayElement &&\n (el as HTMLElement).localName === 'sp-overlay'\n );\n }) as Overlay;\n this.overlayElement.parentOverlayToForceClose = parentOverlay;\n }\n\n protected cleanup(): void {\n this.open = false;\n this.active = false;\n }\n\n public async openOverlay(): Promise<void> {\n if (!this.hasSubmenu || this.open || this.disabled) {\n return;\n }\n this.open = true;\n this.active = true;\n this.setAttribute('aria-expanded', 'true');\n this.addEventListener('sp-closed', this.cleanup, {\n once: true,\n });\n }\n\n updateAriaSelected(): void {\n const role = this.getAttribute('role');\n if (role === 'option') {\n this.setAttribute(\n 'aria-selected',\n this.selected ? 'true' : 'false'\n );\n } else if (role === 'menuitemcheckbox' || role === 'menuitemradio') {\n this.setAttribute('aria-checked', this.selected ? 'true' : 'false');\n }\n }\n\n public setRole(role: string): void {\n this.setAttribute('role', role);\n this.updateAriaSelected();\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n super.updated(changes);\n if (\n changes.has('label') &&\n (this.label || typeof changes.get('label') !== 'undefined')\n ) {\n this.setAttribute('aria-label', this.label || '');\n }\n if (\n changes.has('active') &&\n (this.active || typeof changes.get('active') !== 'undefined')\n ) {\n if (this.active) {\n this.menuData.selectionRoot?.closeDescendentOverlays();\n this.abortControllerPointer = new AbortController();\n const options = { signal: this.abortControllerPointer.signal };\n this.addEventListener(\n 'pointerup',\n this.handleRemoveActive,\n options\n );\n this.addEventListener(\n 'pointerleave',\n this.handleRemoveActive,\n options\n );\n this.addEventListener(\n 'pointercancel',\n this.handleRemoveActive,\n options\n );\n } else {\n this.abortControllerPointer?.abort();\n }\n }\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n if (changes.has('selected')) {\n this.updateAriaSelected();\n }\n if (\n changes.has('hasSubmenu') &&\n (this.hasSubmenu ||\n typeof changes.get('hasSubmenu') !== 'undefined')\n ) {\n if (this.hasSubmenu) {\n this.abortControllerSubmenu = new AbortController();\n const options = { signal: this.abortControllerSubmenu.signal };\n this.addEventListener(\n 'click',\n this.handleSubmenuClick,\n options\n );\n this.addEventListener(\n 'pointerenter',\n this.handlePointerenter,\n options\n );\n this.addEventListener(\n 'pointerleave',\n this.handlePointerleave,\n options\n );\n this.addEventListener(\n 'sp-opened',\n this.handleSubmenuOpen,\n options\n );\n } else {\n this.abortControllerSubmenu?.abort();\n }\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.triggerUpdate();\n }\n\n _parentElement!: HTMLElement;\n\n public override disconnectedCallback(): void {\n this.menuData.cleanupSteps.forEach((removal) => removal(this));\n super.disconnectedCallback();\n }\n\n private willDispatchUpdate = false;\n\n public async triggerUpdate(): Promise<void> {\n if (this.willDispatchUpdate) {\n return;\n }\n this.willDispatchUpdate = true;\n await new Promise((ready) => requestAnimationFrame(ready));\n this.dispatchUpdate();\n }\n\n public dispatchUpdate(): void {\n this.dispatchEvent(new MenuItemAddedOrUpdatedEvent(this));\n this.willDispatchUpdate = false;\n }\n\n public menuData: {\n focusRoot?: Menu;\n parentMenu?: Menu;\n selectionRoot?: Menu;\n cleanupSteps: ((item: MenuItem) => void)[];\n } = {\n focusRoot: undefined,\n parentMenu: undefined,\n selectionRoot: undefined,\n cleanupSteps: [],\n };\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-menu-item-added-or-updated': MenuItemAddedOrUpdatedEvent;\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OACI,uBAAAC,EACA,mBAAAC,MACG,kCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDAEP,MAAO,kEACP,OAAS,cAAAC,MAAkB,qDAC3B,OAAS,aAAAC,MAAiB,mDAC1B,MAAO,gEAC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B,EAAA,CADN/B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAdjC,SAeF,uBAGA+B,EAAA,CADN/B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAjBjC,SAkBF,wBAGI+B,EAAA,CADV/B,EAAS,CAAE,KAAM,MAAO,CAAC,GApBjB,SAqBE,qBA6BJ+B,EAAA,CADN/B,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,aAAc,CAAC,GAjD3D,SAkDF,0BAGP+B,EAAA,CADC9B,EAAM,kBAAkB,GApDhB,SAqDT,2BAGA8B,EAAA,CADC9B,EAAM,mBAAmB,GAvDjB,SAwDT,wBAUO8B,EAAA,CARN/B,EAAS,CACN,KAAM,QACN,QAAS,GACT,UAAW,UACX,YAAa,CACT,MAAO,EACX,CACJ,CAAC,GAjEQ,SAkEF,sBAGC+B,EAAA,CADP9B,EAAM,SAAS,GApEP,SAqED,6BAGD8B,EAAA,CADN9B,EAAM,YAAY,GAvEV,SAwEF,8BAiDA8B,EAAA,CADN/B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAxHjC,SAyHF",
|
|
6
|
+
"names": ["html", "ObserveSlotPresence", "ObserveSlotText", "property", "query", "LikeAnchor", "Focusable", "chevronStyles", "menuItemStyles", "checkmarkStyles", "MutationController", "POINTERLEAVE_TIMEOUT", "item", "event", "value", "acc", "node", "icon", "element", "newElement", "content", "handled", "slot", "assignedElements", "changes", "_a", "parentOverlay", "el", "role", "_b", "_c", "options", "removal", "ready", "__decorateClass"]
|
|
7
7
|
}
|
package/src/menu-item.css.dev.js
CHANGED
|
@@ -302,7 +302,7 @@ var(--spectrum-menu-item-top-edge-to-text)
|
|
|
302
302
|
--highcontrast-menu-item-color-focus,var(
|
|
303
303
|
--mod-menu-drillin-icon-color-down,var(--spectrum-menu-drillin-icon-color-down)
|
|
304
304
|
)
|
|
305
|
-
)}#label{flex:1 1 auto;-webkit-hyphens:auto;hyphens:auto;line-height:var(--spectrum-listitem-texticon-label-line-height);overflow-wrap:break-word;width:calc(100% - var(--spectrum-listitem-texticon-ui-icon-width) - var(--spectrum-listitem-texticon-icon-gap))}.spectrum-Menu-itemLabel--wrapping{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([hidden]){display:none}:host([disabled]){pointer-events:none}#button{inset:0;position:absolute}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors:active){:host{forced-color-adjust:none}}
|
|
305
|
+
)}#label{flex:1 1 auto;-webkit-hyphens:auto;hyphens:auto;line-height:var(--spectrum-listitem-texticon-label-line-height);overflow-wrap:break-word;width:calc(100% - var(--spectrum-listitem-texticon-ui-icon-width) - var(--spectrum-listitem-texticon-icon-gap))}.spectrum-Menu-itemLabel--wrapping{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([hidden]){display:none}:host([disabled]){pointer-events:none}#button{inset:0;position:absolute}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors:active){:host{forced-color-adjust:none}}::slotted([slot=submenu]){max-width:100%;width:max-content}
|
|
306
306
|
`;
|
|
307
307
|
export default styles;
|
|
308
308
|
//# sourceMappingURL=menu-item.css.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["menu-item.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 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::slotted([slot=icon]){fill:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-label-icon-color-default,var(--spectrum-menu-item-label-icon-color-default)\n)\n);color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-label-icon-color-default,var(--spectrum-menu-item-label-icon-color-default)\n)\n)}.checkmark{fill:var(\n--highcontrast-menu-checkmark-icon-color-default,var(\n--mod-menu-checkmark-icon-color-default,var(--spectrum-menu-checkmark-icon-color-default)\n)\n);align-self:center;color:var(\n--highcontrast-menu-checkmark-icon-color-default,var(\n--mod-menu-checkmark-icon-color-default,var(--spectrum-menu-checkmark-icon-color-default)\n)\n);display:var(\n--mod-menu-checkmark-display,var(--spectrum-menu-checkmark-display)\n);opacity:1}:host{align-items:center;background-color:var(\n--highcontrast-menu-item-background-color-default,var(\n--mod-menu-item-background-color-default,var(--spectrum-menu-item-background-color-default)\n)\n);box-sizing:border-box;cursor:pointer;line-height:var(\n--mod-menu-item-label-line-height,var(--spectrum-menu-item-label-line-height)\n);margin:0;min-block-size:var(\n--mod-menu-item-min-height,var(--spectrum-menu-item-min-height)\n);padding-block-end:var(\n--mod-menu-item-bottom-edge-to-text,var(--spectrum-menu-item-bottom-edge-to-text)\n);padding-block-start:var(\n--mod-menu-item-top-edge-to-text,var(--spectrum-menu-item-top-edge-to-text)\n);padding-inline:var(\n--mod-menu-item-label-inline-edge-to-content,var(--spectrum-menu-item-label-inline-edge-to-content)\n);position:relative;-webkit-text-decoration:none;text-decoration:none}:host{display:grid;grid-template:\". chevronAreaCollapsible . iconArea sectionHeadingArea . . .\" 1fr \"selectedArea chevronAreaCollapsible checkmarkArea iconArea labelArea valueArea actionsArea chevronAreaDrillIn\" \". . . . descriptionArea . . .\" \". . . . submenuArea . . .\"/auto auto auto auto 1fr auto auto auto}#label{grid-area:submenuItemLabelArea}::slotted([slot=value]){grid-area:submenuItemValueArea}:host(:focus),:host([focused]){background-color:var(\n--highcontrast-menu-item-background-color-focus,var(\n--mod-menu-item-background-color-key-focus,var(--spectrum-menu-item-background-color-key-focus)\n)\n);outline:none}:host(:focus)>#label,:host([focused])>#label{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-content-color-focus,var(--spectrum-menu-item-label-content-color-focus)\n)\n)}:host(:focus)>.spectrum-Menu-itemDescription,:host([focused])>.spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-description-color-focus,var(--spectrum-menu-item-description-color-focus)\n)\n)}:host(:focus)>::slotted([slot=value]),:host([focused])>::slotted([slot=value]){color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-value-color-focus,var(--spectrum-menu-item-value-color-focus)\n)\n)}:host(:focus)>.icon:not(.chevron,.checkmark),:host([focused])>.icon:not(.chevron,.checkmark){fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-focus,var(--spectrum-menu-item-label-icon-color-focus)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-focus,var(--spectrum-menu-item-label-icon-color-focus)\n)\n)}:host(:focus)>.chevron,:host([focused])>.chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n)}:host(:focus)>.checkmark,:host([focused])>.checkmark{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-focus,var(--spectrum-menu-checkmark-icon-color-focus)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-focus,var(--spectrum-menu-checkmark-icon-color-focus)\n)\n)}:host([focused]){box-shadow:inset calc(var(\n--mod-menu-item-focus-indicator-width,\nvar(--spectrum-menu-item-focus-indicator-width)\n)*var(--spectrum-menu-item-focus-indicator-direction-scalar, 1)) 0 0 0 var(\n--highcontrast-menu-item-focus-indicator-color,var(\n--mod-menu-item-focus-indicator-color,var(--spectrum-menu-item-focus-indicator-color)\n)\n)}:host([dir=rtl]){--spectrum-menu-item-focus-indicator-direction-scalar:-1}:host(:hover){background-color:var(\n--highcontrast-menu-item-background-color-focus,var(\n--mod-menu-item-background-color-hover,var(--spectrum-menu-item-background-color-hover)\n)\n)}:host(:hover)>#label{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-content-color-hover,var(--spectrum-menu-item-label-content-color-hover)\n)\n)}:host(:hover)>.spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-description-color-hover,var(--spectrum-menu-item-description-color-hover)\n)\n)}:host(:hover)>::slotted([slot=value]){color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-value-color-hover,var(--spectrum-menu-item-value-color-hover)\n)\n)}:host(:hover)>.icon:not(.chevron,.checkmark){fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-hover,var(--spectrum-menu-item-label-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-hover,var(--spectrum-menu-item-label-icon-color-hover)\n)\n)}:host(:hover)>.chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n)}:host(:hover)>.checkmark{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-hover,var(--spectrum-menu-checkmark-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-hover,var(--spectrum-menu-checkmark-icon-color-hover)\n)\n)}:host:active{background-color:var(\n--highcontrast-menu-item-background-color-focus,var(\n--mod-menu-item-background-color-down,var(--spectrum-menu-item-background-color-down)\n)\n)}:host:active>#label{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-content-color-down,var(--spectrum-menu-item-label-content-color-down)\n)\n)}:host:active>.spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-description-color-down,var(--spectrum-menu-item-description-color-down)\n)\n)}:host:active>::slotted([slot=value]){color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-value-color-down,var(--spectrum-menu-item-value-color-down)\n)\n)}:host:active>.icon:not(.chevron,.checkmark){fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-down,var(--spectrum-menu-item-label-icon-color-down)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-down,var(--spectrum-menu-item-label-icon-color-down)\n)\n)}:host:active>.chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n)}:host:active>.checkmark{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-down,var(--spectrum-menu-checkmark-icon-color-down)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-down,var(--spectrum-menu-checkmark-icon-color-down)\n)\n)}:host([aria-disabled=true]),:host([disabled]){background-color:#0000}:host([aria-disabled=true]) #label,:host([disabled]) #label{color:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-content-color-disabled,var(--spectrum-menu-item-label-content-color-disabled)\n)\n)}:host([aria-disabled=true]) .spectrum-Menu-itemDescription,:host([disabled]) .spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-description-color-disabled,var(--spectrum-menu-item-description-color-disabled)\n)\n)}:host([aria-disabled=true]) ::slotted([slot=icon]),:host([disabled]) ::slotted([slot=icon]){fill:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-icon-color-disabled,var(--spectrum-menu-item-label-icon-color-disabled)\n)\n);color:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-icon-color-disabled,var(--spectrum-menu-item-label-icon-color-disabled)\n)\n)}:host([aria-disabled=true]:hover),:host([disabled]:hover){cursor:default}:host([aria-disabled=true]:hover) ::slotted([slot=icon]),:host([disabled]:hover) ::slotted([slot=icon]){fill:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-icon-color-disabled,var(--spectrum-menu-item-label-icon-color-disabled)\n)\n);color:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-icon-color-disabled,var(--spectrum-menu-item-label-icon-color-disabled)\n)\n)}::slotted([slot=icon]){align-self:start;grid-area:iconArea}.checkmark{align-self:start;grid-area:checkmarkArea}.menu-itemSelection{grid-area:selectedArea}#label{color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-label-content-color-default,var(--spectrum-menu-item-label-content-color-default)\n)\n);font-size:var(\n--mod-menu-item-label-font-size,var(--spectrum-menu-item-label-font-size)\n);grid-area:labelArea}::slotted([slot=value]){grid-area:valueArea}.spectrum-Menu-itemActions{grid-area:actionsArea}.chevron{align-self:center;block-size:var(--spectrum-menu-item-checkmark-height);grid-area:chevronArea;height:var(--spectrum-menu-item-checkmark-height);inline-size:var(--spectrum-menu-item-checkmark-width);width:var(--spectrum-menu-item-checkmark-width)}.spectrum-Menu-item--collapsible .chevron{grid-area:chevronAreaCollapsible}.spectrum-Menu-itemDescription{grid-area:descriptionArea}:host([has-submenu]) .chevron{grid-area:chevronAreaDrillIn}.icon:not(.chevron,.checkmark){block-size:var(\n--mod-menu-item-icon-height,var(--spectrum-menu-item-icon-height)\n);inline-size:var(\n--mod-menu-item-icon-width,var(--spectrum-menu-item-icon-width)\n)}.checkmark{block-size:var(\n--mod-menu-item-checkmark-height,var(--spectrum-menu-item-checkmark-height)\n);inline-size:var(\n--mod-menu-item-checkmark-width,var(--spectrum-menu-item-checkmark-width)\n);margin-block-start:calc(var(\n--mod-menu-item-top-to-checkmark,\nvar(--spectrum-menu-item-top-to-checkmark)\n) - var(\n--mod-menu-item-top-edge-to-text,\nvar(--spectrum-menu-item-top-edge-to-text)\n));margin-inline-end:var(\n--mod-menu-item-text-to-control,var(--spectrum-menu-item-text-to-control)\n)}::slotted([slot=icon]){margin-inline-end:var(\n--mod-menu-item-label-text-to-visual,var(--spectrum-menu-item-label-text-to-visual)\n)}.chevron{margin-inline-end:var(\n--mod-menu-item-text-to-control,var(--spectrum-menu-item-text-to-control)\n)}.spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-description-color-default,var(--spectrum-menu-item-description-color-default)\n)\n);font-size:var(\n--mod-menu-item-description-font-size,var(--spectrum-menu-item-description-font-size)\n);line-height:var(\n--mod-menu-item-description-line-height,var(--spectrum-menu-item-description-line-height)\n);margin-block-start:var(\n--mod-menu-item-label-to-description-spacing,var(--spectrum-menu-item-label-to-description-spacing)\n)}#label,.spectrum-Menu-itemDescription{-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word}::slotted([slot=value]){color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-value-color-default,var(--spectrum-menu-item-value-color-default)\n)\n);font-size:var(\n--mod-menu-item-label-font-size,var(--spectrum-menu-item-label-font-size)\n);justify-self:end;margin-inline-start:var(\n--mod-menu-item-label-to-value-area-min-spacing,var(--spectrum-menu-item-label-to-value-area-min-spacing)\n)}:host([no-wrap]) #label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.spectrum-Menu-item--collapsible.is-open{padding-block-end:0}.spectrum-Menu-item--collapsible.is-open .chevron{transform:rotate(90deg)}.spectrum-Menu-item--collapsible.is-open:active,.spectrum-Menu-item--collapsible.is-open:focus,.spectrum-Menu-item--collapsible.is-open:hover,:host([focused]) .spectrum-Menu-item--collapsible.is-open{background-color:var(\n--highcontrast-menu-item-background-color-default,var(\n--mod-menu-item-background-color-default,var(--spectrum-menu-item-background-color-default)\n)\n)}.spectrum-Menu-item--collapsible>::slotted([slot=icon]){padding-block-end:var(\n--mod-menu-section-header-bottom-edge-to-text,var(\n--mod-menu-item-bottom-edge-to-text,var(--spectrum-menu-item-bottom-edge-to-text)\n)\n);padding-block-start:var(\n--mod-menu-section-header-top-edge-to-text,var(\n--mod-menu-item-top-edge-to-text,var(--spectrum-menu-item-top-edge-to-text)\n)\n)}:host([dir=rtl]) .chevron{transform:rotate(-180deg)}:host([has-submenu]) .chevron{fill:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-drillin-icon-color-default,var(--spectrum-menu-drillin-icon-color-default)\n)\n);color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-drillin-icon-color-default,var(--spectrum-menu-drillin-icon-color-default)\n)\n);margin-inline-end:0;margin-inline-start:var(\n--mod-menu-item-label-to-value-area-min-spacing,var(--spectrum-menu-item-label-to-value-area-min-spacing)\n)}:host([has-submenu]) .is-open{--spectrum-menu-item-background-color-default:var(\n--highcontrast-menu-item-selected-background-color,var(\n--mod-menu-item-background-color-hover,var(--spectrum-menu-item-background-color-hover)\n)\n)}:host([has-submenu]) .is-open .icon:not(.chevron,.checkmark){fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-hover,var(--spectrum-menu-item-label-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-hover,var(--spectrum-menu-item-label-icon-color-hover)\n)\n)}:host([has-submenu]) .is-open .chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-hover,var(--spectrum-menu-drillin-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-hover,var(--spectrum-menu-drillin-icon-color-hover)\n)\n)}:host([has-submenu]) .is-open .checkmark{fill:var(\n--highcontrast-menu-checkmark-icon-color-default,var(\n--mod-menu-checkmark-icon-color-hover,var(--spectrum-menu-checkmark-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-checkmark-icon-color-default,var(\n--mod-menu-checkmark-icon-color-hover,var(--spectrum-menu-checkmark-icon-color-hover)\n)\n)}:host([has-submenu]:hover) .chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-hover,var(--spectrum-menu-drillin-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-hover,var(--spectrum-menu-drillin-icon-color-hover)\n)\n)}:host([has-submenu]:focus) .chevron,:host([has-submenu][focused]) .chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-focus,var(--spectrum-menu-drillin-icon-color-focus)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-focus,var(--spectrum-menu-drillin-icon-color-focus)\n)\n)}:host([has-submenu]):active .chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-down,var(--spectrum-menu-drillin-icon-color-down)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-down,var(--spectrum-menu-drillin-icon-color-down)\n)\n)}#label{flex:1 1 auto;-webkit-hyphens:auto;hyphens:auto;line-height:var(--spectrum-listitem-texticon-label-line-height);overflow-wrap:break-word;width:calc(100% - var(--spectrum-listitem-texticon-ui-icon-width) - var(--spectrum-listitem-texticon-icon-gap))}.spectrum-Menu-itemLabel--wrapping{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([hidden]){display:none}:host([disabled]){pointer-events:none}#button{inset:0;position:absolute}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors:active){:host{forced-color-adjust:none}}\n`;\nexport default styles;"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 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::slotted([slot=icon]){fill:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-label-icon-color-default,var(--spectrum-menu-item-label-icon-color-default)\n)\n);color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-label-icon-color-default,var(--spectrum-menu-item-label-icon-color-default)\n)\n)}.checkmark{fill:var(\n--highcontrast-menu-checkmark-icon-color-default,var(\n--mod-menu-checkmark-icon-color-default,var(--spectrum-menu-checkmark-icon-color-default)\n)\n);align-self:center;color:var(\n--highcontrast-menu-checkmark-icon-color-default,var(\n--mod-menu-checkmark-icon-color-default,var(--spectrum-menu-checkmark-icon-color-default)\n)\n);display:var(\n--mod-menu-checkmark-display,var(--spectrum-menu-checkmark-display)\n);opacity:1}:host{align-items:center;background-color:var(\n--highcontrast-menu-item-background-color-default,var(\n--mod-menu-item-background-color-default,var(--spectrum-menu-item-background-color-default)\n)\n);box-sizing:border-box;cursor:pointer;line-height:var(\n--mod-menu-item-label-line-height,var(--spectrum-menu-item-label-line-height)\n);margin:0;min-block-size:var(\n--mod-menu-item-min-height,var(--spectrum-menu-item-min-height)\n);padding-block-end:var(\n--mod-menu-item-bottom-edge-to-text,var(--spectrum-menu-item-bottom-edge-to-text)\n);padding-block-start:var(\n--mod-menu-item-top-edge-to-text,var(--spectrum-menu-item-top-edge-to-text)\n);padding-inline:var(\n--mod-menu-item-label-inline-edge-to-content,var(--spectrum-menu-item-label-inline-edge-to-content)\n);position:relative;-webkit-text-decoration:none;text-decoration:none}:host{display:grid;grid-template:\". chevronAreaCollapsible . iconArea sectionHeadingArea . . .\" 1fr \"selectedArea chevronAreaCollapsible checkmarkArea iconArea labelArea valueArea actionsArea chevronAreaDrillIn\" \". . . . descriptionArea . . .\" \". . . . submenuArea . . .\"/auto auto auto auto 1fr auto auto auto}#label{grid-area:submenuItemLabelArea}::slotted([slot=value]){grid-area:submenuItemValueArea}:host(:focus),:host([focused]){background-color:var(\n--highcontrast-menu-item-background-color-focus,var(\n--mod-menu-item-background-color-key-focus,var(--spectrum-menu-item-background-color-key-focus)\n)\n);outline:none}:host(:focus)>#label,:host([focused])>#label{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-content-color-focus,var(--spectrum-menu-item-label-content-color-focus)\n)\n)}:host(:focus)>.spectrum-Menu-itemDescription,:host([focused])>.spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-description-color-focus,var(--spectrum-menu-item-description-color-focus)\n)\n)}:host(:focus)>::slotted([slot=value]),:host([focused])>::slotted([slot=value]){color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-value-color-focus,var(--spectrum-menu-item-value-color-focus)\n)\n)}:host(:focus)>.icon:not(.chevron,.checkmark),:host([focused])>.icon:not(.chevron,.checkmark){fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-focus,var(--spectrum-menu-item-label-icon-color-focus)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-focus,var(--spectrum-menu-item-label-icon-color-focus)\n)\n)}:host(:focus)>.chevron,:host([focused])>.chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n)}:host(:focus)>.checkmark,:host([focused])>.checkmark{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-focus,var(--spectrum-menu-checkmark-icon-color-focus)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-focus,var(--spectrum-menu-checkmark-icon-color-focus)\n)\n)}:host([focused]){box-shadow:inset calc(var(\n--mod-menu-item-focus-indicator-width,\nvar(--spectrum-menu-item-focus-indicator-width)\n)*var(--spectrum-menu-item-focus-indicator-direction-scalar, 1)) 0 0 0 var(\n--highcontrast-menu-item-focus-indicator-color,var(\n--mod-menu-item-focus-indicator-color,var(--spectrum-menu-item-focus-indicator-color)\n)\n)}:host([dir=rtl]){--spectrum-menu-item-focus-indicator-direction-scalar:-1}:host(:hover){background-color:var(\n--highcontrast-menu-item-background-color-focus,var(\n--mod-menu-item-background-color-hover,var(--spectrum-menu-item-background-color-hover)\n)\n)}:host(:hover)>#label{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-content-color-hover,var(--spectrum-menu-item-label-content-color-hover)\n)\n)}:host(:hover)>.spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-description-color-hover,var(--spectrum-menu-item-description-color-hover)\n)\n)}:host(:hover)>::slotted([slot=value]){color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-value-color-hover,var(--spectrum-menu-item-value-color-hover)\n)\n)}:host(:hover)>.icon:not(.chevron,.checkmark){fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-hover,var(--spectrum-menu-item-label-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-hover,var(--spectrum-menu-item-label-icon-color-hover)\n)\n)}:host(:hover)>.chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n)}:host(:hover)>.checkmark{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-hover,var(--spectrum-menu-checkmark-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-hover,var(--spectrum-menu-checkmark-icon-color-hover)\n)\n)}:host:active{background-color:var(\n--highcontrast-menu-item-background-color-focus,var(\n--mod-menu-item-background-color-down,var(--spectrum-menu-item-background-color-down)\n)\n)}:host:active>#label{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-content-color-down,var(--spectrum-menu-item-label-content-color-down)\n)\n)}:host:active>.spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-description-color-down,var(--spectrum-menu-item-description-color-down)\n)\n)}:host:active>::slotted([slot=value]){color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-value-color-down,var(--spectrum-menu-item-value-color-down)\n)\n)}:host:active>.icon:not(.chevron,.checkmark){fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-down,var(--spectrum-menu-item-label-icon-color-down)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-down,var(--spectrum-menu-item-label-icon-color-down)\n)\n)}:host:active>.chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-collapsible-icon-color,var(--spectrum-menu-collapsible-icon-color)\n)\n)}:host:active>.checkmark{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-down,var(--spectrum-menu-checkmark-icon-color-down)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-checkmark-icon-color-down,var(--spectrum-menu-checkmark-icon-color-down)\n)\n)}:host([aria-disabled=true]),:host([disabled]){background-color:#0000}:host([aria-disabled=true]) #label,:host([disabled]) #label{color:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-content-color-disabled,var(--spectrum-menu-item-label-content-color-disabled)\n)\n)}:host([aria-disabled=true]) .spectrum-Menu-itemDescription,:host([disabled]) .spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-description-color-disabled,var(--spectrum-menu-item-description-color-disabled)\n)\n)}:host([aria-disabled=true]) ::slotted([slot=icon]),:host([disabled]) ::slotted([slot=icon]){fill:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-icon-color-disabled,var(--spectrum-menu-item-label-icon-color-disabled)\n)\n);color:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-icon-color-disabled,var(--spectrum-menu-item-label-icon-color-disabled)\n)\n)}:host([aria-disabled=true]:hover),:host([disabled]:hover){cursor:default}:host([aria-disabled=true]:hover) ::slotted([slot=icon]),:host([disabled]:hover) ::slotted([slot=icon]){fill:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-icon-color-disabled,var(--spectrum-menu-item-label-icon-color-disabled)\n)\n);color:var(\n--highcontrast-menu-item-color-disabled,var(\n--mod-menu-item-label-icon-color-disabled,var(--spectrum-menu-item-label-icon-color-disabled)\n)\n)}::slotted([slot=icon]){align-self:start;grid-area:iconArea}.checkmark{align-self:start;grid-area:checkmarkArea}.menu-itemSelection{grid-area:selectedArea}#label{color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-label-content-color-default,var(--spectrum-menu-item-label-content-color-default)\n)\n);font-size:var(\n--mod-menu-item-label-font-size,var(--spectrum-menu-item-label-font-size)\n);grid-area:labelArea}::slotted([slot=value]){grid-area:valueArea}.spectrum-Menu-itemActions{grid-area:actionsArea}.chevron{align-self:center;block-size:var(--spectrum-menu-item-checkmark-height);grid-area:chevronArea;height:var(--spectrum-menu-item-checkmark-height);inline-size:var(--spectrum-menu-item-checkmark-width);width:var(--spectrum-menu-item-checkmark-width)}.spectrum-Menu-item--collapsible .chevron{grid-area:chevronAreaCollapsible}.spectrum-Menu-itemDescription{grid-area:descriptionArea}:host([has-submenu]) .chevron{grid-area:chevronAreaDrillIn}.icon:not(.chevron,.checkmark){block-size:var(\n--mod-menu-item-icon-height,var(--spectrum-menu-item-icon-height)\n);inline-size:var(\n--mod-menu-item-icon-width,var(--spectrum-menu-item-icon-width)\n)}.checkmark{block-size:var(\n--mod-menu-item-checkmark-height,var(--spectrum-menu-item-checkmark-height)\n);inline-size:var(\n--mod-menu-item-checkmark-width,var(--spectrum-menu-item-checkmark-width)\n);margin-block-start:calc(var(\n--mod-menu-item-top-to-checkmark,\nvar(--spectrum-menu-item-top-to-checkmark)\n) - var(\n--mod-menu-item-top-edge-to-text,\nvar(--spectrum-menu-item-top-edge-to-text)\n));margin-inline-end:var(\n--mod-menu-item-text-to-control,var(--spectrum-menu-item-text-to-control)\n)}::slotted([slot=icon]){margin-inline-end:var(\n--mod-menu-item-label-text-to-visual,var(--spectrum-menu-item-label-text-to-visual)\n)}.chevron{margin-inline-end:var(\n--mod-menu-item-text-to-control,var(--spectrum-menu-item-text-to-control)\n)}.spectrum-Menu-itemDescription{color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-description-color-default,var(--spectrum-menu-item-description-color-default)\n)\n);font-size:var(\n--mod-menu-item-description-font-size,var(--spectrum-menu-item-description-font-size)\n);line-height:var(\n--mod-menu-item-description-line-height,var(--spectrum-menu-item-description-line-height)\n);margin-block-start:var(\n--mod-menu-item-label-to-description-spacing,var(--spectrum-menu-item-label-to-description-spacing)\n)}#label,.spectrum-Menu-itemDescription{-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word}::slotted([slot=value]){color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-item-value-color-default,var(--spectrum-menu-item-value-color-default)\n)\n);font-size:var(\n--mod-menu-item-label-font-size,var(--spectrum-menu-item-label-font-size)\n);justify-self:end;margin-inline-start:var(\n--mod-menu-item-label-to-value-area-min-spacing,var(--spectrum-menu-item-label-to-value-area-min-spacing)\n)}:host([no-wrap]) #label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.spectrum-Menu-item--collapsible.is-open{padding-block-end:0}.spectrum-Menu-item--collapsible.is-open .chevron{transform:rotate(90deg)}.spectrum-Menu-item--collapsible.is-open:active,.spectrum-Menu-item--collapsible.is-open:focus,.spectrum-Menu-item--collapsible.is-open:hover,:host([focused]) .spectrum-Menu-item--collapsible.is-open{background-color:var(\n--highcontrast-menu-item-background-color-default,var(\n--mod-menu-item-background-color-default,var(--spectrum-menu-item-background-color-default)\n)\n)}.spectrum-Menu-item--collapsible>::slotted([slot=icon]){padding-block-end:var(\n--mod-menu-section-header-bottom-edge-to-text,var(\n--mod-menu-item-bottom-edge-to-text,var(--spectrum-menu-item-bottom-edge-to-text)\n)\n);padding-block-start:var(\n--mod-menu-section-header-top-edge-to-text,var(\n--mod-menu-item-top-edge-to-text,var(--spectrum-menu-item-top-edge-to-text)\n)\n)}:host([dir=rtl]) .chevron{transform:rotate(-180deg)}:host([has-submenu]) .chevron{fill:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-drillin-icon-color-default,var(--spectrum-menu-drillin-icon-color-default)\n)\n);color:var(\n--highcontrast-menu-item-color-default,var(\n--mod-menu-drillin-icon-color-default,var(--spectrum-menu-drillin-icon-color-default)\n)\n);margin-inline-end:0;margin-inline-start:var(\n--mod-menu-item-label-to-value-area-min-spacing,var(--spectrum-menu-item-label-to-value-area-min-spacing)\n)}:host([has-submenu]) .is-open{--spectrum-menu-item-background-color-default:var(\n--highcontrast-menu-item-selected-background-color,var(\n--mod-menu-item-background-color-hover,var(--spectrum-menu-item-background-color-hover)\n)\n)}:host([has-submenu]) .is-open .icon:not(.chevron,.checkmark){fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-hover,var(--spectrum-menu-item-label-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-item-label-icon-color-hover,var(--spectrum-menu-item-label-icon-color-hover)\n)\n)}:host([has-submenu]) .is-open .chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-hover,var(--spectrum-menu-drillin-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-hover,var(--spectrum-menu-drillin-icon-color-hover)\n)\n)}:host([has-submenu]) .is-open .checkmark{fill:var(\n--highcontrast-menu-checkmark-icon-color-default,var(\n--mod-menu-checkmark-icon-color-hover,var(--spectrum-menu-checkmark-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-checkmark-icon-color-default,var(\n--mod-menu-checkmark-icon-color-hover,var(--spectrum-menu-checkmark-icon-color-hover)\n)\n)}:host([has-submenu]:hover) .chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-hover,var(--spectrum-menu-drillin-icon-color-hover)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-hover,var(--spectrum-menu-drillin-icon-color-hover)\n)\n)}:host([has-submenu]:focus) .chevron,:host([has-submenu][focused]) .chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-focus,var(--spectrum-menu-drillin-icon-color-focus)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-focus,var(--spectrum-menu-drillin-icon-color-focus)\n)\n)}:host([has-submenu]):active .chevron{fill:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-down,var(--spectrum-menu-drillin-icon-color-down)\n)\n);color:var(\n--highcontrast-menu-item-color-focus,var(\n--mod-menu-drillin-icon-color-down,var(--spectrum-menu-drillin-icon-color-down)\n)\n)}#label{flex:1 1 auto;-webkit-hyphens:auto;hyphens:auto;line-height:var(--spectrum-listitem-texticon-label-line-height);overflow-wrap:break-word;width:calc(100% - var(--spectrum-listitem-texticon-ui-icon-width) - var(--spectrum-listitem-texticon-icon-gap))}.spectrum-Menu-itemLabel--wrapping{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([hidden]){display:none}:host([disabled]){pointer-events:none}#button{inset:0;position:absolute}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors:active){:host{forced-color-adjust:none}}::slotted([slot=submenu]){max-width:100%;width:max-content}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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
300
|
--highcontrast-menu-item-color-focus,var(
|
|
301
301
|
--mod-menu-drillin-icon-color-down,var(--spectrum-menu-drillin-icon-color-down)
|
|
302
302
|
)
|
|
303
|
-
)}#label{flex:1 1 auto;-webkit-hyphens:auto;hyphens:auto;line-height:var(--spectrum-listitem-texticon-label-line-height);overflow-wrap:break-word;width:calc(100% - var(--spectrum-listitem-texticon-ui-icon-width) - var(--spectrum-listitem-texticon-icon-gap))}.spectrum-Menu-itemLabel--wrapping{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([hidden]){display:none}:host([disabled]){pointer-events:none}#button{inset:0;position:absolute}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors:active){:host{forced-color-adjust:none}}
|
|
303
|
+
)}#label{flex:1 1 auto;-webkit-hyphens:auto;hyphens:auto;line-height:var(--spectrum-listitem-texticon-label-line-height);overflow-wrap:break-word;width:calc(100% - var(--spectrum-listitem-texticon-ui-icon-width) - var(--spectrum-listitem-texticon-icon-gap))}.spectrum-Menu-itemLabel--wrapping{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([hidden]){display:none}:host([disabled]){pointer-events:none}#button{inset:0;position:absolute}:host([dir=ltr]) [icon-only]::slotted(:last-of-type){margin-right:auto}:host([dir=rtl]) [icon-only]::slotted(:last-of-type){margin-left:auto}@media (forced-colors:active){:host{forced-color-adjust:none}}::slotted([slot=submenu]){max-width:100%;width:max-content}
|
|
304
304
|
`;export default e;
|
|
305
305
|
//# sourceMappingURL=menu-item.css.js.map
|