@material/web 2.4.2-nightly.95013d6.0 → 2.4.2-nightly.a3379a3.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/button/internal/_touch-target.scss +1 -1
- package/button/internal/shared-styles.css +1 -1
- package/button/internal/shared-styles.css.map +1 -1
- package/button/internal/shared-styles.cssresult.js +1 -1
- package/button/internal/shared-styles.cssresult.js.map +1 -1
- package/labs/gb/components/list/md-list-item.d.ts +1 -1
- package/labs/gb/components/list/md-list-item.js +7 -7
- package/labs/gb/components/list/md-list-item.js.map +1 -1
- package/labs/gb/components/splitbutton/split-button.d.ts +1 -1
- package/labs/gb/components/splitbutton/split-button.js +1 -1
- package/labs/gb/components/splitbutton/split-button.js.map +1 -1
- package/list/internal/listitem/list-item.d.ts +4 -1
- package/list/internal/listitem/list-item.js +4 -1
- package/list/internal/listitem/list-item.js.map +1 -1
- package/menu/internal/submenu/sub-menu.d.ts +5 -1
- package/menu/internal/submenu/sub-menu.js +5 -1
- package/menu/internal/submenu/sub-menu.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
:host{border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end);box-sizing:border-box;cursor:pointer;display:inline-flex;gap:8px;min-height:var(--_container-height);outline:none;padding-block:calc((var(--_container-height) - max(var(--_label-text-line-height),var(--_icon-size)))/2);padding-inline-start:var(--_leading-space);padding-inline-end:var(--_trailing-space);place-content:center;place-items:center;position:relative;font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight);text-overflow:ellipsis;text-wrap:nowrap;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);vertical-align:top;--md-ripple-hover-color: var(--_hover-state-layer-color);--md-ripple-pressed-color: var(--_pressed-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}md-focus-ring{--md-focus-ring-shape-start-start: var(--_container-shape-start-start);--md-focus-ring-shape-start-end: var(--_container-shape-start-end);--md-focus-ring-shape-end-end: var(--_container-shape-end-end);--md-focus-ring-shape-end-start: var(--_container-shape-end-start)}:host(:is([disabled],[soft-disabled])){cursor:default;pointer-events:none}.button{border-radius:inherit;cursor:inherit;display:inline-flex;align-items:center;justify-content:center;border:none;outline:none;-webkit-appearance:none;vertical-align:middle;background:rgba(0,0,0,0);text-decoration:none;min-width:calc(64px - var(--_leading-space) - var(--_trailing-space));width:100%;z-index:0;height:100%;font:inherit;color:var(--_label-text-color);padding:0;gap:inherit;text-transform:inherit}.button::-moz-focus-inner{padding:0;border:0}:host(:hover) .button{color:var(--_hover-label-text-color)}:host(:focus-within) .button{color:var(--_focus-label-text-color)}:host(:active) .button{color:var(--_pressed-label-text-color)}.background{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute}.label{overflow:hidden}:is(.button,.label,.label slot),.label ::slotted(*){text-overflow:inherit}:host(:is([disabled],[soft-disabled])) .label{color:var(--_disabled-label-text-color);opacity:var(--_disabled-label-text-opacity)}:host(:is([disabled],[soft-disabled])) .background{background:var(--_disabled-container-color);opacity:var(--_disabled-container-opacity)}@media(forced-colors: active){.background{border:1px solid CanvasText}:host(:is([disabled],[soft-disabled])){--_disabled-icon-color: GrayText;--_disabled-icon-opacity: 1;--_disabled-container-opacity: 1;--_disabled-label-text-color: GrayText;--_disabled-label-text-opacity: 1}}:host([has-icon]:not([trailing-icon])){padding-inline-start:var(--_with-leading-icon-leading-space);padding-inline-end:var(--_with-leading-icon-trailing-space)}:host([has-icon][trailing-icon]){padding-inline-start:var(--_with-trailing-icon-leading-space);padding-inline-end:var(--_with-trailing-icon-trailing-space)}::slotted([slot=icon]){display:inline-flex;position:relative;writing-mode:horizontal-tb;fill:currentColor;flex-shrink:0;color:var(--_icon-color);font-size:var(--_icon-size);inline-size:var(--_icon-size);block-size:var(--_icon-size)}:host(:hover) ::slotted([slot=icon]){color:var(--_hover-icon-color)}:host(:focus-within) ::slotted([slot=icon]){color:var(--_focus-icon-color)}:host(:active) ::slotted([slot=icon]){color:var(--_pressed-icon-color)}:host(:is([disabled],[soft-disabled])) ::slotted([slot=icon]){color:var(--_disabled-icon-color);opacity:var(--_disabled-icon-opacity)}.touch{position:absolute;top:50%;height:48px;left:0;right:0;transform:translateY(-50%)}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_container-height))/2) 0}:host([touch-target=none]) .touch{display:none}/*# sourceMappingURL=shared-styles.css.map */
|
|
1
|
+
:host{border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end);box-sizing:border-box;cursor:pointer;display:inline-flex;gap:8px;min-height:var(--_container-height);outline:none;padding-block:calc((var(--_container-height) - max(var(--_label-text-line-height),var(--_icon-size)))/2);padding-inline-start:var(--_leading-space);padding-inline-end:var(--_trailing-space);place-content:center;place-items:center;position:relative;font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight);text-overflow:ellipsis;text-wrap:nowrap;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);vertical-align:top;--md-ripple-hover-color: var(--_hover-state-layer-color);--md-ripple-pressed-color: var(--_pressed-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}md-focus-ring{--md-focus-ring-shape-start-start: var(--_container-shape-start-start);--md-focus-ring-shape-start-end: var(--_container-shape-start-end);--md-focus-ring-shape-end-end: var(--_container-shape-end-end);--md-focus-ring-shape-end-start: var(--_container-shape-end-start)}:host(:is([disabled],[soft-disabled])){cursor:default;pointer-events:none}.button{border-radius:inherit;cursor:inherit;display:inline-flex;align-items:center;justify-content:center;border:none;outline:none;-webkit-appearance:none;vertical-align:middle;background:rgba(0,0,0,0);text-decoration:none;min-width:calc(64px - var(--_leading-space) - var(--_trailing-space));width:100%;z-index:0;height:100%;font:inherit;color:var(--_label-text-color);padding:0;gap:inherit;text-transform:inherit}.button::-moz-focus-inner{padding:0;border:0}:host(:hover) .button{color:var(--_hover-label-text-color)}:host(:focus-within) .button{color:var(--_focus-label-text-color)}:host(:active) .button{color:var(--_pressed-label-text-color)}.background{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute}.label{overflow:hidden}:is(.button,.label,.label slot),.label ::slotted(*){text-overflow:inherit}:host(:is([disabled],[soft-disabled])) .label{color:var(--_disabled-label-text-color);opacity:var(--_disabled-label-text-opacity)}:host(:is([disabled],[soft-disabled])) .background{background:var(--_disabled-container-color);opacity:var(--_disabled-container-opacity)}@media(forced-colors: active){.background{border:1px solid CanvasText}:host(:is([disabled],[soft-disabled])){--_disabled-icon-color: GrayText;--_disabled-icon-opacity: 1;--_disabled-container-opacity: 1;--_disabled-label-text-color: GrayText;--_disabled-label-text-opacity: 1}}:host([has-icon]:not([trailing-icon])){padding-inline-start:var(--_with-leading-icon-leading-space);padding-inline-end:var(--_with-leading-icon-trailing-space)}:host([has-icon][trailing-icon]){padding-inline-start:var(--_with-trailing-icon-leading-space);padding-inline-end:var(--_with-trailing-icon-trailing-space)}::slotted([slot=icon]){display:inline-flex;position:relative;writing-mode:horizontal-tb;fill:currentColor;flex-shrink:0;color:var(--_icon-color);font-size:var(--_icon-size);inline-size:var(--_icon-size);block-size:var(--_icon-size)}:host(:hover) ::slotted([slot=icon]){color:var(--_hover-icon-color)}:host(:focus-within) ::slotted([slot=icon]){color:var(--_focus-icon-color)}:host(:active) ::slotted([slot=icon]){color:var(--_pressed-icon-color)}:host(:is([disabled],[soft-disabled])) ::slotted([slot=icon]){color:var(--_disabled-icon-color);opacity:var(--_disabled-icon-opacity)}.touch{position:absolute;top:50%;height:max(48px,100%);left:0;right:0;transform:translateY(-50%)}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_container-height))/2) 0}:host([touch-target=none]) .touch{display:none}/*# sourceMappingURL=shared-styles.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["_shared.scss","../../ripple/internal/_ripple.scss","../../focus/internal/_focus-ring.scss","_icon.scss","_touch-target.scss"],"names":[],"mappings":"AAcE,MACE,8DACA,0DACA,0DACA,sDACA,sBACA,eACA,oBACA,QAEA,oCACA,aAMA,yGACA,2CACA,0CACA,qBACA,mBACA,kBACA,oCACA,kCACA,2CACA,sCAGA,uBACA,iBACA,iBACA,0CAIA,mBC7BE,oPDyCJ,cEvCI,4QFkDJ,uCACE,eACA,oBAGF,QACE,sBACA,eACA,oBACA,mBACA,uBACA,YACA,aACA,wBACA,sBACA,yBACA,qBAIA,sEACA,WACA,UACA,YACA,aACA,+BACA,UACA,YAEA,uBAEA,0BACE,UACA,SAIJ,sBACE,qCAGF,6BACE,qCAGF,uBACE,uCAGF,YAEE,mCACA,sBACA,QACA,kBAGF,OACE,gBAKF,oDAEE,sBAGF,8CACE,wCACA,4CAGF,mDACE,4CACA,2CAGF,8BACE,YAIE,4BAGF,uCACE,iCACA,4BACA,iCACA,uCACA,mCAIJ,uCACE,6DACA,4DAGF,iCACE,8DACA,6DGtKF,uBACE,oBACA,kBACA,2BACA,kBACA,cACA,yBACA,4BACA,8BACA,6BAGF,qCACE,+BAGF,4CACE,+BAGF,sCACE,iCAGF,8DACE,kCACA,sCC7BF,OACE,kBACA,QACA,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["_shared.scss","../../ripple/internal/_ripple.scss","../../focus/internal/_focus-ring.scss","_icon.scss","_touch-target.scss"],"names":[],"mappings":"AAcE,MACE,8DACA,0DACA,0DACA,sDACA,sBACA,eACA,oBACA,QAEA,oCACA,aAMA,yGACA,2CACA,0CACA,qBACA,mBACA,kBACA,oCACA,kCACA,2CACA,sCAGA,uBACA,iBACA,iBACA,0CAIA,mBC7BE,oPDyCJ,cEvCI,4QFkDJ,uCACE,eACA,oBAGF,QACE,sBACA,eACA,oBACA,mBACA,uBACA,YACA,aACA,wBACA,sBACA,yBACA,qBAIA,sEACA,WACA,UACA,YACA,aACA,+BACA,UACA,YAEA,uBAEA,0BACE,UACA,SAIJ,sBACE,qCAGF,6BACE,qCAGF,uBACE,uCAGF,YAEE,mCACA,sBACA,QACA,kBAGF,OACE,gBAKF,oDAEE,sBAGF,8CACE,wCACA,4CAGF,mDACE,4CACA,2CAGF,8BACE,YAIE,4BAGF,uCACE,iCACA,4BACA,iCACA,uCACA,mCAIJ,uCACE,6DACA,4DAGF,iCACE,8DACA,6DGtKF,uBACE,oBACA,kBACA,2BACA,kBACA,cACA,yBACA,4BACA,8BACA,6BAGF,qCACE,+BAGF,4CACE,+BAGF,sCACE,iCAGF,8DACE,kCACA,sCC7BF,OACE,kBACA,QACA,sBACA,OACA,QACA,2BAGF,8BACE,sDAGF,kCACE","file":"shared-styles.css"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// Generated stylesheet for ./button/internal/shared-styles.css.
|
|
7
7
|
import { css } from 'lit';
|
|
8
|
-
export const styles = css `:host{border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end);box-sizing:border-box;cursor:pointer;display:inline-flex;gap:8px;min-height:var(--_container-height);outline:none;padding-block:calc((var(--_container-height) - max(var(--_label-text-line-height),var(--_icon-size)))/2);padding-inline-start:var(--_leading-space);padding-inline-end:var(--_trailing-space);place-content:center;place-items:center;position:relative;font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight);text-overflow:ellipsis;text-wrap:nowrap;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);vertical-align:top;--md-ripple-hover-color: var(--_hover-state-layer-color);--md-ripple-pressed-color: var(--_pressed-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}md-focus-ring{--md-focus-ring-shape-start-start: var(--_container-shape-start-start);--md-focus-ring-shape-start-end: var(--_container-shape-start-end);--md-focus-ring-shape-end-end: var(--_container-shape-end-end);--md-focus-ring-shape-end-start: var(--_container-shape-end-start)}:host(:is([disabled],[soft-disabled])){cursor:default;pointer-events:none}.button{border-radius:inherit;cursor:inherit;display:inline-flex;align-items:center;justify-content:center;border:none;outline:none;-webkit-appearance:none;vertical-align:middle;background:rgba(0,0,0,0);text-decoration:none;min-width:calc(64px - var(--_leading-space) - var(--_trailing-space));width:100%;z-index:0;height:100%;font:inherit;color:var(--_label-text-color);padding:0;gap:inherit;text-transform:inherit}.button::-moz-focus-inner{padding:0;border:0}:host(:hover) .button{color:var(--_hover-label-text-color)}:host(:focus-within) .button{color:var(--_focus-label-text-color)}:host(:active) .button{color:var(--_pressed-label-text-color)}.background{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute}.label{overflow:hidden}:is(.button,.label,.label slot),.label ::slotted(*){text-overflow:inherit}:host(:is([disabled],[soft-disabled])) .label{color:var(--_disabled-label-text-color);opacity:var(--_disabled-label-text-opacity)}:host(:is([disabled],[soft-disabled])) .background{background:var(--_disabled-container-color);opacity:var(--_disabled-container-opacity)}@media(forced-colors: active){.background{border:1px solid CanvasText}:host(:is([disabled],[soft-disabled])){--_disabled-icon-color: GrayText;--_disabled-icon-opacity: 1;--_disabled-container-opacity: 1;--_disabled-label-text-color: GrayText;--_disabled-label-text-opacity: 1}}:host([has-icon]:not([trailing-icon])){padding-inline-start:var(--_with-leading-icon-leading-space);padding-inline-end:var(--_with-leading-icon-trailing-space)}:host([has-icon][trailing-icon]){padding-inline-start:var(--_with-trailing-icon-leading-space);padding-inline-end:var(--_with-trailing-icon-trailing-space)}::slotted([slot=icon]){display:inline-flex;position:relative;writing-mode:horizontal-tb;fill:currentColor;flex-shrink:0;color:var(--_icon-color);font-size:var(--_icon-size);inline-size:var(--_icon-size);block-size:var(--_icon-size)}:host(:hover) ::slotted([slot=icon]){color:var(--_hover-icon-color)}:host(:focus-within) ::slotted([slot=icon]){color:var(--_focus-icon-color)}:host(:active) ::slotted([slot=icon]){color:var(--_pressed-icon-color)}:host(:is([disabled],[soft-disabled])) ::slotted([slot=icon]){color:var(--_disabled-icon-color);opacity:var(--_disabled-icon-opacity)}.touch{position:absolute;top:50%;height:48px;left:0;right:0;transform:translateY(-50%)}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_container-height))/2) 0}:host([touch-target=none]) .touch{display:none}
|
|
8
|
+
export const styles = css `:host{border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end);box-sizing:border-box;cursor:pointer;display:inline-flex;gap:8px;min-height:var(--_container-height);outline:none;padding-block:calc((var(--_container-height) - max(var(--_label-text-line-height),var(--_icon-size)))/2);padding-inline-start:var(--_leading-space);padding-inline-end:var(--_trailing-space);place-content:center;place-items:center;position:relative;font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight);text-overflow:ellipsis;text-wrap:nowrap;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);vertical-align:top;--md-ripple-hover-color: var(--_hover-state-layer-color);--md-ripple-pressed-color: var(--_pressed-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}md-focus-ring{--md-focus-ring-shape-start-start: var(--_container-shape-start-start);--md-focus-ring-shape-start-end: var(--_container-shape-start-end);--md-focus-ring-shape-end-end: var(--_container-shape-end-end);--md-focus-ring-shape-end-start: var(--_container-shape-end-start)}:host(:is([disabled],[soft-disabled])){cursor:default;pointer-events:none}.button{border-radius:inherit;cursor:inherit;display:inline-flex;align-items:center;justify-content:center;border:none;outline:none;-webkit-appearance:none;vertical-align:middle;background:rgba(0,0,0,0);text-decoration:none;min-width:calc(64px - var(--_leading-space) - var(--_trailing-space));width:100%;z-index:0;height:100%;font:inherit;color:var(--_label-text-color);padding:0;gap:inherit;text-transform:inherit}.button::-moz-focus-inner{padding:0;border:0}:host(:hover) .button{color:var(--_hover-label-text-color)}:host(:focus-within) .button{color:var(--_focus-label-text-color)}:host(:active) .button{color:var(--_pressed-label-text-color)}.background{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute}.label{overflow:hidden}:is(.button,.label,.label slot),.label ::slotted(*){text-overflow:inherit}:host(:is([disabled],[soft-disabled])) .label{color:var(--_disabled-label-text-color);opacity:var(--_disabled-label-text-opacity)}:host(:is([disabled],[soft-disabled])) .background{background:var(--_disabled-container-color);opacity:var(--_disabled-container-opacity)}@media(forced-colors: active){.background{border:1px solid CanvasText}:host(:is([disabled],[soft-disabled])){--_disabled-icon-color: GrayText;--_disabled-icon-opacity: 1;--_disabled-container-opacity: 1;--_disabled-label-text-color: GrayText;--_disabled-label-text-opacity: 1}}:host([has-icon]:not([trailing-icon])){padding-inline-start:var(--_with-leading-icon-leading-space);padding-inline-end:var(--_with-leading-icon-trailing-space)}:host([has-icon][trailing-icon]){padding-inline-start:var(--_with-trailing-icon-leading-space);padding-inline-end:var(--_with-trailing-icon-trailing-space)}::slotted([slot=icon]){display:inline-flex;position:relative;writing-mode:horizontal-tb;fill:currentColor;flex-shrink:0;color:var(--_icon-color);font-size:var(--_icon-size);inline-size:var(--_icon-size);block-size:var(--_icon-size)}:host(:hover) ::slotted([slot=icon]){color:var(--_hover-icon-color)}:host(:focus-within) ::slotted([slot=icon]){color:var(--_focus-icon-color)}:host(:active) ::slotted([slot=icon]){color:var(--_pressed-icon-color)}:host(:is([disabled],[soft-disabled])) ::slotted([slot=icon]){color:var(--_disabled-icon-color);opacity:var(--_disabled-icon-opacity)}.touch{position:absolute;top:50%;height:max(48px,100%);left:0;right:0;transform:translateY(-50%)}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_container-height))/2) 0}:host([touch-target=none]) .touch{display:none}
|
|
9
9
|
`;
|
|
10
10
|
export default styles.styleSheet;
|
|
11
11
|
//# sourceMappingURL=shared-styles.cssresult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-styles.cssresult.js","sourceRoot":"","sources":["shared-styles.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gEAAgE;AAChE,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC;AACF,eAAe,MAAM,CAAC,UAAW,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./button/internal/shared-styles.css.\nimport {css} from 'lit';\nexport const styles = css`:host{border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end);box-sizing:border-box;cursor:pointer;display:inline-flex;gap:8px;min-height:var(--_container-height);outline:none;padding-block:calc((var(--_container-height) - max(var(--_label-text-line-height),var(--_icon-size)))/2);padding-inline-start:var(--_leading-space);padding-inline-end:var(--_trailing-space);place-content:center;place-items:center;position:relative;font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight);text-overflow:ellipsis;text-wrap:nowrap;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);vertical-align:top;--md-ripple-hover-color: var(--_hover-state-layer-color);--md-ripple-pressed-color: var(--_pressed-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}md-focus-ring{--md-focus-ring-shape-start-start: var(--_container-shape-start-start);--md-focus-ring-shape-start-end: var(--_container-shape-start-end);--md-focus-ring-shape-end-end: var(--_container-shape-end-end);--md-focus-ring-shape-end-start: var(--_container-shape-end-start)}:host(:is([disabled],[soft-disabled])){cursor:default;pointer-events:none}.button{border-radius:inherit;cursor:inherit;display:inline-flex;align-items:center;justify-content:center;border:none;outline:none;-webkit-appearance:none;vertical-align:middle;background:rgba(0,0,0,0);text-decoration:none;min-width:calc(64px - var(--_leading-space) - var(--_trailing-space));width:100%;z-index:0;height:100%;font:inherit;color:var(--_label-text-color);padding:0;gap:inherit;text-transform:inherit}.button::-moz-focus-inner{padding:0;border:0}:host(:hover) .button{color:var(--_hover-label-text-color)}:host(:focus-within) .button{color:var(--_focus-label-text-color)}:host(:active) .button{color:var(--_pressed-label-text-color)}.background{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute}.label{overflow:hidden}:is(.button,.label,.label slot),.label ::slotted(*){text-overflow:inherit}:host(:is([disabled],[soft-disabled])) .label{color:var(--_disabled-label-text-color);opacity:var(--_disabled-label-text-opacity)}:host(:is([disabled],[soft-disabled])) .background{background:var(--_disabled-container-color);opacity:var(--_disabled-container-opacity)}@media(forced-colors: active){.background{border:1px solid CanvasText}:host(:is([disabled],[soft-disabled])){--_disabled-icon-color: GrayText;--_disabled-icon-opacity: 1;--_disabled-container-opacity: 1;--_disabled-label-text-color: GrayText;--_disabled-label-text-opacity: 1}}:host([has-icon]:not([trailing-icon])){padding-inline-start:var(--_with-leading-icon-leading-space);padding-inline-end:var(--_with-leading-icon-trailing-space)}:host([has-icon][trailing-icon]){padding-inline-start:var(--_with-trailing-icon-leading-space);padding-inline-end:var(--_with-trailing-icon-trailing-space)}::slotted([slot=icon]){display:inline-flex;position:relative;writing-mode:horizontal-tb;fill:currentColor;flex-shrink:0;color:var(--_icon-color);font-size:var(--_icon-size);inline-size:var(--_icon-size);block-size:var(--_icon-size)}:host(:hover) ::slotted([slot=icon]){color:var(--_hover-icon-color)}:host(:focus-within) ::slotted([slot=icon]){color:var(--_focus-icon-color)}:host(:active) ::slotted([slot=icon]){color:var(--_pressed-icon-color)}:host(:is([disabled],[soft-disabled])) ::slotted([slot=icon]){color:var(--_disabled-icon-color);opacity:var(--_disabled-icon-opacity)}.touch{position:absolute;top:50%;height:48px;left:0;right:0;transform:translateY(-50%)}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_container-height))/2) 0}:host([touch-target=none]) .touch{display:none}\n`;\nexport default styles.styleSheet!;\n"]}
|
|
1
|
+
{"version":3,"file":"shared-styles.cssresult.js","sourceRoot":"","sources":["shared-styles.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gEAAgE;AAChE,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC;AACF,eAAe,MAAM,CAAC,UAAW,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./button/internal/shared-styles.css.\nimport {css} from 'lit';\nexport const styles = css`:host{border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end);box-sizing:border-box;cursor:pointer;display:inline-flex;gap:8px;min-height:var(--_container-height);outline:none;padding-block:calc((var(--_container-height) - max(var(--_label-text-line-height),var(--_icon-size)))/2);padding-inline-start:var(--_leading-space);padding-inline-end:var(--_trailing-space);place-content:center;place-items:center;position:relative;font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight);text-overflow:ellipsis;text-wrap:nowrap;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);vertical-align:top;--md-ripple-hover-color: var(--_hover-state-layer-color);--md-ripple-pressed-color: var(--_pressed-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}md-focus-ring{--md-focus-ring-shape-start-start: var(--_container-shape-start-start);--md-focus-ring-shape-start-end: var(--_container-shape-start-end);--md-focus-ring-shape-end-end: var(--_container-shape-end-end);--md-focus-ring-shape-end-start: var(--_container-shape-end-start)}:host(:is([disabled],[soft-disabled])){cursor:default;pointer-events:none}.button{border-radius:inherit;cursor:inherit;display:inline-flex;align-items:center;justify-content:center;border:none;outline:none;-webkit-appearance:none;vertical-align:middle;background:rgba(0,0,0,0);text-decoration:none;min-width:calc(64px - var(--_leading-space) - var(--_trailing-space));width:100%;z-index:0;height:100%;font:inherit;color:var(--_label-text-color);padding:0;gap:inherit;text-transform:inherit}.button::-moz-focus-inner{padding:0;border:0}:host(:hover) .button{color:var(--_hover-label-text-color)}:host(:focus-within) .button{color:var(--_focus-label-text-color)}:host(:active) .button{color:var(--_pressed-label-text-color)}.background{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute}.label{overflow:hidden}:is(.button,.label,.label slot),.label ::slotted(*){text-overflow:inherit}:host(:is([disabled],[soft-disabled])) .label{color:var(--_disabled-label-text-color);opacity:var(--_disabled-label-text-opacity)}:host(:is([disabled],[soft-disabled])) .background{background:var(--_disabled-container-color);opacity:var(--_disabled-container-opacity)}@media(forced-colors: active){.background{border:1px solid CanvasText}:host(:is([disabled],[soft-disabled])){--_disabled-icon-color: GrayText;--_disabled-icon-opacity: 1;--_disabled-container-opacity: 1;--_disabled-label-text-color: GrayText;--_disabled-label-text-opacity: 1}}:host([has-icon]:not([trailing-icon])){padding-inline-start:var(--_with-leading-icon-leading-space);padding-inline-end:var(--_with-leading-icon-trailing-space)}:host([has-icon][trailing-icon]){padding-inline-start:var(--_with-trailing-icon-leading-space);padding-inline-end:var(--_with-trailing-icon-trailing-space)}::slotted([slot=icon]){display:inline-flex;position:relative;writing-mode:horizontal-tb;fill:currentColor;flex-shrink:0;color:var(--_icon-color);font-size:var(--_icon-size);inline-size:var(--_icon-size);block-size:var(--_icon-size)}:host(:hover) ::slotted([slot=icon]){color:var(--_hover-icon-color)}:host(:focus-within) ::slotted([slot=icon]){color:var(--_focus-icon-color)}:host(:active) ::slotted([slot=icon]){color:var(--_pressed-icon-color)}:host(:is([disabled],[soft-disabled])) ::slotted([slot=icon]){color:var(--_disabled-icon-color);opacity:var(--_disabled-icon-opacity)}.touch{position:absolute;top:50%;height:max(48px,100%);left:0;right:0;transform:translateY(-50%)}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_container-height))/2) 0}:host([touch-target=none]) .touch{display:none}\n`;\nexport default styles.styleSheet!;\n"]}
|
|
@@ -10,7 +10,7 @@ declare global {
|
|
|
10
10
|
'md-list-item': ListItem;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
declare const baseClass: import("@material/web/labs/behaviors/mixin.js").MixinReturn<import("@material/web/labs/behaviors/mixin.js").MixinReturn<typeof LitElement, import("
|
|
13
|
+
declare const baseClass: import("@material/web/labs/behaviors/mixin.js").MixinReturn<import("@material/web/labs/behaviors/mixin.js").MixinReturn<typeof LitElement, import("../../../behaviors/element-internals.js").WithElementInternals>>;
|
|
14
14
|
/**
|
|
15
15
|
* A Material Design list item component.
|
|
16
16
|
*/
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { __decorate } from "tslib";
|
|
7
|
-
import { mixinDelegatesAria } from '@material/web/internal/aria/delegate.js';
|
|
8
|
-
import { internals, mixinElementInternals, } from '@material/web/labs/behaviors/element-internals.js';
|
|
9
|
-
import { hasSlotted } from '@material/web/labs/gb/components/shared/has-slotted.js';
|
|
10
7
|
import { css, html, LitElement, nothing } from 'lit';
|
|
11
8
|
import { customElement, property } from 'lit/decorators.js';
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
|
|
9
|
+
import { mixinDelegatesAria } from '../../../../internal/aria/delegate.js';
|
|
10
|
+
import { internals, mixinElementInternals, } from '../../../behaviors/element-internals.js';
|
|
11
|
+
import { hasSlotted } from '../shared/has-slotted.js';
|
|
12
|
+
import focusRingStyles from '../focus/focus-ring.css' with { type: 'css' }; // github-only
|
|
13
|
+
// import {styles as focusRingStyles} from '../focus/focus-ring.cssresult.js'; // google3-only
|
|
14
|
+
import rippleStyles from '../ripple/ripple.css' with { type: 'css' }; // github-only
|
|
15
|
+
// import {styles as rippleStyles} from '../ripple/ripple.cssresult.js'; // google3-only
|
|
16
16
|
import listStyles from './list.css' with { type: 'css' }; // github-only
|
|
17
17
|
// import {styles as listStyles} from './list.cssresult.js'; // google3-only
|
|
18
18
|
import { listItem } from './list.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-list-item.js","sourceRoot":"","sources":["md-list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;
|
|
1
|
+
{"version":3,"file":"md-list-item.js","sourceRoot":"","sources":["md-list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,GAAG,EAAqB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,uCAAuC,CAAC;AACzE,OAAO,EACL,SAAS,EACT,qBAAqB,GACtB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,eAAe,MAAM,yBAAyB,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACxF,8FAA8F;AAC9F,OAAO,YAAY,MAAM,sBAAsB,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AAClF,wFAAwF;AACxF,OAAO,UAAU,MAAM,YAAY,CAAC,OAAM,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,cAAc;AACtE,4EAA4E;AAE5E,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AASnC,wCAAwC;AACxC,MAA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U;IACV,GAAG,CAAA;;;;;;;;;;;;;;;KAeF;CACF,AApBqB,CAoBpB;AAUyB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;yCAAiB;AAKhB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;0CAAkB;AAM5C;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC,CAAC;gDACvC;AAhDZ,QAAQ;IADpB,aAAa,CAAC,cAAc,CAAC;GACjB,QAAQ,CA6FpB","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {css, CSSResultOrNative, html, LitElement, nothing} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {ARIAMixinStrict} from '../../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../../internal/aria/delegate.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../../behaviors/element-internals.js';\nimport {hasSlotted} from '../shared/has-slotted.js';\n\nimport focusRingStyles from '../focus/focus-ring.css' with {type: 'css'}; // github-only\n// import {styles as focusRingStyles} from '../focus/focus-ring.cssresult.js'; // google3-only\nimport rippleStyles from '../ripple/ripple.css' with {type: 'css'}; // github-only\n// import {styles as rippleStyles} from '../ripple/ripple.cssresult.js'; // google3-only\nimport listStyles from './list.css' with {type: 'css'}; // github-only\n// import {styles as listStyles} from './list.cssresult.js'; // google3-only\n\nimport {listItem} from './list.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** A Material Design list item component. */\n 'md-list-item': ListItem;\n }\n}\n\n// Separate variable needed for closure.\nconst baseClass = mixinDelegatesAria(mixinElementInternals(LitElement));\n\n/**\n * A Material Design list item component.\n */\n@customElement('md-list-item')\nexport class ListItem extends baseClass {\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n static override styles: CSSResultOrNative[] = [\n focusRingStyles,\n rippleStyles,\n listStyles,\n css`\n :host {\n display: flex;\n align-items: center;\n }\n .list-item {\n flex: 1;\n align-items: inherit;\n }\n :is(.list-item-leading, .list-item-trailing):not(:has(.has-slotted)) {\n display: none;\n }\n slot:not(.has-slotted) {\n display: contents;\n }\n `,\n ];\n\n constructor() {\n super();\n this[internals].role = 'listitem';\n }\n\n /**\n * Whether the list item is selected.\n */\n @property({type: Boolean}) checked = false;\n\n /**\n * Whether the list item is disabled.\n */\n @property({type: Boolean}) disabled = false;\n\n /**\n * Whether the list item is non-interactive.\n */\n @property({type: Boolean, reflect: true, attribute: 'static'})\n nonInteractive = false;\n\n protected override render() {\n const state = {\n checked: this.checked,\n disabled: this.disabled,\n static: this.nonInteractive,\n };\n if (this.nonInteractive) {\n return html`<div part=\"list-item\" class=\"${listItem(state)}\"\n >${this.renderContent()}</div\n >`;\n }\n\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`<button\n part=\"list-item\"\n class=\"${listItem(state)}\"\n ?disabled=${this.disabled}\n aria-label=${ariaLabel || nothing}>\n ${this.renderContent()}\n </button>`;\n }\n\n private renderContent() {\n return html`\n <span class=\"list-item-leading\">\n <slot name=\"avatar\" class=\"list-item-avatar\" ${hasSlotted()}></slot>\n <slot name=\"leading\" ${hasSlotted()}></slot>\n </span>\n <span class=\"list-item-content\">\n <slot name=\"overline\" class=\"list-item-overline\"></slot>\n <slot></slot>\n <slot name=\"supporting-text\" class=\"list-item-supporting-text\"></slot>\n </span>\n <span class=\"list-item-trailing\">\n <slot\n name=\"trailing-text\"\n class=\"list-item-trailing-text\"\n ${hasSlotted()}></slot>\n <slot name=\"trailing\" ${hasSlotted()}></slot>\n </span>\n `;\n }\n}\n"]}
|
|
@@ -44,4 +44,4 @@ export declare function splitButtonClasses({ selected, }?: SplitButtonClassesSta
|
|
|
44
44
|
* `;
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
|
-
export declare const splitButton: (state?: SplitButtonClassesState & import("
|
|
47
|
+
export declare const splitButton: (state?: SplitButtonClassesState & import("../shared/directives.js").AdditionalClasses) => import("lit-html/directive.js").DirectiveResult;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { createClassMapDirective } from '
|
|
6
|
+
import { createClassMapDirective } from '../shared/directives.js';
|
|
7
7
|
/** Split Button classes. */
|
|
8
8
|
export const SPLIT_BUTTON_CLASSES = {
|
|
9
9
|
splitButton: 'split-btn',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.js","sourceRoot":"","sources":["split-button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,uBAAuB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"split-button.js","sourceRoot":"","sources":["split-button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAShE,4BAA4B;AAC5B,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,WAAW;IACxB,mBAAmB,EAAE,oBAAoB;CACjC,CAAC;AAQX;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,QAAQ,GAAG,KAAK,MACW,EAAE;IAC7B,OAAO;QACL,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,IAAI;QACxC,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,EAAE,QAAQ;KACrD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;IACjD,UAAU,EAAE,kBAAkB;CAC/B,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {createClassMapDirective} from '../shared/directives.js';\nimport {type ClassInfo} from 'lit/directives/class-map.js';\n\n/** Split Button color configuration types. */\nexport type SplitButtonColor = 'filled' | 'elevated' | 'tonal' | 'outlined';\n\n/** Split Button size configuration types. */\nexport type SplitButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/** Split Button classes. */\nexport const SPLIT_BUTTON_CLASSES = {\n splitButton: 'split-btn',\n splitButtonSelected: 'split-btn-selected',\n} as const;\n\n/** The state provided to the `splitButtonClasses()` function. */\nexport interface SplitButtonClassesState {\n /** Whether the split trailing button is selected. */\n selected?: boolean;\n}\n\n/**\n * Returns the split button classes to apply to an element based on the given\n * state.\n *\n * @param state The state of the split button.\n * @return An object of class names and truthy values if they apply.\n */\nexport function splitButtonClasses({\n selected = false,\n}: SplitButtonClassesState = {}): ClassInfo {\n return {\n [SPLIT_BUTTON_CLASSES.splitButton]: true,\n [SPLIT_BUTTON_CLASSES.splitButtonSelected]: selected,\n };\n}\n\n/**\n * A Lit directive that adds split button styling and functionality to its\n * element.\n *\n * @example\n * ```ts\n * html`\n * <div class=\"${splitButton()}\">\n * <button class=\"${button({color: 'filled'})}\">Label</button>\n * <button class=\"${button({color: 'filled'})}\" popovertarget=\"menu\"></button>\n * <md-menu id=\"menu\">\n * <md-menu-item>Option 1</md-menu-item>\n * <md-menu-item>Option 2</md-menu-item>\n * </md-menu>\n * </div>\n * `;\n * ```\n */\nexport const splitButton = createClassMapDirective({\n getClasses: splitButtonClasses,\n});\n"]}
|
|
@@ -16,7 +16,10 @@ export type ListItemType = 'text' | 'button' | 'link';
|
|
|
16
16
|
declare const listItemBaseClass: import("../../../labs/behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
17
17
|
/**
|
|
18
18
|
* @fires request-activation {Event} Requests the list to set `tabindex=0` on
|
|
19
|
-
* the item and focus it.
|
|
19
|
+
* the item and focus it. Used internally for list keyboard navigation; most
|
|
20
|
+
* applications do not need to listen for this event. It is exposed for
|
|
21
|
+
* authors building their own list-item replacements or wrapping items in a
|
|
22
|
+
* custom controller. --bubbles --composed
|
|
20
23
|
*/
|
|
21
24
|
export declare class ListItemEl extends listItemBaseClass implements ListItem {
|
|
22
25
|
/** @nocollapse */
|
|
@@ -17,7 +17,10 @@ import { createRequestActivationEvent, } from '../list-navigation-helpers.js';
|
|
|
17
17
|
const listItemBaseClass = mixinDelegatesAria(LitElement);
|
|
18
18
|
/**
|
|
19
19
|
* @fires request-activation {Event} Requests the list to set `tabindex=0` on
|
|
20
|
-
* the item and focus it.
|
|
20
|
+
* the item and focus it. Used internally for list keyboard navigation; most
|
|
21
|
+
* applications do not need to listen for this event. It is exposed for
|
|
22
|
+
* authors building their own list-item replacements or wrapping items in a
|
|
23
|
+
* custom controller. --bubbles --composed
|
|
21
24
|
*/
|
|
22
25
|
export class ListItemEl extends listItemBaseClass {
|
|
23
26
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACL,4BAA4B,GAE7B,MAAM,+BAA+B,CAAC;AAOvC,wCAAwC;AACxC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ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AAC;IAES,OAAO;QACf,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QACD,uEAAuE;QACvE,IAAI,CAAC,aAAa,CAAC,4BAA4B,EAAE,CAAC,CAAC;IACrD,CAAC;IAEQ,KAAK;QACZ,wEAAwE;QACxE,qDAAqD;QACrD,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAEQ,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,wEAAwE;YACxE,yBAAyB;YACzB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,2EAA2E;QAC3E,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;;AArLD,kBAAkB;AACF,4BAAiB,GAAG;IAClC,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAKwC;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAMhC;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;wCAA6B;AAMvD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAKN;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAA2D;AAE9B;IAAvC,KAAK,CAAC,YAAY,CAAC;gDAAsD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {literal, html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\nimport {\n createRequestActivationEvent,\n ListItem,\n} from '../list-navigation-helpers.js';\n\n/**\n * Supported behaviors for a list item.\n */\nexport type ListItemType = 'text' | 'button' | 'link';\n\n// Separate variable needed for closure.\nconst listItemBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * @fires request-activation {Event} Requests the list to set `tabindex=0` on\n * the item and focus it. --bubbles --composed\n */\nexport class ListItemEl extends listItemBaseClass implements ListItem {\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior of the list item, defaults to \"text\". Change to \"link\" or\n * \"button\" for interactive items.\n */\n @property({reflect: true}) type: ListItemType = 'text';\n\n /**\n * READONLY. Sets the `md-list-item` attribute on the element.\n */\n @property({type: Boolean, attribute: 'md-list-item', reflect: true})\n isListItem = true;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement | null;\n\n private get isDisabled() {\n return this.disabled && this.type !== 'link';\n }\n\n protected override willUpdate(changed: PropertyValues<ListItemEl>) {\n if (this.href) {\n this.type = 'link';\n }\n\n super.willUpdate(changed);\n }\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()} ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.type) {\n case 'link':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'text':\n tag = literal`li`;\n break;\n }\n\n const isInteractive = this.type !== 'text';\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"listitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=\"${this.isDisabled || !isInteractive ? -1 : 0}\"\n ?disabled=${this.isDisabled}\n role=\"listitem\"\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @focus=${this.onFocus}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.isDisabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-focus-ring\n @visibility-changed=${this.onFocusRingVisibilityChanged}\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n protected onFocusRingVisibilityChanged(e: Event) {}\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {'disabled': this.isDisabled};\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot\n name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n protected onFocus() {\n if (this.tabIndex !== -1) {\n return;\n }\n // Handles the case where the user clicks on the element and then tabs.\n this.dispatchEvent(createRequestActivationEvent());\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n\n override click() {\n if (!this.listItemRoot) {\n // If the element has not finished rendering, call super to ensure click\n // events are dispatched.\n super.click();\n return;\n }\n\n // Forward click to the element to ensure link <a>.click() works correctly.\n this.listItemRoot.click();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACL,4BAA4B,GAE7B,MAAM,+BAA+B,CAAC;AAOvC,wCAAwC;AACxC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAAjD;;QAOE;;WAEG;QACuC,aAAQ,GAAG,KAAK,CAAC;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EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QACD,uEAAuE;QACvE,IAAI,CAAC,aAAa,CAAC,4BAA4B,EAAE,CAAC,CAAC;IACrD,CAAC;IAEQ,KAAK;QACZ,wEAAwE;QACxE,qDAAqD;QACrD,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAEQ,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,wEAAwE;YACxE,yBAAyB;YACzB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,2EAA2E;QAC3E,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;;AArLD,kBAAkB;AACF,4BAAiB,GAAG;IAClC,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAKwC;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAMhC;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;wCAA6B;AAMvD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAKN;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAA2D;AAE9B;IAAvC,KAAK,CAAC,YAAY,CAAC;gDAAsD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {literal, html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\nimport {\n createRequestActivationEvent,\n ListItem,\n} from '../list-navigation-helpers.js';\n\n/**\n * Supported behaviors for a list item.\n */\nexport type ListItemType = 'text' | 'button' | 'link';\n\n// Separate variable needed for closure.\nconst listItemBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * @fires request-activation {Event} Requests the list to set `tabindex=0` on\n * the item and focus it. Used internally for list keyboard navigation; most\n * applications do not need to listen for this event. It is exposed for\n * authors building their own list-item replacements or wrapping items in a\n * custom controller. --bubbles --composed\n */\nexport class ListItemEl extends listItemBaseClass implements ListItem {\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior of the list item, defaults to \"text\". Change to \"link\" or\n * \"button\" for interactive items.\n */\n @property({reflect: true}) type: ListItemType = 'text';\n\n /**\n * READONLY. Sets the `md-list-item` attribute on the element.\n */\n @property({type: Boolean, attribute: 'md-list-item', reflect: true})\n isListItem = true;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement | null;\n\n private get isDisabled() {\n return this.disabled && this.type !== 'link';\n }\n\n protected override willUpdate(changed: PropertyValues<ListItemEl>) {\n if (this.href) {\n this.type = 'link';\n }\n\n super.willUpdate(changed);\n }\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()} ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.type) {\n case 'link':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'text':\n tag = literal`li`;\n break;\n }\n\n const isInteractive = this.type !== 'text';\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"listitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=\"${this.isDisabled || !isInteractive ? -1 : 0}\"\n ?disabled=${this.isDisabled}\n role=\"listitem\"\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @focus=${this.onFocus}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.isDisabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-focus-ring\n @visibility-changed=${this.onFocusRingVisibilityChanged}\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n protected onFocusRingVisibilityChanged(e: Event) {}\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {'disabled': this.isDisabled};\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot\n name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n protected onFocus() {\n if (this.tabIndex !== -1) {\n return;\n }\n // Handles the case where the user clicks on the element and then tabs.\n this.dispatchEvent(createRequestActivationEvent());\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n\n override click() {\n if (!this.listItemRoot) {\n // If the element has not finished rendering, call super to ensure click\n // events are dispatched.\n super.click();\n return;\n }\n\n // Forward click to the element to ensure link <a>.click() works correctly.\n this.listItemRoot.click();\n }\n}\n"]}
|
|
@@ -11,7 +11,11 @@ import { Corner } from '../menu.js';
|
|
|
11
11
|
* @fires deactivate-items {Event} Requests the parent menu to deselect other
|
|
12
12
|
* items when a submenu opens. --bubbles --composed
|
|
13
13
|
* @fires request-activation {Event} Requests the parent to make the slotted item
|
|
14
|
-
* focusable and focus the item.
|
|
14
|
+
* focusable and focus the item. Used internally for menu keyboard navigation;
|
|
15
|
+
* most applications do not need to listen for this event. It is exposed for
|
|
16
|
+
* authors building their own menu-item replacements, or for advanced cases
|
|
17
|
+
* where you want to call `preventDefault`/`stopPropagation` on it to override
|
|
18
|
+
* default focus handling. --bubbles --composed
|
|
15
19
|
* @fires deactivate-typeahead {Event} Requests the parent menu to deactivate
|
|
16
20
|
* the typeahead functionality when a submenu opens. --bubbles --composed
|
|
17
21
|
* @fires activate-typeahead {Event} Requests the parent menu to activate the
|
|
@@ -13,7 +13,11 @@ import { Corner } from '../menu.js';
|
|
|
13
13
|
* @fires deactivate-items {Event} Requests the parent menu to deselect other
|
|
14
14
|
* items when a submenu opens. --bubbles --composed
|
|
15
15
|
* @fires request-activation {Event} Requests the parent to make the slotted item
|
|
16
|
-
* focusable and focus the item.
|
|
16
|
+
* focusable and focus the item. Used internally for menu keyboard navigation;
|
|
17
|
+
* most applications do not need to listen for this event. It is exposed for
|
|
18
|
+
* authors building their own menu-item replacements, or for advanced cases
|
|
19
|
+
* where you want to call `preventDefault`/`stopPropagation` on it to override
|
|
20
|
+
* default focus handling. --bubbles --composed
|
|
17
21
|
* @fires deactivate-typeahead {Event} Requests the parent menu to deactivate
|
|
18
22
|
* the typeahead functionality when a submenu opens. --bubbles --composed
|
|
19
23
|
* @fires activate-typeahead {Event} Requests the parent menu to activate the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sub-menu.js","sourceRoot":"","sources":["sub-menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAElE,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAEL,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,EAC9B,eAAe,EAEf,YAAY,EACZ,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAElC;;;;;;;;;GASG;AACH,MAAM,OAAO,OAAQ,SAAQ,UAAU;IA0BrC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC/B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC/B,CAAC;IAWD;QACE,KAAK,EAAE,CAAC;QA3CV;;WAEG;QAEH,iBAAY,GAAW,MAAM,CAAC,SAAS,CAAC;QACxC;;WAEG;QACmC,eAAU,GAAW,M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CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;2CAAyC;AAIrB;IAAxD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAC,CAAC;+CAAsB;AAK9E;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAC,CAAC;gDACnC;AAMtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAC,CAAC;0CAClD;AAWA;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCACjB;AAGnB;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCACrB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, isServer, LitElement} from 'lit';\nimport {property, queryAssignedElements} from 'lit/decorators.js';\n\nimport {\n createDeactivateItemsEvent,\n createRequestActivationEvent,\n deactivateActiveItem,\n getFirstActivatableItem,\n} from '../../../list/internal/list-navigation-helpers.js';\nimport {MenuItem} from '../controllers/menuItemController.js';\nimport {\n CloseMenuEvent,\n CloseReason,\n createActivateTypeaheadEvent,\n createDeactivateTypeaheadEvent,\n KeydownCloseKey,\n Menu,\n NavigableKey,\n SelectionKey,\n} from '../controllers/shared.js';\nimport {Corner} from '../menu.js';\n\n/**\n * @fires deactivate-items {Event} Requests the parent menu to deselect other\n * items when a submenu opens. --bubbles --composed\n * @fires request-activation {Event} Requests the parent to make the slotted item\n * focusable and focus the item. --bubbles --composed\n * @fires deactivate-typeahead {Event} Requests the parent menu to deactivate\n * the typeahead functionality when a submenu opens. --bubbles --composed\n * @fires activate-typeahead {Event} Requests the parent menu to activate the\n * typeahead functionality when a submenu closes. --bubbles --composed\n */\nexport class SubMenu extends LitElement {\n /**\n * The anchorCorner to set on the submenu.\n */\n @property({attribute: 'anchor-corner'})\n anchorCorner: Corner = Corner.START_END;\n /**\n * The menuCorner to set on the submenu.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = Corner.START_START;\n /**\n * The delay between mouseenter and submenu opening.\n */\n @property({type: Number, attribute: 'hover-open-delay'}) hoverOpenDelay = 400;\n /**\n * The delay between ponterleave and the submenu closing.\n */\n @property({type: Number, attribute: 'hover-close-delay'})\n hoverCloseDelay = 400;\n\n /**\n * READONLY: self-identifies as a menu item and sets its identifying attribute\n */\n @property({type: Boolean, reflect: true, attribute: 'md-sub-menu'})\n isSubMenu = true;\n\n get item() {\n return this.items[0] ?? null;\n }\n\n get menu() {\n return this.menus[0] ?? null;\n }\n\n @queryAssignedElements({slot: 'item', flatten: true})\n private readonly items!: MenuItem[];\n\n @queryAssignedElements({slot: 'menu', flatten: true})\n private readonly menus!: Menu[];\n\n private previousOpenTimeout = 0;\n private previousCloseTimeout = 0;\n\n constructor() {\n super();\n\n if (!isServer) {\n this.addEventListener('mouseenter', this.onMouseenter);\n this.addEventListener('mouseleave', this.onMouseleave);\n }\n }\n\n override render() {\n return html`\n <slot\n name=\"item\"\n @click=${this.onClick}\n @keydown=${this.onKeydown}\n @slotchange=${this.onSlotchange}>\n </slot>\n <slot\n name=\"menu\"\n @keydown=${this.onSubMenuKeydown}\n @close-menu=${this.onCloseSubmenu}\n @slotchange=${this.onSlotchange}>\n </slot>\n `;\n }\n\n protected override firstUpdated() {\n // slotchange is not fired if the contents have been SSRd\n this.onSlotchange();\n }\n\n /**\n * Shows the submenu.\n */\n async show() {\n const menu = this.menu;\n if (!menu || menu.open) return;\n\n // Ensures that we deselect items when the menu closes and reactivate\n // typeahead when the menu closes, so that we do not have dirty state of\n // `sub-menu > menu-item[selected]` when we reopen.\n //\n // This cannot happen in `close()` because the menu may close via other\n // means Additionally, this cannot happen in onCloseSubmenu because\n // `close-menu` may not be called via focusout of outside click and not\n // triggered by an item\n menu.addEventListener(\n 'closed',\n () => {\n this.item.ariaExpanded = 'false';\n this.dispatchEvent(createActivateTypeaheadEvent());\n this.dispatchEvent(createDeactivateItemsEvent());\n // aria-hidden required so ChromeVox doesn't announce the closed menu\n menu.ariaHidden = 'true';\n },\n {once: true},\n );\n\n // Parent menu is `position: absolute` – this creates a new CSS relative\n // positioning context (similar to doing `position: relative`), so the\n // submenu's `<md-menu slot=\"submenu\" positioning=\"document\">` would be\n // wrong even if we change `md-sub-menu` from `position: relative` to\n // `position: static` because the submenu it would still be positioning\n // itself relative to the parent menu.\n if (menu.positioning === 'document') {\n menu.positioning = 'absolute';\n }\n menu.quick = true;\n // Submenus are in overflow when not fixed. Can remove once we have native\n // popup support\n menu.hasOverflow = true;\n menu.anchorCorner = this.anchorCorner;\n menu.menuCorner = this.menuCorner;\n menu.anchorElement = this.item;\n menu.defaultFocus = 'first-item';\n // aria-hidden management required so ChromeVox doesn't announce the closed\n // menu. Remove it here since we are about to show and focus it.\n menu.removeAttribute('aria-hidden');\n // This is required in the case where we have a leaf menu open and and the\n // user hovers a parent menu's item which is not an md-sub-menu item.\n // If this were set to true, then the menu would close and focus would be\n // lost. That means the focusout event would have a `relatedTarget` of\n // `null` since nothing in the menu would be focused anymore due to the\n // leaf menu closing. restoring focus ensures that we keep focus in the\n // submenu tree.\n menu.skipRestoreFocus = false;\n\n // Menu could already be opened because of mouse interaction\n const menuAlreadyOpen = menu.open;\n menu.show();\n this.item.ariaExpanded = 'true';\n this.item.ariaHasPopup = 'menu';\n if (menu.id) {\n this.item.setAttribute('aria-controls', menu.id);\n }\n\n // Deactivate other items. This can be the case if the user has tabbed\n // around the menu and then mouses over an md-sub-menu.\n this.dispatchEvent(createDeactivateItemsEvent());\n this.dispatchEvent(createDeactivateTypeaheadEvent());\n this.item.selected = true;\n\n // This is the case of mouse hovering when already opened via keyboard or\n // vice versa\n if (!menuAlreadyOpen) {\n let open = (value: unknown) => {};\n const opened = new Promise((resolve) => {\n open = resolve;\n });\n menu.addEventListener('opened', open, {once: true});\n await opened;\n }\n }\n\n /**\n * Closes the submenu.\n */\n async close() {\n const menu = this.menu;\n if (!menu || !menu.open) return;\n\n this.dispatchEvent(createActivateTypeaheadEvent());\n menu.quick = true;\n menu.close();\n this.dispatchEvent(createDeactivateItemsEvent());\n let close = (value: unknown) => {};\n const closed = new Promise((resolve) => {\n close = resolve;\n });\n menu.addEventListener('closed', close, {once: true});\n await closed;\n }\n\n protected onSlotchange() {\n if (!this.item) {\n return;\n }\n\n // TODO(b/301296618): clean up old aria values on change\n this.item.ariaExpanded = 'false';\n this.item.ariaHasPopup = 'menu';\n if (this.menu?.id) {\n this.item.setAttribute('aria-controls', this.menu.id);\n }\n this.item.keepOpen = true;\n\n const menu = this.menu;\n if (!menu) return;\n\n menu.isSubmenu = true;\n // Required for ChromeVox to not linearly navigate to the menu while closed\n menu.ariaHidden = 'true';\n }\n\n /**\n * Starts the default 400ms countdown to open the submenu.\n *\n * NOTE: We explicitly use mouse events and not pointer events because\n * pointer events apply to touch events. And if a user were to tap a\n * sub-menu, it would fire the \"pointerenter\", \"pointerleave\", \"click\" events\n * which would open the menu on click, and then set the timeout to close the\n * menu due to pointerleave.\n */\n protected onMouseenter = () => {\n clearTimeout(this.previousOpenTimeout);\n clearTimeout(this.previousCloseTimeout);\n if (this.menu?.open) return;\n\n // Open synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverOpenDelay) {\n this.show();\n } else {\n this.previousOpenTimeout = setTimeout(() => {\n this.show();\n }, this.hoverOpenDelay);\n }\n };\n\n /**\n * Starts the default 400ms countdown to close the submenu.\n *\n * NOTE: We explicitly use mouse events and not pointer events because\n * pointer events apply to touch events. And if a user were to tap a\n * sub-menu, it would fire the \"pointerenter\", \"pointerleave\", \"click\" events\n * which would open the menu on click, and then set the timeout to close the\n * menu due to pointerleave.\n */\n protected onMouseleave = () => {\n clearTimeout(this.previousCloseTimeout);\n clearTimeout(this.previousOpenTimeout);\n\n // Close synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverCloseDelay) {\n this.close();\n } else {\n this.previousCloseTimeout = setTimeout(() => {\n this.close();\n }, this.hoverCloseDelay);\n }\n };\n\n protected onClick() {\n this.show();\n }\n\n /**\n * On item keydown handles opening the submenu.\n */\n protected async onKeydown(event: KeyboardEvent) {\n const shouldOpenSubmenu = this.isSubmenuOpenKey(event.code);\n\n if (event.defaultPrevented) return;\n\n const openedWithLR =\n shouldOpenSubmenu &&\n (NavigableKey.LEFT === event.code || NavigableKey.RIGHT === event.code);\n\n if (event.code === SelectionKey.SPACE || openedWithLR) {\n // prevent space from scrolling and Left + Right from selecting previous /\n // next items or opening / closing parent menus. Only open the submenu.\n event.preventDefault();\n\n if (openedWithLR) {\n event.stopPropagation();\n }\n }\n\n if (!shouldOpenSubmenu) {\n return;\n }\n\n const submenu = this.menu;\n if (!submenu) return;\n\n const submenuItems = submenu.items;\n const firstActivatableItem = getFirstActivatableItem(submenuItems);\n\n if (firstActivatableItem) {\n await this.show();\n\n firstActivatableItem.tabIndex = 0;\n firstActivatableItem.focus();\n\n return;\n }\n }\n\n private onCloseSubmenu(event: CloseMenuEvent) {\n const {itemPath, reason} = event.detail;\n itemPath.push(this.item);\n\n this.dispatchEvent(createActivateTypeaheadEvent());\n // Escape should only close one menu not all of the menus unlike space or\n // click selection which should close all menus.\n if (\n reason.kind === CloseReason.KEYDOWN &&\n reason.key === KeydownCloseKey.ESCAPE\n ) {\n event.stopPropagation();\n this.item.dispatchEvent(createRequestActivationEvent());\n return;\n }\n\n this.dispatchEvent(createDeactivateItemsEvent());\n }\n\n private async onSubMenuKeydown(event: KeyboardEvent) {\n if (event.defaultPrevented) return;\n const {close: shouldClose, keyCode} = this.isSubmenuCloseKey(event.code);\n if (!shouldClose) return;\n\n // Communicate that it's handled so that we don't accidentally close every\n // parent menu. Additionally, we want to isolate things like the typeahead\n // keydowns from bubbling up to the parent menu and confounding things.\n event.preventDefault();\n\n if (keyCode === NavigableKey.LEFT || keyCode === NavigableKey.RIGHT) {\n // Prevent this from bubbling to parents\n event.stopPropagation();\n }\n\n await this.close();\n\n deactivateActiveItem(this.menu.items);\n this.item?.focus();\n this.item.tabIndex = 0;\n this.item.focus();\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should open\n * the submenu. This is RTL-aware. By default, left, right, space, or enter.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should open the submenu.\n */\n private isSubmenuOpenKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NavigableKey.LEFT : NavigableKey.RIGHT;\n switch (code) {\n case arrowEnterKey:\n case SelectionKey.SPACE:\n case SelectionKey.ENTER:\n return true;\n default:\n return false;\n }\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should close\n * the submenu. This is RTL-aware. By default right, left, or escape.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should close the submenu.\n */\n private isSubmenuCloseKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NavigableKey.RIGHT : NavigableKey.LEFT;\n switch (code) {\n case arrowEnterKey:\n case KeydownCloseKey.ESCAPE:\n return {close: true, keyCode: code} as const;\n default:\n return {close: false} as const;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sub-menu.js","sourceRoot":"","sources":["sub-menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAElE,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAEL,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,EAC9B,eAAe,EAEf,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C,CAAC,SAAS,KAAK,KAAK,CAAC;QACzD,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;QACrE,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,aAAa,CAAC;YACnB,KAAK,eAAe,CAAC,MAAM;gBACzB,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAU,CAAC;YAC/C;gBACE,OAAO,EAAC,KAAK,EAAE,KAAK,EAAU,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AA/WC;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;6CACC;AAIF;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;2CAAyC;AAIrB;IAAxD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAC,CAAC;+CAAsB;AAK9E;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAC,CAAC;gDACnC;AAMtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAC,CAAC;0CAClD;AAWA;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCACjB;AAGnB;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCACrB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, isServer, LitElement} from 'lit';\nimport {property, queryAssignedElements} from 'lit/decorators.js';\n\nimport {\n createDeactivateItemsEvent,\n createRequestActivationEvent,\n deactivateActiveItem,\n getFirstActivatableItem,\n} from '../../../list/internal/list-navigation-helpers.js';\nimport {MenuItem} from '../controllers/menuItemController.js';\nimport {\n CloseMenuEvent,\n CloseReason,\n createActivateTypeaheadEvent,\n createDeactivateTypeaheadEvent,\n KeydownCloseKey,\n Menu,\n NavigableKey,\n SelectionKey,\n} from '../controllers/shared.js';\nimport {Corner} from '../menu.js';\n\n/**\n * @fires deactivate-items {Event} Requests the parent menu to deselect other\n * items when a submenu opens. --bubbles --composed\n * @fires request-activation {Event} Requests the parent to make the slotted item\n * focusable and focus the item. Used internally for menu keyboard navigation;\n * most applications do not need to listen for this event. It is exposed for\n * authors building their own menu-item replacements, or for advanced cases\n * where you want to call `preventDefault`/`stopPropagation` on it to override\n * default focus handling. --bubbles --composed\n * @fires deactivate-typeahead {Event} Requests the parent menu to deactivate\n * the typeahead functionality when a submenu opens. --bubbles --composed\n * @fires activate-typeahead {Event} Requests the parent menu to activate the\n * typeahead functionality when a submenu closes. --bubbles --composed\n */\nexport class SubMenu extends LitElement {\n /**\n * The anchorCorner to set on the submenu.\n */\n @property({attribute: 'anchor-corner'})\n anchorCorner: Corner = Corner.START_END;\n /**\n * The menuCorner to set on the submenu.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = Corner.START_START;\n /**\n * The delay between mouseenter and submenu opening.\n */\n @property({type: Number, attribute: 'hover-open-delay'}) hoverOpenDelay = 400;\n /**\n * The delay between ponterleave and the submenu closing.\n */\n @property({type: Number, attribute: 'hover-close-delay'})\n hoverCloseDelay = 400;\n\n /**\n * READONLY: self-identifies as a menu item and sets its identifying attribute\n */\n @property({type: Boolean, reflect: true, attribute: 'md-sub-menu'})\n isSubMenu = true;\n\n get item() {\n return this.items[0] ?? null;\n }\n\n get menu() {\n return this.menus[0] ?? null;\n }\n\n @queryAssignedElements({slot: 'item', flatten: true})\n private readonly items!: MenuItem[];\n\n @queryAssignedElements({slot: 'menu', flatten: true})\n private readonly menus!: Menu[];\n\n private previousOpenTimeout = 0;\n private previousCloseTimeout = 0;\n\n constructor() {\n super();\n\n if (!isServer) {\n this.addEventListener('mouseenter', this.onMouseenter);\n this.addEventListener('mouseleave', this.onMouseleave);\n }\n }\n\n override render() {\n return html`\n <slot\n name=\"item\"\n @click=${this.onClick}\n @keydown=${this.onKeydown}\n @slotchange=${this.onSlotchange}>\n </slot>\n <slot\n name=\"menu\"\n @keydown=${this.onSubMenuKeydown}\n @close-menu=${this.onCloseSubmenu}\n @slotchange=${this.onSlotchange}>\n </slot>\n `;\n }\n\n protected override firstUpdated() {\n // slotchange is not fired if the contents have been SSRd\n this.onSlotchange();\n }\n\n /**\n * Shows the submenu.\n */\n async show() {\n const menu = this.menu;\n if (!menu || menu.open) return;\n\n // Ensures that we deselect items when the menu closes and reactivate\n // typeahead when the menu closes, so that we do not have dirty state of\n // `sub-menu > menu-item[selected]` when we reopen.\n //\n // This cannot happen in `close()` because the menu may close via other\n // means Additionally, this cannot happen in onCloseSubmenu because\n // `close-menu` may not be called via focusout of outside click and not\n // triggered by an item\n menu.addEventListener(\n 'closed',\n () => {\n this.item.ariaExpanded = 'false';\n this.dispatchEvent(createActivateTypeaheadEvent());\n this.dispatchEvent(createDeactivateItemsEvent());\n // aria-hidden required so ChromeVox doesn't announce the closed menu\n menu.ariaHidden = 'true';\n },\n {once: true},\n );\n\n // Parent menu is `position: absolute` – this creates a new CSS relative\n // positioning context (similar to doing `position: relative`), so the\n // submenu's `<md-menu slot=\"submenu\" positioning=\"document\">` would be\n // wrong even if we change `md-sub-menu` from `position: relative` to\n // `position: static` because the submenu it would still be positioning\n // itself relative to the parent menu.\n if (menu.positioning === 'document') {\n menu.positioning = 'absolute';\n }\n menu.quick = true;\n // Submenus are in overflow when not fixed. Can remove once we have native\n // popup support\n menu.hasOverflow = true;\n menu.anchorCorner = this.anchorCorner;\n menu.menuCorner = this.menuCorner;\n menu.anchorElement = this.item;\n menu.defaultFocus = 'first-item';\n // aria-hidden management required so ChromeVox doesn't announce the closed\n // menu. Remove it here since we are about to show and focus it.\n menu.removeAttribute('aria-hidden');\n // This is required in the case where we have a leaf menu open and and the\n // user hovers a parent menu's item which is not an md-sub-menu item.\n // If this were set to true, then the menu would close and focus would be\n // lost. That means the focusout event would have a `relatedTarget` of\n // `null` since nothing in the menu would be focused anymore due to the\n // leaf menu closing. restoring focus ensures that we keep focus in the\n // submenu tree.\n menu.skipRestoreFocus = false;\n\n // Menu could already be opened because of mouse interaction\n const menuAlreadyOpen = menu.open;\n menu.show();\n this.item.ariaExpanded = 'true';\n this.item.ariaHasPopup = 'menu';\n if (menu.id) {\n this.item.setAttribute('aria-controls', menu.id);\n }\n\n // Deactivate other items. This can be the case if the user has tabbed\n // around the menu and then mouses over an md-sub-menu.\n this.dispatchEvent(createDeactivateItemsEvent());\n this.dispatchEvent(createDeactivateTypeaheadEvent());\n this.item.selected = true;\n\n // This is the case of mouse hovering when already opened via keyboard or\n // vice versa\n if (!menuAlreadyOpen) {\n let open = (value: unknown) => {};\n const opened = new Promise((resolve) => {\n open = resolve;\n });\n menu.addEventListener('opened', open, {once: true});\n await opened;\n }\n }\n\n /**\n * Closes the submenu.\n */\n async close() {\n const menu = this.menu;\n if (!menu || !menu.open) return;\n\n this.dispatchEvent(createActivateTypeaheadEvent());\n menu.quick = true;\n menu.close();\n this.dispatchEvent(createDeactivateItemsEvent());\n let close = (value: unknown) => {};\n const closed = new Promise((resolve) => {\n close = resolve;\n });\n menu.addEventListener('closed', close, {once: true});\n await closed;\n }\n\n protected onSlotchange() {\n if (!this.item) {\n return;\n }\n\n // TODO(b/301296618): clean up old aria values on change\n this.item.ariaExpanded = 'false';\n this.item.ariaHasPopup = 'menu';\n if (this.menu?.id) {\n this.item.setAttribute('aria-controls', this.menu.id);\n }\n this.item.keepOpen = true;\n\n const menu = this.menu;\n if (!menu) return;\n\n menu.isSubmenu = true;\n // Required for ChromeVox to not linearly navigate to the menu while closed\n menu.ariaHidden = 'true';\n }\n\n /**\n * Starts the default 400ms countdown to open the submenu.\n *\n * NOTE: We explicitly use mouse events and not pointer events because\n * pointer events apply to touch events. And if a user were to tap a\n * sub-menu, it would fire the \"pointerenter\", \"pointerleave\", \"click\" events\n * which would open the menu on click, and then set the timeout to close the\n * menu due to pointerleave.\n */\n protected onMouseenter = () => {\n clearTimeout(this.previousOpenTimeout);\n clearTimeout(this.previousCloseTimeout);\n if (this.menu?.open) return;\n\n // Open synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverOpenDelay) {\n this.show();\n } else {\n this.previousOpenTimeout = setTimeout(() => {\n this.show();\n }, this.hoverOpenDelay);\n }\n };\n\n /**\n * Starts the default 400ms countdown to close the submenu.\n *\n * NOTE: We explicitly use mouse events and not pointer events because\n * pointer events apply to touch events. And if a user were to tap a\n * sub-menu, it would fire the \"pointerenter\", \"pointerleave\", \"click\" events\n * which would open the menu on click, and then set the timeout to close the\n * menu due to pointerleave.\n */\n protected onMouseleave = () => {\n clearTimeout(this.previousCloseTimeout);\n clearTimeout(this.previousOpenTimeout);\n\n // Close synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverCloseDelay) {\n this.close();\n } else {\n this.previousCloseTimeout = setTimeout(() => {\n this.close();\n }, this.hoverCloseDelay);\n }\n };\n\n protected onClick() {\n this.show();\n }\n\n /**\n * On item keydown handles opening the submenu.\n */\n protected async onKeydown(event: KeyboardEvent) {\n const shouldOpenSubmenu = this.isSubmenuOpenKey(event.code);\n\n if (event.defaultPrevented) return;\n\n const openedWithLR =\n shouldOpenSubmenu &&\n (NavigableKey.LEFT === event.code || NavigableKey.RIGHT === event.code);\n\n if (event.code === SelectionKey.SPACE || openedWithLR) {\n // prevent space from scrolling and Left + Right from selecting previous /\n // next items or opening / closing parent menus. Only open the submenu.\n event.preventDefault();\n\n if (openedWithLR) {\n event.stopPropagation();\n }\n }\n\n if (!shouldOpenSubmenu) {\n return;\n }\n\n const submenu = this.menu;\n if (!submenu) return;\n\n const submenuItems = submenu.items;\n const firstActivatableItem = getFirstActivatableItem(submenuItems);\n\n if (firstActivatableItem) {\n await this.show();\n\n firstActivatableItem.tabIndex = 0;\n firstActivatableItem.focus();\n\n return;\n }\n }\n\n private onCloseSubmenu(event: CloseMenuEvent) {\n const {itemPath, reason} = event.detail;\n itemPath.push(this.item);\n\n this.dispatchEvent(createActivateTypeaheadEvent());\n // Escape should only close one menu not all of the menus unlike space or\n // click selection which should close all menus.\n if (\n reason.kind === CloseReason.KEYDOWN &&\n reason.key === KeydownCloseKey.ESCAPE\n ) {\n event.stopPropagation();\n this.item.dispatchEvent(createRequestActivationEvent());\n return;\n }\n\n this.dispatchEvent(createDeactivateItemsEvent());\n }\n\n private async onSubMenuKeydown(event: KeyboardEvent) {\n if (event.defaultPrevented) return;\n const {close: shouldClose, keyCode} = this.isSubmenuCloseKey(event.code);\n if (!shouldClose) return;\n\n // Communicate that it's handled so that we don't accidentally close every\n // parent menu. Additionally, we want to isolate things like the typeahead\n // keydowns from bubbling up to the parent menu and confounding things.\n event.preventDefault();\n\n if (keyCode === NavigableKey.LEFT || keyCode === NavigableKey.RIGHT) {\n // Prevent this from bubbling to parents\n event.stopPropagation();\n }\n\n await this.close();\n\n deactivateActiveItem(this.menu.items);\n this.item?.focus();\n this.item.tabIndex = 0;\n this.item.focus();\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should open\n * the submenu. This is RTL-aware. By default, left, right, space, or enter.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should open the submenu.\n */\n private isSubmenuOpenKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NavigableKey.LEFT : NavigableKey.RIGHT;\n switch (code) {\n case arrowEnterKey:\n case SelectionKey.SPACE:\n case SelectionKey.ENTER:\n return true;\n default:\n return false;\n }\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should close\n * the submenu. This is RTL-aware. By default right, left, or escape.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should close the submenu.\n */\n private isSubmenuCloseKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NavigableKey.RIGHT : NavigableKey.LEFT;\n switch (code) {\n case arrowEnterKey:\n case KeydownCloseKey.ESCAPE:\n return {close: true, keyCode: code} as const;\n default:\n return {close: false} as const;\n }\n }\n}\n"]}
|