@material/web 1.0.0-pre.11 → 1.0.0-pre.13

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.
Files changed (166) hide show
  1. package/README.md +18 -1
  2. package/button/lib/_icon.scss +9 -9
  3. package/button/lib/_outlined-button.scss +4 -0
  4. package/button/lib/button.d.ts +0 -6
  5. package/button/lib/button.js +2 -14
  6. package/button/lib/button.js.map +1 -1
  7. package/button/lib/elevated-styles.css.js +1 -1
  8. package/button/lib/elevated-styles.css.js.map +1 -1
  9. package/button/lib/filled-styles.css.js +1 -1
  10. package/button/lib/filled-styles.css.js.map +1 -1
  11. package/button/lib/outlined-styles.css.js +1 -1
  12. package/button/lib/outlined-styles.css.js.map +1 -1
  13. package/button/lib/shared-styles.css.js +1 -1
  14. package/button/lib/shared-styles.css.js.map +1 -1
  15. package/button/lib/text-styles.css.js +1 -1
  16. package/button/lib/text-styles.css.js.map +1 -1
  17. package/button/lib/tonal-styles.css.js +1 -1
  18. package/button/lib/tonal-styles.css.js.map +1 -1
  19. package/chips/assist-chip.js +2 -1
  20. package/chips/assist-chip.js.map +1 -1
  21. package/chips/filter-chip.js +3 -1
  22. package/chips/filter-chip.js.map +1 -1
  23. package/chips/harness.d.ts +2 -5
  24. package/chips/harness.js +9 -6
  25. package/chips/harness.js.map +1 -1
  26. package/chips/input-chip.js +5 -1
  27. package/chips/input-chip.js.map +1 -1
  28. package/chips/lib/_elevated.scss +14 -0
  29. package/chips/lib/_selectable.scss +8 -0
  30. package/chips/lib/_shared.scss +1 -0
  31. package/chips/lib/_trailing-icon.scss +1 -1
  32. package/chips/lib/assist-chip.d.ts +1 -0
  33. package/chips/lib/assist-chip.js +1 -0
  34. package/chips/lib/assist-chip.js.map +1 -1
  35. package/chips/lib/assist-forced-colors-styles.css.d.ts +1 -0
  36. package/chips/lib/assist-forced-colors-styles.css.js +9 -0
  37. package/chips/lib/assist-forced-colors-styles.css.js.map +1 -0
  38. package/chips/lib/assist-forced-colors-styles.scss +27 -0
  39. package/chips/lib/chip-set.js +4 -4
  40. package/chips/lib/chip-set.js.map +1 -1
  41. package/chips/lib/elevated-styles.css.js +1 -1
  42. package/chips/lib/elevated-styles.css.js.map +1 -1
  43. package/chips/lib/filter-chip.d.ts +1 -0
  44. package/chips/lib/filter-chip.js +2 -1
  45. package/chips/lib/filter-chip.js.map +1 -1
  46. package/chips/lib/filter-forced-colors-styles.css.d.ts +1 -0
  47. package/chips/lib/filter-forced-colors-styles.css.js +9 -0
  48. package/chips/lib/filter-forced-colors-styles.css.js.map +1 -0
  49. package/chips/lib/filter-forced-colors-styles.scss +34 -0
  50. package/chips/lib/input-chip.d.ts +2 -0
  51. package/chips/lib/input-chip.js +4 -2
  52. package/chips/lib/input-chip.js.map +1 -1
  53. package/chips/lib/input-forced-colors-styles.css.d.ts +1 -0
  54. package/chips/lib/input-forced-colors-styles.css.js +9 -0
  55. package/chips/lib/input-forced-colors-styles.css.js.map +1 -0
  56. package/chips/lib/input-forced-colors-styles.scss +39 -0
  57. package/chips/lib/input-styles.css.js +1 -1
  58. package/chips/lib/input-styles.css.js.map +1 -1
  59. package/chips/lib/selectable-styles.css.js +1 -1
  60. package/chips/lib/selectable-styles.css.js.map +1 -1
  61. package/chips/lib/shared-styles.css.js +1 -1
  62. package/chips/lib/shared-styles.css.js.map +1 -1
  63. package/chips/lib/suggestion-forced-colors-styles.css.d.ts +1 -0
  64. package/chips/lib/suggestion-forced-colors-styles.css.js +9 -0
  65. package/chips/lib/suggestion-forced-colors-styles.css.js.map +1 -0
  66. package/chips/lib/suggestion-forced-colors-styles.scss +27 -0
  67. package/chips/lib/trailing-icon-styles.css.js +1 -1
  68. package/chips/lib/trailing-icon-styles.css.js.map +1 -1
  69. package/chips/suggestion-chip.js +2 -1
  70. package/chips/suggestion-chip.js.map +1 -1
  71. package/dialog/lib/_dialog.scss +2 -2
  72. package/dialog/lib/_tokens.scss +5 -22
  73. package/dialog/lib/dialog-styles.css.js +1 -1
  74. package/dialog/lib/dialog-styles.css.js.map +1 -1
  75. package/dialog/lib/dialog.d.ts +9 -3
  76. package/dialog/lib/dialog.js +24 -16
  77. package/dialog/lib/dialog.js.map +1 -1
  78. package/fab/branded-fab.d.ts +1 -0
  79. package/fab/lib/_fab.scss +12 -0
  80. package/fab/lib/fab-styles.css.js +1 -1
  81. package/fab/lib/fab-styles.css.js.map +1 -1
  82. package/fab/lib/fab.d.ts +1 -0
  83. package/fab/lib/shared.d.ts +9 -0
  84. package/fab/lib/shared.js +23 -2
  85. package/fab/lib/shared.js.map +1 -1
  86. package/field/lib/_supporting-text.scss +6 -16
  87. package/field/lib/field.d.ts +26 -2
  88. package/field/lib/field.js +100 -15
  89. package/field/lib/field.js.map +1 -1
  90. package/field/lib/outlined-field.d.ts +1 -2
  91. package/field/lib/outlined-field.js.map +1 -1
  92. package/field/lib/shared-styles.css.js +1 -1
  93. package/field/lib/shared-styles.css.js.map +1 -1
  94. package/iconbutton/lib/icon-button.js +1 -1
  95. package/iconbutton/lib/icon-button.js.map +1 -1
  96. package/labs/navigationbar/lib/navigation-bar.js +2 -2
  97. package/labs/navigationbar/lib/navigation-bar.js.map +1 -1
  98. package/labs/navigationtab/lib/navigation-tab.js +3 -3
  99. package/labs/navigationtab/lib/navigation-tab.js.map +1 -1
  100. package/labs/segmentedbutton/lib/_shared.scss +7 -7
  101. package/labs/segmentedbutton/lib/outlined-styles.css.js +1 -1
  102. package/labs/segmentedbutton/lib/outlined-styles.css.js.map +1 -1
  103. package/labs/segmentedbutton/lib/segmented-button.js +2 -2
  104. package/labs/segmentedbutton/lib/segmented-button.js.map +1 -1
  105. package/labs/segmentedbutton/lib/shared-styles.css.js +1 -1
  106. package/labs/segmentedbutton/lib/shared-styles.css.js.map +1 -1
  107. package/labs/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
  108. package/labs/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
  109. package/list/harness.d.ts +24 -0
  110. package/list/harness.js +25 -0
  111. package/list/harness.js.map +1 -1
  112. package/list/lib/list.d.ts +28 -10
  113. package/list/lib/list.js +57 -19
  114. package/list/lib/list.js.map +1 -1
  115. package/list/lib/listitem/harness.d.ts +21 -1
  116. package/list/lib/listitem/harness.js +16 -2
  117. package/list/lib/listitem/harness.js.map +1 -1
  118. package/list/lib/listitem/list-item.js +4 -4
  119. package/list/lib/listitem/list-item.js.map +1 -1
  120. package/list/lib/listitemlink/list-item-link-only.d.ts +1 -0
  121. package/list/lib/listitemlink/list-item-link-only.js +4 -1
  122. package/list/lib/listitemlink/list-item-link-only.js.map +1 -1
  123. package/menu/harness.js.map +1 -1
  124. package/menu/lib/menu.d.ts +15 -1
  125. package/menu/lib/menu.js +29 -6
  126. package/menu/lib/menu.js.map +1 -1
  127. package/package.json +5 -4
  128. package/radio/lib/single-selection-controller.js +2 -3
  129. package/radio/lib/single-selection-controller.js.map +1 -1
  130. package/select/harness.js +1 -1
  131. package/select/harness.js.map +1 -1
  132. package/select/lib/_shared.scss +2 -1
  133. package/select/lib/select.d.ts +1 -11
  134. package/select/lib/select.js +15 -51
  135. package/select/lib/select.js.map +1 -1
  136. package/select/lib/shared-styles.css.js +1 -1
  137. package/select/lib/shared-styles.css.js.map +1 -1
  138. package/slider/lib/slider.d.ts +3 -3
  139. package/slider/lib/slider.js +10 -10
  140. package/slider/lib/slider.js.map +1 -1
  141. package/switch/lib/switch.js +1 -1
  142. package/switch/lib/switch.js.map +1 -1
  143. package/tabs/lib/tab.js +4 -2
  144. package/tabs/lib/tab.js.map +1 -1
  145. package/tabs/lib/tabs.js +3 -1
  146. package/tabs/lib/tabs.js.map +1 -1
  147. package/textfield/lib/_shared.scss +0 -4
  148. package/textfield/lib/shared-styles.css.js +1 -1
  149. package/textfield/lib/shared-styles.css.js.map +1 -1
  150. package/textfield/lib/text-field.d.ts +2 -13
  151. package/textfield/lib/text-field.js +44 -98
  152. package/textfield/lib/text-field.js.map +1 -1
  153. package/tokens/_md-comp-dialog.scss +48 -6
  154. package/tokens/_md-comp-elevated-button.scss +17 -7
  155. package/tokens/_md-comp-elevation.scss +11 -2
  156. package/tokens/_md-comp-filled-button.scss +17 -7
  157. package/tokens/_md-comp-filled-tonal-button.scss +17 -7
  158. package/tokens/_md-comp-input-chip.scss +7 -0
  159. package/tokens/_md-comp-list-item.scss +5 -0
  160. package/tokens/_md-comp-menu-item.scss +1 -0
  161. package/tokens/_md-comp-outlined-button.scss +19 -9
  162. package/tokens/_md-comp-outlined-segmented-button.scss +19 -13
  163. package/tokens/_md-comp-slider.scss +48 -2
  164. package/tokens/_md-comp-suggestion-chip.scss +1 -0
  165. package/tokens/_md-comp-text-button.scss +17 -7
  166. package/tokens/_values.scss +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAIpD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAAiB;IAC3C,KAAK,CAAC,qBAAqB;QAClC,MAAO,IAAI,CAAC,OAAiC,CAAC,cAAc,CAAC;QAC7D,OAAQ,IAAI,CAAC,OAAiC;aAClC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAgB,CAAC;IACpE,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {Harness} from '../../../testing/harness.js';\n\nimport {ListItem} from './list-item.js';\n\n/**\n * Test harness for list item.\n */\nexport class ListItemHarness extends Harness<ListItem> {\n override async getInteractiveElement() {\n await (this.element as unknown as LitElement).updateComplete;\n return (this.element as unknown as LitElement)\n .renderRoot.querySelector('.list-item') as HTMLElement;\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAIpD,MAAM,cAAc,GAAG;IACrB,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,KAAK;CACJ,CAAC;AASX;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAA4B;IACtD,KAAK,CAAC,qBAAqB;QAClC,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAgB,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAqC,GAAM;QAC9D,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {Harness} from '../../../testing/harness.js';\n\nimport {ListItem} from './list-item.js';\n\nconst NAVIGABLE_KEYS = {\n 'ArrowDown': 'ArrowDown',\n 'ArrowUp': 'ArrowUp',\n 'Home': 'Home',\n 'End': 'End',\n} as const;\n\n/**\n * Keys that are handled by MdList. Keys not included in this are not handled by\n * MdList and should be dispatched by yourself.\n */\nexport type HandledListKeys =\n typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];\n\n/**\n * Test harness for list item.\n */\nexport class ListItemHarness extends Harness<ListItem&LitElement> {\n override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.element.renderRoot.querySelector('.list-item') as HTMLElement;\n }\n\n /**\n * Constructs keyboard events that are handled by List and makes sure that\n * they are constructed in a manner that List understands.\n *\n * @param key The key to dispatch on the list.\n */\n async pressHandledKey<T extends string = HandledListKeys>(key: T) {\n await this.keypress(key, {code: key});\n }\n}\n"]}
@@ -201,19 +201,19 @@ __decorate([
201
201
  property()
202
202
  ], ListItemEl.prototype, "headline", void 0);
203
203
  __decorate([
204
- property()
204
+ property({ attribute: 'supporting-text' })
205
205
  ], ListItemEl.prototype, "supportingText", void 0);
206
206
  __decorate([
207
- property({ type: Boolean })
207
+ property({ type: Boolean, attribute: 'multi-line-supporting-text' })
208
208
  ], ListItemEl.prototype, "multiLineSupportingText", void 0);
209
209
  __decorate([
210
- property()
210
+ property({ attribute: 'trailing-supporting-text' })
211
211
  ], ListItemEl.prototype, "trailingSupportingText", void 0);
212
212
  __decorate([
213
213
  property({ type: Boolean })
214
214
  ], ListItemEl.prototype, "disabled", void 0);
215
215
  __decorate([
216
- property({ type: Number })
216
+ property({ type: Number, attribute: 'item-tabindex' })
217
217
  ], ListItemEl.prototype, "itemTabIndex", void 0);
218
218
  __decorate([
219
219
  property({ type: Boolean, reflect: true })
@@ -1 +1 @@
1
- {"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,yBAAyB,EAAC,MAAM,oCAAoC,CAAC;AAkB7E,gEAAgE;AAChE,MAAM,OAAO,UAAW,SAAQ,UAAU;IAA1C;;QAKE;;WAEG;QACS,aAAQ,GAAG,EAAE,CAAC;QAE1B;;;;WAIG;QACS,mBAAc,GAAG,EAAE,CAAC;QAEhC;;WAEG;QACwB,4BAAuB,GAAG,KAAK,CAAC;QAE3D;;;WAGG;QACS,2BAAsB,GAAG,EAAE,CAAC;QAExC;;WAEG;QACwB,aAAQ,GAAG,KAAK,CAAC;QAE5C;;;;;WAKG;QACuB,iBAAY,GAAG,CAAC,CA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AAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAEG;IAApB,KAAK,CAAC,YAAY,CAAC;gDAAoD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../ripple/ripple.js';\nimport '../../../focus/focus-ring.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../../internal/aria/delegate.js';\n\n/**\n * Supported roles for a list item.\n */\nexport type ListItemRole = 'listitem'|'menuitem'|'option'|'link'|'none';\n\ninterface ListItemSelf {\n active: boolean;\n disabled: boolean;\n}\n\n/**\n * The interface of an item that is compatible with md-list. An item that is\n * selectable and disablable.\n */\nexport type ListItem = ListItemSelf&HTMLElement;\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class ListItemEl extends LitElement implements ListItem {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n /**\n * The primary, headline text of the list item.\n */\n @property() headline = '';\n\n /**\n * The one-line supporting text below the headline. Set\n * `multiLineSupportingText` to `true` to support multiple lines in the\n * supporting text.\n */\n @property() supportingText = '';\n\n /**\n * Modifies `supportingText` to support multiple lines.\n */\n @property({type: Boolean}) multiLineSupportingText = false;\n\n /**\n * The supporting text placed at the end of the item. Overridden by elements\n * slotted into the `end` slot.\n */\n @property() trailingSupportingText = '';\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean}) disabled = false;\n\n /**\n * The tabindex of the underlying item.\n *\n * __NOTE:__ this is overridden by the keyboard behavior of `md-list` and by\n * setting `selected`.\n */\n @property({type: Number}) itemTabIndex = -1;\n\n /**\n * Whether or not the element is actively being interacted with by md-list.\n * When active, tabindex is set to 0, and in some list item variants (like\n * md-list-item), focuses the underlying item.\n */\n @property({type: Boolean, reflect: true}) active = false;\n\n /**\n * Sets the role of the list item. Set to '' to clear the role.\n */\n @property()\n type: ListItemRole = 'listitem';\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 @query('.list-item') protected readonly listItemRoot!: HTMLElement|null;\n\n /**\n * Only meant to be overridden by subclassing and not by the user. This is\n * so that we have control over focus on specific variants such as disabling\n * focus on <md-autocomplete-item> but enabling it for <md-menu-item>.\n */\n protected focusOnActivation = true;\n\n protected isFirstUpdate = true;\n\n protected override willUpdate(changed: PropertyValues<this>) {\n if (changed.has('active') && !this.disabled) {\n if (this.active) {\n this.itemTabIndex = 0;\n } else if (!this.isFirstUpdate) {\n // Do not reset anything if it's the first render because user could\n // have set `itemTabIndex` manually.\n this.itemTabIndex = -1;\n }\n }\n }\n\n protected override render() {\n return this.renderListItem(html`\n <div class=\"content-wrapper\">\n ${this.renderStart()}\n ${this.renderBody()}\n ${this.renderEnd()}\n ${this.renderRipple()}\n ${this.renderFocusRing()}\n </div>\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 return html`\n <li\n id=\"item\"\n tabindex=${this.disabled ? -1 : this.itemTabIndex}\n role=${this.type === 'none' ? nothing : this.type}\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n @click=${this.onClick}\n @pointerenter=${this.onPointerenter}\n @pointerleave=${this.onPointerleave}\n @keydown=${this.onKeydown}\n >${content}</li>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult|typeof nothing {\n return html`<md-ripple for=\"item\" ?disabled=${this.disabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult|typeof nothing {\n return html`<md-focus-ring class=\"focus-ring\" for=\"item\" inward></md-focus-ring>`;\n }\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses() {\n return {\n 'with-one-line': this.supportingText === '',\n 'with-two-line':\n this.supportingText !== '' && !this.multiLineSupportingText,\n 'with-three-line':\n this.supportingText !== '' && this.multiLineSupportingText,\n 'disabled': this.disabled\n };\n }\n\n /**\n * The content rendered at the start of the list item.\n */\n protected renderStart() {\n return html`<div class=\"start\"><slot name=\"start\"></slot></div>`;\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n const supportingText =\n this.supportingText !== '' ? this.renderSupportingText() : '';\n\n return html`<div class=\"body\"\n ><span class=\"label-text\">${this.headline}</span>${supportingText}</div>`;\n }\n\n /**\n * Renders the one-line supporting text.\n */\n protected renderSupportingText() {\n return html`<span\n class=\"supporting-text ${classMap(this.getSupportingTextClasses())}\"\n >${this.supportingText}</span>`;\n }\n\n /**\n * Gets the classes for the supporting text node\n */\n protected getSupportingTextClasses() {\n return {'supporting-text--multi-line': this.multiLineSupportingText};\n }\n\n /**\n * The content rendered at the end of the list item.\n */\n protected renderEnd() {\n const supportingText = this.trailingSupportingText !== '' ?\n this.renderTrailingSupportingText() :\n '';\n return html`<div class=\"end\"\n ><slot name=\"end\">${supportingText}</slot></div>`;\n }\n\n /**\n * Renders the supporting text at the end of the list item.\n */\n protected renderTrailingSupportingText() {\n return html`<span class=\"trailing-supporting-text\"\n >${this.trailingSupportingText}</span>`;\n }\n\n // For easier overriding in menu-item\n protected onClick?(event: Event): void;\n protected onKeydown?(event: KeyboardEvent): void;\n protected onPointerenter?(event: Event): void;\n protected onPointerleave?(event: Event): void;\n\n protected override updated(changed: PropertyValues<this>) {\n super.updated(changed);\n\n // will focus the list item root if it is selected but not on the first\n // update or else it may cause the page to jump on first load.\n if (changed.has('active') && !this.isFirstUpdate && this.active &&\n this.focusOnActivation) {\n this.focus();\n }\n\n this.isFirstUpdate = false;\n }\n\n override focus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C,iBAAiB,EAAE;YAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;QAED,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;IAEQ,KAAK;QACZ,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC;IAC/B,CAAC;CACF;;AA7NC;IACE,yBAAyB,CAAC,EAAI,CAAC,CAAC;AAClC,CAAC,GAAA,CAAA;AAKW;IAAX,QAAQ,EAAE;4CAAe;AAOgB;IAAzC,QAAQ,CAAC,EAAC,SAAS,EAAE,iBAAiB,EAAC,CAAC;kDAAqB;AAM9D;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAC,CAAC;2DACnC;AAOhC;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,0BAA0B,EAAC,CAAC;0DACtB;AAKD;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;4CAAkB;AAQU;IAArD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;gDAAmB;AAO9B;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CAAgB;AAMzD;IADC,QAAQ,EAAE;wCACqB;AAMhC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAEG;IAApB,KAAK,CAAC,YAAY,CAAC;gDAAoD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../ripple/ripple.js';\nimport '../../../focus/focus-ring.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../../internal/aria/delegate.js';\n\n/**\n * Supported roles for a list item.\n */\nexport type ListItemRole = 'listitem'|'menuitem'|'option'|'link'|'none';\n\ninterface ListItemSelf {\n active: boolean;\n disabled: boolean;\n}\n\n/**\n * The interface of an item that is compatible with md-list. An item that is\n * selectable and disablable.\n */\nexport type ListItem = ListItemSelf&HTMLElement;\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class ListItemEl extends LitElement implements ListItem {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n /**\n * The primary, headline text of the list item.\n */\n @property() headline = '';\n\n /**\n * The one-line supporting text below the headline. Set\n * `multiLineSupportingText` to `true` to support multiple lines in the\n * supporting text.\n */\n @property({attribute: 'supporting-text'}) supportingText = '';\n\n /**\n * Modifies `supportingText` to support multiple lines.\n */\n @property({type: Boolean, attribute: 'multi-line-supporting-text'})\n multiLineSupportingText = false;\n\n /**\n * The supporting text placed at the end of the item. Overridden by elements\n * slotted into the `end` slot.\n */\n @property({attribute: 'trailing-supporting-text'})\n trailingSupportingText = '';\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean}) disabled = false;\n\n /**\n * The tabindex of the underlying item.\n *\n * __NOTE:__ this is overridden by the keyboard behavior of `md-list` and by\n * setting `selected`.\n */\n @property({type: Number, attribute: 'item-tabindex'}) itemTabIndex = -1;\n\n /**\n * Whether or not the element is actively being interacted with by md-list.\n * When active, tabindex is set to 0, and in some list item variants (like\n * md-list-item), focuses the underlying item.\n */\n @property({type: Boolean, reflect: true}) active = false;\n\n /**\n * Sets the role of the list item. Set to '' to clear the role.\n */\n @property()\n type: ListItemRole = 'listitem';\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 @query('.list-item') protected readonly listItemRoot!: HTMLElement|null;\n\n /**\n * Only meant to be overridden by subclassing and not by the user. This is\n * so that we have control over focus on specific variants such as disabling\n * focus on <md-autocomplete-item> but enabling it for <md-menu-item>.\n */\n protected focusOnActivation = true;\n\n protected isFirstUpdate = true;\n\n protected override willUpdate(changed: PropertyValues<this>) {\n if (changed.has('active') && !this.disabled) {\n if (this.active) {\n this.itemTabIndex = 0;\n } else if (!this.isFirstUpdate) {\n // Do not reset anything if it's the first render because user could\n // have set `itemTabIndex` manually.\n this.itemTabIndex = -1;\n }\n }\n }\n\n protected override render() {\n return this.renderListItem(html`\n <div class=\"content-wrapper\">\n ${this.renderStart()}\n ${this.renderBody()}\n ${this.renderEnd()}\n ${this.renderRipple()}\n ${this.renderFocusRing()}\n </div>\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 return html`\n <li\n id=\"item\"\n tabindex=${this.disabled ? -1 : this.itemTabIndex}\n role=${this.type === 'none' ? nothing : this.type}\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n @click=${this.onClick}\n @pointerenter=${this.onPointerenter}\n @pointerleave=${this.onPointerleave}\n @keydown=${this.onKeydown}\n >${content}</li>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult|typeof nothing {\n return html`<md-ripple for=\"item\" ?disabled=${this.disabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult|typeof nothing {\n return html`<md-focus-ring class=\"focus-ring\" for=\"item\" inward></md-focus-ring>`;\n }\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses() {\n return {\n 'with-one-line': this.supportingText === '',\n 'with-two-line':\n this.supportingText !== '' && !this.multiLineSupportingText,\n 'with-three-line':\n this.supportingText !== '' && this.multiLineSupportingText,\n 'disabled': this.disabled\n };\n }\n\n /**\n * The content rendered at the start of the list item.\n */\n protected renderStart() {\n return html`<div class=\"start\"><slot name=\"start\"></slot></div>`;\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n const supportingText =\n this.supportingText !== '' ? this.renderSupportingText() : '';\n\n return html`<div class=\"body\"\n ><span class=\"label-text\">${this.headline}</span>${supportingText}</div>`;\n }\n\n /**\n * Renders the one-line supporting text.\n */\n protected renderSupportingText() {\n return html`<span\n class=\"supporting-text ${classMap(this.getSupportingTextClasses())}\"\n >${this.supportingText}</span>`;\n }\n\n /**\n * Gets the classes for the supporting text node\n */\n protected getSupportingTextClasses() {\n return {'supporting-text--multi-line': this.multiLineSupportingText};\n }\n\n /**\n * The content rendered at the end of the list item.\n */\n protected renderEnd() {\n const supportingText = this.trailingSupportingText !== '' ?\n this.renderTrailingSupportingText() :\n '';\n return html`<div class=\"end\"\n ><slot name=\"end\">${supportingText}</slot></div>`;\n }\n\n /**\n * Renders the supporting text at the end of the list item.\n */\n protected renderTrailingSupportingText() {\n return html`<span class=\"trailing-supporting-text\"\n >${this.trailingSupportingText}</span>`;\n }\n\n // For easier overriding in menu-item\n protected onClick?(event: Event): void;\n protected onKeydown?(event: KeyboardEvent): void;\n protected onPointerenter?(event: Event): void;\n protected onPointerleave?(event: Event): void;\n\n protected override updated(changed: PropertyValues<this>) {\n super.updated(changed);\n\n // will focus the list item root if it is selected but not on the first\n // update or else it may cause the page to jump on first load.\n if (changed.has('active') && !this.isFirstUpdate && this.active &&\n this.focusOnActivation) {\n this.focus();\n }\n\n this.isFirstUpdate = false;\n }\n\n override focus() {\n this.listItemRoot?.focus?.();\n }\n}\n"]}
@@ -19,4 +19,5 @@ export declare class ListItemLinkOnly extends ListItemLink {
19
19
  disabled: boolean;
20
20
  };
21
21
  renderRipple(): typeof nothing | import("lit-html").TemplateResult<2 | 1>;
22
+ renderFocusRing(): typeof nothing | import("lit-html").TemplateResult<2 | 1>;
22
23
  }
@@ -26,8 +26,11 @@ export class ListItemLinkOnly extends ListItemLink {
26
26
  renderRipple() {
27
27
  return this.noninteractive ? nothing : super.renderRipple();
28
28
  }
29
+ renderFocusRing() {
30
+ return this.noninteractive ? nothing : super.renderFocusRing();
31
+ }
29
32
  }
30
33
  __decorate([
31
- property()
34
+ property({ type: Boolean })
32
35
  ], ListItemLinkOnly.prototype, "noninteractive", void 0);
33
36
  //# sourceMappingURL=list-item-link-only.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-item-link-only.js","sourceRoot":"","sources":["list-item-link-only.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,gEAAgE;AAChE,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAAlD;;QACE;;;WAGG;QACS,mBAAc,GAAG,KAAK,CAAC;IAYrC,CAAC;IAVU,gBAAgB;QACvB,OAAO;YACL,GAAG,KAAK,CAAC,gBAAgB,EAAE;YAC3B,gBAAgB,EAAE,IAAI,CAAC,cAAc;SACtC,CAAC;IACJ,CAAC;IAEQ,YAAY;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IAC9D,CAAC;CACF;AAZa;IAAX,QAAQ,EAAE;wDAAwB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\n\nimport {ListItemLink} from './list-item-link.js';\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class ListItemLinkOnly extends ListItemLink {\n /**\n * Removes the hover and click ripples from the item when true. Clicking the\n * link will still cause link navigation.\n */\n @property() noninteractive = false;\n\n override getRenderClasses() {\n return {\n ...super.getRenderClasses(),\n 'noninteractive': this.noninteractive,\n };\n }\n\n override renderRipple() {\n return this.noninteractive ? nothing : super.renderRipple();\n }\n}\n"]}
1
+ {"version":3,"file":"list-item-link-only.js","sourceRoot":"","sources":["list-item-link-only.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,gEAAgE;AAChE,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAAlD;;QACE;;;WAGG;QACwB,mBAAc,GAAG,KAAK,CAAC;IAgBpD,CAAC;IAdU,gBAAgB;QACvB,OAAO;YACL,GAAG,KAAK,CAAC,gBAAgB,EAAE;YAC3B,gBAAgB,EAAE,IAAI,CAAC,cAAc;SACtC,CAAC;IACJ,CAAC;IAEQ,YAAY;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IAC9D,CAAC;IAEQ,eAAe;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;IACjE,CAAC;CACF;AAhB4B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;wDAAwB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\n\nimport {ListItemLink} from './list-item-link.js';\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class ListItemLinkOnly extends ListItemLink {\n /**\n * Removes the hover and click ripples from the item when true. Clicking the\n * link will still cause link navigation.\n */\n @property({type: Boolean}) noninteractive = false;\n\n override getRenderClasses() {\n return {\n ...super.getRenderClasses(),\n 'noninteractive': this.noninteractive,\n };\n }\n\n override renderRipple() {\n return this.noninteractive ? nothing : super.renderRipple();\n }\n\n override renderFocusRing() {\n return this.noninteractive ? nothing : super.renderFocusRing();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAa;IAC5C;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;IAC5D,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI;QACrB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO;SACR;QAED,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;gBACnC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAM,MAAM,CAAC;IACf,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Harness} from '../testing/harness.js';\n\nimport {Menu} from './lib/menu.js';\nimport {MenuItemHarness} from './lib/menuitem/harness.js';\n\nexport {MenuItemHarness} from './lib/menuitem/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class MenuHarness extends Harness<Menu> {\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n await this.show();\n return (await this.getItems())[0].getInteractiveElement();\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.items.map((item) => new MenuItemHarness(item));\n }\n\n async show(quick = true) {\n const menu = this.element;\n menu.quick = quick;\n if (menu.open) {\n return;\n }\n\n const opened = new Promise((resolve) => {\n menu.addEventListener('opened', () => {\n resolve(true);\n }, {once: true});\n });\n\n menu.show();\n await opened;\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAa;IAC5C;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;IAC5D,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CACzB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,IAA8B,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI;QACrB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO;SACR;QAED,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;gBACnC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAM,MAAM,CAAC;IACf,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {Harness} from '../testing/harness.js';\n\nimport {Menu} from './lib/menu.js';\nimport {MenuItemHarness} from './lib/menuitem/harness.js';\n\nexport {MenuItemHarness} from './lib/menuitem/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class MenuHarness extends Harness<Menu> {\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n await this.show();\n return (await this.getItems())[0].getInteractiveElement();\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.items.map(\n (item) => new MenuItemHarness(item as typeof item&LitElement));\n }\n\n async show(quick = true) {\n const menu = this.element;\n menu.quick = quick;\n if (menu.open) {\n return;\n }\n\n const opened = new Promise((resolve) => {\n menu.addEventListener('opened', () => {\n resolve(true);\n }, {once: true});\n });\n\n menu.show();\n await opened;\n }\n}\n"]}
@@ -89,7 +89,7 @@ export declare abstract class Menu extends LitElement {
89
89
  * The max time between the keystrokes of the typeahead menu behavior before
90
90
  * it clears the typeahead buffer.
91
91
  */
92
- typeaheadBufferTime: number;
92
+ typeaheadDelay: number;
93
93
  /**
94
94
  * The corner of the anchor which to align the menu in the standard logical
95
95
  * property style of <block>_<inline>.
@@ -208,4 +208,18 @@ export declare abstract class Menu extends LitElement {
208
208
  focus(): void;
209
209
  close(): void;
210
210
  show(): void;
211
+ /**
212
+ * Activates the next item in the menu. If at the end of the menu, the first
213
+ * item will be activated.
214
+ *
215
+ * @return The activated menu item or `null` if there are no items.
216
+ */
217
+ activateNextItem(): MenuItem;
218
+ /**
219
+ * Activates the previous item in the menu. If at the start of the menu, the
220
+ * last item will be activated.
221
+ *
222
+ * @return The activated menu item or `null` if there are no items.
223
+ */
224
+ activatePreviousItem(): MenuItem;
211
225
  }
package/menu/lib/menu.js CHANGED
@@ -13,9 +13,9 @@ import { eventOptions, property, query, state } from 'lit/decorators.js';
13
13
  import { classMap } from 'lit/directives/class-map.js';
14
14
  import { styleMap } from 'lit/directives/style-map.js';
15
15
  import { requestUpdateOnAriaChange } from '../../internal/aria/delegate.js';
16
- import { List } from '../../list/lib/list.js';
17
16
  import { createAnimationSignal, EASING } from '../../internal/motion/animation.js';
18
- import { isElementInSubtree } from './shared.js';
17
+ import { List } from '../../list/lib/list.js';
18
+ import { isClosableKey, isElementInSubtree } from './shared.js';
19
19
  import { SurfacePositionController } from './surfacePositionController.js';
20
20
  import { TypeaheadController } from './typeaheadController.js';
21
21
  /**
@@ -107,7 +107,7 @@ export class Menu extends LitElement {
107
107
  * The max time between the keystrokes of the typeahead menu behavior before
108
108
  * it clears the typeahead buffer.
109
109
  */
110
- this.typeaheadBufferTime = DEFAULT_TYPEAHEAD_BUFFER_TIME;
110
+ this.typeaheadDelay = DEFAULT_TYPEAHEAD_BUFFER_TIME;
111
111
  /**
112
112
  * The corner of the anchor which to align the menu in the standard logical
113
113
  * property style of <block>_<inline>.
@@ -153,7 +153,7 @@ export class Menu extends LitElement {
153
153
  this.typeaheadController = new TypeaheadController(() => {
154
154
  return {
155
155
  getItems: () => this.items,
156
- typeaheadBufferTime: this.typeaheadBufferTime,
156
+ typeaheadBufferTime: this.typeaheadDelay,
157
157
  active: this.typeaheadActive
158
158
  };
159
159
  });
@@ -356,6 +356,11 @@ export class Menu extends LitElement {
356
356
  // istelf. Specifically useful for the case where typeahead encounters a space
357
357
  // and we don't want the menu item to close the menu.
358
358
  handleListKeydown(e) {
359
+ if (e.target === this.listElement && !e.defaultPrevented &&
360
+ isClosableKey(e.code)) {
361
+ e.preventDefault();
362
+ this.close();
363
+ }
359
364
  this.typeaheadController.onKeydown(e);
360
365
  }
361
366
  /**
@@ -579,6 +584,24 @@ export class Menu extends LitElement {
579
584
  show() {
580
585
  this.open = true;
581
586
  }
587
+ /**
588
+ * Activates the next item in the menu. If at the end of the menu, the first
589
+ * item will be activated.
590
+ *
591
+ * @return The activated menu item or `null` if there are no items.
592
+ */
593
+ activateNextItem() {
594
+ return this.listElement?.activateNextItem() ?? null;
595
+ }
596
+ /**
597
+ * Activates the previous item in the menu. If at the start of the menu, the
598
+ * last item will be activated.
599
+ *
600
+ * @return The activated menu item or `null` if there are no items.
601
+ */
602
+ activatePreviousItem() {
603
+ return this.listElement?.activatePreviousItem() ?? null;
604
+ }
582
605
  }
583
606
  _a = Menu;
584
607
  (() => {
@@ -615,14 +638,14 @@ __decorate([
615
638
  property({ type: Number, attribute: 'y-offset' })
616
639
  ], Menu.prototype, "yOffset", void 0);
617
640
  __decorate([
618
- property({ type: Number, attribute: 'list-tab-index' })
641
+ property({ type: Number, attribute: 'list-tabindex' })
619
642
  ], Menu.prototype, "listTabIndex", void 0);
620
643
  __decorate([
621
644
  property()
622
645
  ], Menu.prototype, "type", void 0);
623
646
  __decorate([
624
647
  property({ type: Number, attribute: 'typeahead-delay' })
625
- ], Menu.prototype, "typeaheadBufferTime", void 0);
648
+ ], Menu.prototype, "typeaheadDelay", void 0);
626
649
  __decorate([
627
650
  property({ attribute: 'anchor-corner' })
628
651
  ], Menu.prototype, "anchorCorner", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,yBAAyB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAC,qBAAqB,EAAE,MAAM,EAAC,MAAM,oCAAoC,CAAC;AAEjF,OAAO,EAAmD,kBAAkB,EAAW,MAAM,aAAa,CAAC;AAC3G,OAAO,EAAS,yBAAyB,EAAwB,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAI7D;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAOjD;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,YAAiC,QAAQ;IAElE,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAmC,CAAC;IAE/D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IAED,IAAI,QAAQ,CAAC,UAAU,EAAE;QACvB,OAAO,iBAAiB,CAAC,QAAQ,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CAAC;0CAAoC;AAKrC;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;wCAAoC;AAQzE;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAC,CAAC;oDACpC;AAQ/B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAC,CAAC;gDACnC;AAM3B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAC,CAAC;8CAClC;AAKzB;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CACO;AAErC;IAAR,KAAK,EAAE;6CAAgC;AAwKxC;IADC,YAAY,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;6CAG7B","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../list/list.js';\nimport '../../focus/focus-ring.js';\nimport '../../elevation/elevation.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {eventOptions, property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\n\nimport {ARIAMixinStrict, ARIARole} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {List} from '../../list/lib/list.js';\nimport {createAnimationSignal, EASING} from '../../internal/motion/animation.js';\n\nimport {ActivateTypeaheadEvent, DeactivateTypeaheadEvent, isElementInSubtree, MenuItem} from './shared.js';\nimport {Corner, SurfacePositionController, SurfacePositionTarget} from './surfacePositionController.js';\nimport {TypeaheadController} from './typeaheadController.js';\n\nexport {Corner} from './surfacePositionController.js';\n\n/**\n * The default value for the typeahead buffer time in Milliseconds.\n */\nexport const DEFAULT_TYPEAHEAD_BUFFER_TIME = 200;\n\n/**\n * Element to focus on when menu is first opened.\n */\nexport type DefaultFocusState = 'NONE'|'LIST_ROOT'|'FIRST_ITEM'|'LAST_ITEM';\n\n/**\n * Gets the currently focused element on the page.\n *\n * @param activeDoc The document or shadowroot from which to start the search.\n * Defaults to `window.document`\n * @return Returns the currently deeply focused element or `null` if none.\n */\nfunction getFocusedElement(activeDoc: Document|ShadowRoot = document):\n HTMLElement|null {\n const activeEl = activeDoc.activeElement as HTMLElement | null;\n\n if (!activeEl) {\n return null;\n }\n\n if (activeEl.shadowRoot) {\n return getFocusedElement(activeEl.shadowRoot) ?? activeEl;\n }\n\n return activeEl;\n}\n\n/**\n * @fires opening Fired before the opening animation begins\n * @fires opened Fired once the menu is open, after any animations\n * @fires closing Fired before the closing animation begins\n * @fires closed Fired once the menu is closed, after any animations\n */\nexport abstract class Menu extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n @query('md-list') private readonly listElement!: List|null;\n @query('.menu') private readonly surfaceEl!: HTMLElement|null;\n @query('slot') private readonly slotEl!: HTMLSlotElement|null;\n\n /**\n * The element in which the menu should align to.\n */\n @property({attribute: false})\n anchor: HTMLElement&Partial<SurfacePositionTarget>|null = null;\n /**\n * Makes the element use `position:fixed` instead of `position:absolute`. In\n * most cases, the menu should position itself above most other\n * `position:absolute` or `position:fixed` elements when placed inside of\n * them. e.g. using a menu inside of an `md-dialog`.\n *\n * __NOTE__: Fixed menus will not scroll with the page and will be fixed to\n * the window instead.\n */\n @property({type: Boolean}) fixed = false;\n /**\n * Skips the opening and closing animations.\n */\n @property({type: Boolean}) quick = false;\n /**\n * Displays overflow content like a submenu.\n *\n * __NOTE__: This may cause adverse effects if you set\n * `md-menu {max-height:...}`\n * and have items overflowing items in the \"y\" direction.\n */\n @property({type: Boolean, attribute: 'has-overflow'}) hasOverflow = false;\n /**\n * Opens the menu and makes it visible. Alternative to the `.show()` and\n * `.close()` methods\n */\n @property({type: Boolean, reflect: true}) open = false;\n /**\n * Offsets the menu's inline alignment from the anchor by the given number in\n * pixels. This value is direction aware and will follow the LTR / RTL\n * direction.\n *\n * e.g. LTR: positive -> right, negative -> left\n * RTL: positive -> left, negative -> right\n */\n @property({type: Number, attribute: 'x-offset'}) xOffset = 0;\n /**\n * Offsets the menu's block alignment from the anchor by the given number in\n * pixels.\n *\n * e.g. positive -> down, negative -> up\n */\n @property({type: Number, attribute: 'y-offset'}) yOffset = 0;\n /**\n * The tabindex of the underlying list element.\n */\n @property({type: Number, attribute: 'list-tab-index'}) listTabIndex = 0;\n /**\n * The role of the underlying list element.\n */\n @property() type: ARIARole = 'menu';\n /**\n * The max time between the keystrokes of the typeahead menu behavior before\n * it clears the typeahead buffer.\n */\n @property({type: Number, attribute: 'typeahead-delay'})\n typeaheadBufferTime = DEFAULT_TYPEAHEAD_BUFFER_TIME;\n /**\n * The corner of the anchor which to align the menu in the standard logical\n * property style of <block>_<inline>.\n */\n @property({attribute: 'anchor-corner'}) anchorCorner: Corner = 'END_START';\n /**\n * The corner of the menu which to align the anchor in the standard logical\n * property style of <block>_<inline>.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = 'START_START';\n /**\n * Keeps the user clicks outside the menu.\n *\n * NOTE: clicking outside may still cause focusout to close the menu so see\n * `stayOpenOnFocusout`.\n */\n @property({type: Boolean, attribute: 'stay-open-on-outside-click'})\n stayOpenOnOutsideClick = false;\n /**\n * Keeps the menu open when focus leaves the menu's composed subtree.\n *\n * NOTE: Focusout behavior will stop propagation of the focusout event. Set\n * this property to true to opt-out of menu's focuout handling altogether.\n */\n @property({type: Boolean, attribute: 'stay-open-on-focusout'})\n stayOpenOnFocusout = false;\n /**\n * After closing, does not restore focus to the last focused element before\n * the menu was opened.\n */\n @property({type: Boolean, attribute: 'skip-restore-focus'})\n skipRestoreFocus = false;\n /**\n * The element that should be focused by default once opened.\n */\n @property({attribute: 'default-focus'})\n defaultFocus: DefaultFocusState = 'LIST_ROOT';\n\n @state() private typeaheadActive = true;\n\n private readonly openCloseAnimationSignal = createAnimationSignal();\n\n /**\n * Whether the menu is animating upwards or downwards when opening. This is\n * helpful for calculating some animation calculations.\n */\n private get openDirection(): 'UP'|'DOWN' {\n const menuCornerBlock = this.menuCorner.split('_')[0];\n return menuCornerBlock === 'START' ? 'DOWN' : 'UP';\n }\n\n /**\n * The element that was focused before the menu opened.\n */\n private lastFocusedElement: HTMLElement|null = null;\n\n /**\n * Handles typeahead navigation through the menu.\n */\n typeaheadController = new TypeaheadController(() => {\n return {\n getItems: () => this.items,\n typeaheadBufferTime: this.typeaheadBufferTime,\n active: this.typeaheadActive\n };\n });\n\n /**\n * Handles positioning the surface and aligning it to the anchor.\n */\n private readonly menuPositionController =\n new SurfacePositionController(this, () => {\n return {\n anchorCorner: this.anchorCorner,\n surfaceCorner: this.menuCorner,\n surfaceEl: this.surfaceEl,\n anchorEl: this.anchor,\n isTopLayer: this.fixed,\n isOpen: this.open,\n xOffset: this.xOffset,\n yOffset: this.yOffset,\n onOpen: this.onOpened,\n beforeClose: this.beforeClose,\n onClose: this.onClosed,\n };\n });\n\n /**\n * The menu items associated with this menu. The items must be `MenuItem`s and\n * have both the `md-menu-item` and `md-list-item` attributes.\n */\n get items(): MenuItem[] {\n const listElement = this.listElement;\n\n if (listElement) {\n return listElement.items.filter(el => el.hasAttribute('md-menu-item')) as\n MenuItem[];\n }\n\n return [];\n }\n\n protected override render() {\n return this.renderSurface();\n }\n\n /**\n * Renders the positionable surface element and its contents.\n */\n private renderSurface() {\n // TODO(b/274140618): elevation should be an underlay, not an overlay that\n // tints content\n return html`\n <div\n class=\"menu ${classMap(this.getSurfaceClasses())}\"\n style=${styleMap(this.menuPositionController.surfaceStyles)}\n @focusout=${this.handleFocusout}>\n ${this.renderElevation()}\n ${this.renderList()}\n ${this.renderFocusRing()}\n </div>\n `;\n }\n\n /**\n * Renders the List element and its items\n */\n private renderList() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <md-list\n id=\"list\"\n aria-label=${ariaLabel || nothing}\n type=${this.type}\n listTabIndex=${this.listTabIndex}\n @keydown=${this.handleListKeydown}>\n ${this.renderMenuItems()}\n </md-list>`;\n }\n\n /**\n * Renders the menu items' slot\n */\n private renderMenuItems() {\n return html`<slot\n @close-menu=${this.onCloseMenu}\n @deactivate-items=${this.onDeactivateItems}\n @deactivate-typeahead=${this.handleDeactivateTypeahead}\n @activate-typeahead=${this.handleActivateTypeahead}\n @stay-open-on-focusout=${this.handleStayOpenOnFocusout}\n @close-on-focusout=${this.handleCloseOnFocusout}></slot>`;\n }\n\n /**\n * Renders the elevation component.\n */\n private renderElevation() {\n return html`<md-elevation></md-elevation>`;\n }\n\n /**\n * Renders the focus ring component.\n */\n private renderFocusRing() {\n return html`<md-focus-ring for=\"list\"></md-focus-ring>`;\n }\n\n private getSurfaceClasses() {\n return {\n open: this.open,\n fixed: this.fixed,\n 'has-overflow': this.hasOverflow,\n };\n }\n\n private async handleFocusout(e: FocusEvent) {\n if (this.stayOpenOnFocusout) {\n return;\n }\n\n // Stop propagation to prevent nested menus from interfering with each other\n e.stopPropagation();\n\n if (e.relatedTarget) {\n // Don't close the menu if we are switching focus between menu,\n // md-menu-item, and md-list\n if (isElementInSubtree(e.relatedTarget, this)) {\n return;\n }\n }\n\n const oldRestoreFocus = this.skipRestoreFocus;\n // allow focus to continue to the next focused object rather than returning\n this.skipRestoreFocus = true;\n this.close();\n // await for close\n await this.updateComplete;\n // return to previous behavior\n this.skipRestoreFocus = oldRestoreFocus;\n }\n\n // Capture so that we can grab the event before it reaches the list item\n // istelf. Specifically useful for the case where typeahead encounters a space\n // and we don't want the menu item to close the menu.\n @eventOptions({capture: true})\n private handleListKeydown(e: KeyboardEvent) {\n this.typeaheadController.onKeydown(e);\n }\n\n /**\n * Saves the last focused element focuses the new element based on\n * `defaultFocus`, and animates open.\n */\n private readonly onOpened = () => {\n this.lastFocusedElement = getFocusedElement();\n\n if (!this.listElement) return;\n\n const items = this.listElement.items;\n const activeItemRecord = List.getActiveItem(items);\n\n if (activeItemRecord && this.defaultFocus !== 'NONE') {\n activeItemRecord.item.active = false;\n }\n\n switch (this.defaultFocus) {\n case 'FIRST_ITEM':\n const first = List.getFirstActivatableItem(items);\n if (first) {\n first.active = true;\n }\n break;\n case 'LAST_ITEM':\n const last = List.getLastActivatableItem(items);\n if (last) {\n last.active = true;\n }\n break;\n case 'LIST_ROOT':\n this.listElement?.focus();\n break;\n default:\n case 'NONE':\n // Do nothing.\n break;\n }\n\n if (this.quick) {\n this.dispatchEvent(new Event('opening'));\n this.dispatchEvent(new Event('opened'));\n } else {\n this.animateOpen();\n }\n };\n\n /**\n * Animates closed.\n */\n private readonly beforeClose = async () => {\n this.open = false;\n\n if (!this.skipRestoreFocus) {\n this.lastFocusedElement?.focus?.();\n }\n\n if (!this.quick) {\n await this.animateClose();\n }\n };\n\n /**\n * Focuses the last focused element.\n */\n private readonly onClosed = () => {\n if (this.quick) {\n this.dispatchEvent(new Event('closing'));\n this.dispatchEvent(new Event('closed'));\n }\n };\n\n /**\n * Performs the opening animation:\n *\n * https://direct.googleplex.com/#/spec/295000003+271060003\n */\n private animateOpen() {\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) return;\n\n const openDirection = this.openDirection;\n this.dispatchEvent(new Event('opening'));\n // needs to be imperative because we don't want to mix animation and Lit\n // render timing\n surfaceEl.classList.toggle('animating', true);\n\n const signal = this.openCloseAnimationSignal.start();\n const height = surfaceEl.offsetHeight;\n const openingUpwards = openDirection === 'UP';\n const children = this.items;\n const FULL_DURATION = 500;\n const SURFACE_OPACITY_DURATION = 50;\n const ITEM_OPACITY_DURATION = 250;\n // We want to fit every child fade-in animation within the full duration of\n // the animation.\n const DELAY_BETWEEN_ITEMS =\n (FULL_DURATION - ITEM_OPACITY_DURATION) / children.length;\n\n const surfaceHeightAnimation =\n surfaceEl.animate([{height: '0px'}, {height: `${height}px`}], {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED,\n });\n // When we are opening upwards, we want to make sure the last item is always\n // in view, so we need to translate it upwards the opposite direction of the\n // height animation\n const upPositionCorrectionAnimation = slotEl.animate(\n [\n {transform: openingUpwards ? `translateY(-${height}px)` : ''},\n {transform: ''}\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED});\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 0}, {opacity: 1}], SURFACE_OPACITY_DURATION);\n\n const childrenAnimations: Array<[HTMLElement, Animation]> = [];\n\n for (let i = 0; i < children.length; i++) {\n // If we are animating upwards, then reverse the children list.\n const directionalIndex = openingUpwards ? children.length - 1 - i : i;\n const child = children[directionalIndex];\n const animation = child.animate([{opacity: 0}, {opacity: 1}], {\n duration: ITEM_OPACITY_DURATION,\n delay: DELAY_BETWEEN_ITEMS * i,\n });\n\n // Make them all initially hidden and then clean up at the end of each\n // animation.\n child.classList.toggle('hidden', true);\n animation.addEventListener('finish', () => {\n child.classList.toggle('hidden', false);\n });\n\n childrenAnimations.push([child, animation]);\n }\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n upPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n child.classList.toggle('hidden', false);\n animation.cancel();\n });\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('opened'));\n });\n }\n\n /**\n * Performs the closing animation:\n *\n * https://direct.googleplex.com/#/spec/295000003+271060003\n */\n private animateClose() {\n let resolve!: (value: unknown) => void;\n let reject!: () => void;\n\n // This promise blocks the surface position controller from setting\n // display: none on the surface which will interfere with this animation.\n const animationEnded = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) {\n reject();\n return animationEnded;\n }\n\n const openDirection = this.openDirection;\n const closingDownwards = openDirection === 'UP';\n this.dispatchEvent(new Event('closing'));\n // needs to be imperative because we don't want to mix animation and Lit\n // render timing\n surfaceEl.classList.toggle('animating', true);\n const signal = this.openCloseAnimationSignal.start();\n const height = surfaceEl.offsetHeight;\n const children = this.items;\n const FULL_DURATION = 150;\n const SURFACE_OPACITY_DURATION = 50;\n // The surface fades away at the very end\n const SURFACE_OPACITY_DELAY = FULL_DURATION - SURFACE_OPACITY_DURATION;\n const ITEM_OPACITY_DURATION = 50;\n const ITEM_OPACITY_INITIAL_DELAY = 50;\n const END_HEIGHT_PERCENTAGE = .35;\n\n // We want to fit every child fade-out animation within the full duration of\n // the animation.\n const DELAY_BETWEEN_ITEMS =\n (FULL_DURATION - ITEM_OPACITY_INITIAL_DELAY - ITEM_OPACITY_DURATION) /\n children.length;\n\n // The mock has the animation shrink to 35%\n const surfaceHeightAnimation = surfaceEl.animate(\n [\n {height: `${height}px`},\n {height: `${height * END_HEIGHT_PERCENTAGE}px`}\n ],\n {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED_ACCELERATE,\n });\n\n // When we are closing downwards, we want to make sure the last item is\n // always in view, so we need to translate it upwards the opposite direction\n // of the height animation\n const downPositionCorrectionAnimation = slotEl.animate(\n [\n {transform: ''}, {\n transform: closingDownwards ?\n `translateY(-${height * (1 - END_HEIGHT_PERCENTAGE)}px)` :\n ''\n }\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED_ACCELERATE});\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 1}, {opacity: 0}],\n {duration: SURFACE_OPACITY_DURATION, delay: SURFACE_OPACITY_DELAY});\n\n const childrenAnimations: Array<[HTMLElement, Animation]> = [];\n\n for (let i = 0; i < children.length; i++) {\n // If the animation is closing upwards, then reverse the list of\n // children so that we animate in the opposite direction.\n const directionalIndex = closingDownwards ? i : children.length - 1 - i;\n const child = children[directionalIndex];\n const animation = child.animate([{opacity: 1}, {opacity: 0}], {\n duration: ITEM_OPACITY_DURATION,\n delay: ITEM_OPACITY_INITIAL_DELAY + DELAY_BETWEEN_ITEMS * i,\n });\n\n // Make sure the items stay hidden at the end of each child animation.\n // We clean this up at the end of the overall animation.\n animation.addEventListener('finish', () => {\n child.classList.toggle('hidden', true);\n });\n childrenAnimations.push([child, animation]);\n }\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n downPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n animation.cancel();\n child.classList.toggle('hidden', false);\n });\n reject();\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n childrenAnimations.forEach(([child]) => {\n child.classList.toggle('hidden', false);\n });\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('closed'));\n resolve(true);\n });\n\n return animationEnded;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n if (!isServer) {\n window.addEventListener('click', this.onWindowClick, {capture: true});\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (!isServer) {\n window.removeEventListener('click', this.onWindowClick, {capture: true});\n }\n }\n\n private readonly onWindowClick = (e: MouseEvent) => {\n if (!this.stayOpenOnOutsideClick && !e.composedPath().includes(this)) {\n this.open = false;\n }\n };\n\n private onCloseMenu() {\n this.close();\n }\n\n private onDeactivateItems(e: Event) {\n e.stopPropagation();\n const items = this.items;\n for (const item of items) {\n item.active = false;\n item.selected = false;\n }\n }\n\n private handleDeactivateTypeahead(e: DeactivateTypeaheadEvent) {\n // stopPropagation so that this does not deactivate any typeaheads in menus\n // nested above it e.g. md-sub-menu-item\n e.stopPropagation();\n this.typeaheadActive = false;\n }\n\n private handleActivateTypeahead(e: ActivateTypeaheadEvent) {\n // stopPropagation so that this does not activate any typeaheads in menus\n // nested above it e.g. md-sub-menu-item\n e.stopPropagation();\n this.typeaheadActive = true;\n }\n\n private handleStayOpenOnFocusout(e:Event) {\n e.stopPropagation();\n this.stayOpenOnFocusout = true;\n }\n\n private handleCloseOnFocusout(e:Event) {\n e.stopPropagation();\n this.stayOpenOnFocusout = false;\n }\n\n override focus() {\n this.listElement?.focus();\n }\n\n close() {\n this.open = false;\n this.items.forEach(item => {\n item.close?.();\n });\n }\n\n show() {\n this.open = true;\n }\n}\n"]}
1
+ {"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,yBAAyB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,qBAAqB,EAAE,MAAM,EAAC,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAmD,aAAa,EAAE,kBAAkB,EAAW,MAAM,aAAa,CAAC;AAC1H,OAAO,EAAS,yBAAyB,EAAwB,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAI7D;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAOjD;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,YAAiC,QAAQ;IAElE,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAmC,CAAC;IAE/D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IAED,IAAI,QAAQ,CAAC,UAAU,EAAE;QACvB,OAAO,iBAAiB,CAAC,QAAQ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,MAAM,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;qCAAa;AAOZ;IAAhD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;qCAAa;AAIP;IAArD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;0CAAkB;AAI3D;IAAX,QAAQ,EAAE;kCAAyB;AAMpC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAC,CAAC;4CACR;AAKP;IAAvC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CAAoC;AAKrC;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;wCAAoC;AAQzE;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAC,CAAC;oDACpC;AAQ/B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAC,CAAC;gDACnC;AAM3B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAC,CAAC;8CAClC;AAKzB;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CACO;AAErC;IAAR,KAAK,EAAE;6CAAgC;AAwKxC;IADC,YAAY,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;6CAS7B","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../list/list.js';\nimport '../../focus/focus-ring.js';\nimport '../../elevation/elevation.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {eventOptions, property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\n\nimport {ARIAMixinStrict, ARIARole} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {createAnimationSignal, EASING} from '../../internal/motion/animation.js';\nimport {List} from '../../list/lib/list.js';\n\nimport {ActivateTypeaheadEvent, DeactivateTypeaheadEvent, isClosableKey, isElementInSubtree, MenuItem} from './shared.js';\nimport {Corner, SurfacePositionController, SurfacePositionTarget} from './surfacePositionController.js';\nimport {TypeaheadController} from './typeaheadController.js';\n\nexport {Corner} from './surfacePositionController.js';\n\n/**\n * The default value for the typeahead buffer time in Milliseconds.\n */\nexport const DEFAULT_TYPEAHEAD_BUFFER_TIME = 200;\n\n/**\n * Element to focus on when menu is first opened.\n */\nexport type DefaultFocusState = 'NONE'|'LIST_ROOT'|'FIRST_ITEM'|'LAST_ITEM';\n\n/**\n * Gets the currently focused element on the page.\n *\n * @param activeDoc The document or shadowroot from which to start the search.\n * Defaults to `window.document`\n * @return Returns the currently deeply focused element or `null` if none.\n */\nfunction getFocusedElement(activeDoc: Document|ShadowRoot = document):\n HTMLElement|null {\n const activeEl = activeDoc.activeElement as HTMLElement | null;\n\n if (!activeEl) {\n return null;\n }\n\n if (activeEl.shadowRoot) {\n return getFocusedElement(activeEl.shadowRoot) ?? activeEl;\n }\n\n return activeEl;\n}\n\n/**\n * @fires opening Fired before the opening animation begins\n * @fires opened Fired once the menu is open, after any animations\n * @fires closing Fired before the closing animation begins\n * @fires closed Fired once the menu is closed, after any animations\n */\nexport abstract class Menu extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n @query('md-list') private readonly listElement!: List|null;\n @query('.menu') private readonly surfaceEl!: HTMLElement|null;\n @query('slot') private readonly slotEl!: HTMLSlotElement|null;\n\n /**\n * The element in which the menu should align to.\n */\n @property({attribute: false})\n anchor: HTMLElement&Partial<SurfacePositionTarget>|null = null;\n /**\n * Makes the element use `position:fixed` instead of `position:absolute`. In\n * most cases, the menu should position itself above most other\n * `position:absolute` or `position:fixed` elements when placed inside of\n * them. e.g. using a menu inside of an `md-dialog`.\n *\n * __NOTE__: Fixed menus will not scroll with the page and will be fixed to\n * the window instead.\n */\n @property({type: Boolean}) fixed = false;\n /**\n * Skips the opening and closing animations.\n */\n @property({type: Boolean}) quick = false;\n /**\n * Displays overflow content like a submenu.\n *\n * __NOTE__: This may cause adverse effects if you set\n * `md-menu {max-height:...}`\n * and have items overflowing items in the \"y\" direction.\n */\n @property({type: Boolean, attribute: 'has-overflow'}) hasOverflow = false;\n /**\n * Opens the menu and makes it visible. Alternative to the `.show()` and\n * `.close()` methods\n */\n @property({type: Boolean, reflect: true}) open = false;\n /**\n * Offsets the menu's inline alignment from the anchor by the given number in\n * pixels. This value is direction aware and will follow the LTR / RTL\n * direction.\n *\n * e.g. LTR: positive -> right, negative -> left\n * RTL: positive -> left, negative -> right\n */\n @property({type: Number, attribute: 'x-offset'}) xOffset = 0;\n /**\n * Offsets the menu's block alignment from the anchor by the given number in\n * pixels.\n *\n * e.g. positive -> down, negative -> up\n */\n @property({type: Number, attribute: 'y-offset'}) yOffset = 0;\n /**\n * The tabindex of the underlying list element.\n */\n @property({type: Number, attribute: 'list-tabindex'}) listTabIndex = 0;\n /**\n * The role of the underlying list element.\n */\n @property() type: ARIARole = 'menu';\n /**\n * The max time between the keystrokes of the typeahead menu behavior before\n * it clears the typeahead buffer.\n */\n @property({type: Number, attribute: 'typeahead-delay'})\n typeaheadDelay = DEFAULT_TYPEAHEAD_BUFFER_TIME;\n /**\n * The corner of the anchor which to align the menu in the standard logical\n * property style of <block>_<inline>.\n */\n @property({attribute: 'anchor-corner'}) anchorCorner: Corner = 'END_START';\n /**\n * The corner of the menu which to align the anchor in the standard logical\n * property style of <block>_<inline>.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = 'START_START';\n /**\n * Keeps the user clicks outside the menu.\n *\n * NOTE: clicking outside may still cause focusout to close the menu so see\n * `stayOpenOnFocusout`.\n */\n @property({type: Boolean, attribute: 'stay-open-on-outside-click'})\n stayOpenOnOutsideClick = false;\n /**\n * Keeps the menu open when focus leaves the menu's composed subtree.\n *\n * NOTE: Focusout behavior will stop propagation of the focusout event. Set\n * this property to true to opt-out of menu's focuout handling altogether.\n */\n @property({type: Boolean, attribute: 'stay-open-on-focusout'})\n stayOpenOnFocusout = false;\n /**\n * After closing, does not restore focus to the last focused element before\n * the menu was opened.\n */\n @property({type: Boolean, attribute: 'skip-restore-focus'})\n skipRestoreFocus = false;\n /**\n * The element that should be focused by default once opened.\n */\n @property({attribute: 'default-focus'})\n defaultFocus: DefaultFocusState = 'LIST_ROOT';\n\n @state() private typeaheadActive = true;\n\n private readonly openCloseAnimationSignal = createAnimationSignal();\n\n /**\n * Whether the menu is animating upwards or downwards when opening. This is\n * helpful for calculating some animation calculations.\n */\n private get openDirection(): 'UP'|'DOWN' {\n const menuCornerBlock = this.menuCorner.split('_')[0];\n return menuCornerBlock === 'START' ? 'DOWN' : 'UP';\n }\n\n /**\n * The element that was focused before the menu opened.\n */\n private lastFocusedElement: HTMLElement|null = null;\n\n /**\n * Handles typeahead navigation through the menu.\n */\n typeaheadController = new TypeaheadController(() => {\n return {\n getItems: () => this.items,\n typeaheadBufferTime: this.typeaheadDelay,\n active: this.typeaheadActive\n };\n });\n\n /**\n * Handles positioning the surface and aligning it to the anchor.\n */\n private readonly menuPositionController =\n new SurfacePositionController(this, () => {\n return {\n anchorCorner: this.anchorCorner,\n surfaceCorner: this.menuCorner,\n surfaceEl: this.surfaceEl,\n anchorEl: this.anchor,\n isTopLayer: this.fixed,\n isOpen: this.open,\n xOffset: this.xOffset,\n yOffset: this.yOffset,\n onOpen: this.onOpened,\n beforeClose: this.beforeClose,\n onClose: this.onClosed,\n };\n });\n\n /**\n * The menu items associated with this menu. The items must be `MenuItem`s and\n * have both the `md-menu-item` and `md-list-item` attributes.\n */\n get items(): MenuItem[] {\n const listElement = this.listElement;\n\n if (listElement) {\n return listElement.items.filter(el => el.hasAttribute('md-menu-item')) as\n MenuItem[];\n }\n\n return [];\n }\n\n protected override render() {\n return this.renderSurface();\n }\n\n /**\n * Renders the positionable surface element and its contents.\n */\n private renderSurface() {\n // TODO(b/274140618): elevation should be an underlay, not an overlay that\n // tints content\n return html`\n <div\n class=\"menu ${classMap(this.getSurfaceClasses())}\"\n style=${styleMap(this.menuPositionController.surfaceStyles)}\n @focusout=${this.handleFocusout}>\n ${this.renderElevation()}\n ${this.renderList()}\n ${this.renderFocusRing()}\n </div>\n `;\n }\n\n /**\n * Renders the List element and its items\n */\n private renderList() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <md-list\n id=\"list\"\n aria-label=${ariaLabel || nothing}\n type=${this.type}\n listTabIndex=${this.listTabIndex}\n @keydown=${this.handleListKeydown}>\n ${this.renderMenuItems()}\n </md-list>`;\n }\n\n /**\n * Renders the menu items' slot\n */\n private renderMenuItems() {\n return html`<slot\n @close-menu=${this.onCloseMenu}\n @deactivate-items=${this.onDeactivateItems}\n @deactivate-typeahead=${this.handleDeactivateTypeahead}\n @activate-typeahead=${this.handleActivateTypeahead}\n @stay-open-on-focusout=${this.handleStayOpenOnFocusout}\n @close-on-focusout=${this.handleCloseOnFocusout}></slot>`;\n }\n\n /**\n * Renders the elevation component.\n */\n private renderElevation() {\n return html`<md-elevation></md-elevation>`;\n }\n\n /**\n * Renders the focus ring component.\n */\n private renderFocusRing() {\n return html`<md-focus-ring for=\"list\"></md-focus-ring>`;\n }\n\n private getSurfaceClasses() {\n return {\n open: this.open,\n fixed: this.fixed,\n 'has-overflow': this.hasOverflow,\n };\n }\n\n private async handleFocusout(e: FocusEvent) {\n if (this.stayOpenOnFocusout) {\n return;\n }\n\n // Stop propagation to prevent nested menus from interfering with each other\n e.stopPropagation();\n\n if (e.relatedTarget) {\n // Don't close the menu if we are switching focus between menu,\n // md-menu-item, and md-list\n if (isElementInSubtree(e.relatedTarget, this)) {\n return;\n }\n }\n\n const oldRestoreFocus = this.skipRestoreFocus;\n // allow focus to continue to the next focused object rather than returning\n this.skipRestoreFocus = true;\n this.close();\n // await for close\n await this.updateComplete;\n // return to previous behavior\n this.skipRestoreFocus = oldRestoreFocus;\n }\n\n // Capture so that we can grab the event before it reaches the list item\n // istelf. Specifically useful for the case where typeahead encounters a space\n // and we don't want the menu item to close the menu.\n @eventOptions({capture: true})\n private handleListKeydown(e: KeyboardEvent) {\n if (e.target === this.listElement && !e.defaultPrevented &&\n isClosableKey(e.code)) {\n e.preventDefault();\n this.close();\n }\n\n this.typeaheadController.onKeydown(e);\n }\n\n /**\n * Saves the last focused element focuses the new element based on\n * `defaultFocus`, and animates open.\n */\n private readonly onOpened = () => {\n this.lastFocusedElement = getFocusedElement();\n\n if (!this.listElement) return;\n\n const items = this.listElement.items;\n const activeItemRecord = List.getActiveItem(items);\n\n if (activeItemRecord && this.defaultFocus !== 'NONE') {\n activeItemRecord.item.active = false;\n }\n\n switch (this.defaultFocus) {\n case 'FIRST_ITEM':\n const first = List.getFirstActivatableItem(items);\n if (first) {\n first.active = true;\n }\n break;\n case 'LAST_ITEM':\n const last = List.getLastActivatableItem(items);\n if (last) {\n last.active = true;\n }\n break;\n case 'LIST_ROOT':\n this.listElement?.focus();\n break;\n default:\n case 'NONE':\n // Do nothing.\n break;\n }\n\n if (this.quick) {\n this.dispatchEvent(new Event('opening'));\n this.dispatchEvent(new Event('opened'));\n } else {\n this.animateOpen();\n }\n };\n\n /**\n * Animates closed.\n */\n private readonly beforeClose = async () => {\n this.open = false;\n\n if (!this.skipRestoreFocus) {\n this.lastFocusedElement?.focus?.();\n }\n\n if (!this.quick) {\n await this.animateClose();\n }\n };\n\n /**\n * Focuses the last focused element.\n */\n private readonly onClosed = () => {\n if (this.quick) {\n this.dispatchEvent(new Event('closing'));\n this.dispatchEvent(new Event('closed'));\n }\n };\n\n /**\n * Performs the opening animation:\n *\n * https://direct.googleplex.com/#/spec/295000003+271060003\n */\n private animateOpen() {\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) return;\n\n const openDirection = this.openDirection;\n this.dispatchEvent(new Event('opening'));\n // needs to be imperative because we don't want to mix animation and Lit\n // render timing\n surfaceEl.classList.toggle('animating', true);\n\n const signal = this.openCloseAnimationSignal.start();\n const height = surfaceEl.offsetHeight;\n const openingUpwards = openDirection === 'UP';\n const children = this.items;\n const FULL_DURATION = 500;\n const SURFACE_OPACITY_DURATION = 50;\n const ITEM_OPACITY_DURATION = 250;\n // We want to fit every child fade-in animation within the full duration of\n // the animation.\n const DELAY_BETWEEN_ITEMS =\n (FULL_DURATION - ITEM_OPACITY_DURATION) / children.length;\n\n const surfaceHeightAnimation =\n surfaceEl.animate([{height: '0px'}, {height: `${height}px`}], {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED,\n });\n // When we are opening upwards, we want to make sure the last item is always\n // in view, so we need to translate it upwards the opposite direction of the\n // height animation\n const upPositionCorrectionAnimation = slotEl.animate(\n [\n {transform: openingUpwards ? `translateY(-${height}px)` : ''},\n {transform: ''}\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED});\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 0}, {opacity: 1}], SURFACE_OPACITY_DURATION);\n\n const childrenAnimations: Array<[HTMLElement, Animation]> = [];\n\n for (let i = 0; i < children.length; i++) {\n // If we are animating upwards, then reverse the children list.\n const directionalIndex = openingUpwards ? children.length - 1 - i : i;\n const child = children[directionalIndex];\n const animation = child.animate([{opacity: 0}, {opacity: 1}], {\n duration: ITEM_OPACITY_DURATION,\n delay: DELAY_BETWEEN_ITEMS * i,\n });\n\n // Make them all initially hidden and then clean up at the end of each\n // animation.\n child.classList.toggle('hidden', true);\n animation.addEventListener('finish', () => {\n child.classList.toggle('hidden', false);\n });\n\n childrenAnimations.push([child, animation]);\n }\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n upPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n child.classList.toggle('hidden', false);\n animation.cancel();\n });\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('opened'));\n });\n }\n\n /**\n * Performs the closing animation:\n *\n * https://direct.googleplex.com/#/spec/295000003+271060003\n */\n private animateClose() {\n let resolve!: (value: unknown) => void;\n let reject!: () => void;\n\n // This promise blocks the surface position controller from setting\n // display: none on the surface which will interfere with this animation.\n const animationEnded = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) {\n reject();\n return animationEnded;\n }\n\n const openDirection = this.openDirection;\n const closingDownwards = openDirection === 'UP';\n this.dispatchEvent(new Event('closing'));\n // needs to be imperative because we don't want to mix animation and Lit\n // render timing\n surfaceEl.classList.toggle('animating', true);\n const signal = this.openCloseAnimationSignal.start();\n const height = surfaceEl.offsetHeight;\n const children = this.items;\n const FULL_DURATION = 150;\n const SURFACE_OPACITY_DURATION = 50;\n // The surface fades away at the very end\n const SURFACE_OPACITY_DELAY = FULL_DURATION - SURFACE_OPACITY_DURATION;\n const ITEM_OPACITY_DURATION = 50;\n const ITEM_OPACITY_INITIAL_DELAY = 50;\n const END_HEIGHT_PERCENTAGE = .35;\n\n // We want to fit every child fade-out animation within the full duration of\n // the animation.\n const DELAY_BETWEEN_ITEMS =\n (FULL_DURATION - ITEM_OPACITY_INITIAL_DELAY - ITEM_OPACITY_DURATION) /\n children.length;\n\n // The mock has the animation shrink to 35%\n const surfaceHeightAnimation = surfaceEl.animate(\n [\n {height: `${height}px`},\n {height: `${height * END_HEIGHT_PERCENTAGE}px`}\n ],\n {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED_ACCELERATE,\n });\n\n // When we are closing downwards, we want to make sure the last item is\n // always in view, so we need to translate it upwards the opposite direction\n // of the height animation\n const downPositionCorrectionAnimation = slotEl.animate(\n [\n {transform: ''}, {\n transform: closingDownwards ?\n `translateY(-${height * (1 - END_HEIGHT_PERCENTAGE)}px)` :\n ''\n }\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED_ACCELERATE});\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 1}, {opacity: 0}],\n {duration: SURFACE_OPACITY_DURATION, delay: SURFACE_OPACITY_DELAY});\n\n const childrenAnimations: Array<[HTMLElement, Animation]> = [];\n\n for (let i = 0; i < children.length; i++) {\n // If the animation is closing upwards, then reverse the list of\n // children so that we animate in the opposite direction.\n const directionalIndex = closingDownwards ? i : children.length - 1 - i;\n const child = children[directionalIndex];\n const animation = child.animate([{opacity: 1}, {opacity: 0}], {\n duration: ITEM_OPACITY_DURATION,\n delay: ITEM_OPACITY_INITIAL_DELAY + DELAY_BETWEEN_ITEMS * i,\n });\n\n // Make sure the items stay hidden at the end of each child animation.\n // We clean this up at the end of the overall animation.\n animation.addEventListener('finish', () => {\n child.classList.toggle('hidden', true);\n });\n childrenAnimations.push([child, animation]);\n }\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n downPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n animation.cancel();\n child.classList.toggle('hidden', false);\n });\n reject();\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n childrenAnimations.forEach(([child]) => {\n child.classList.toggle('hidden', false);\n });\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('closed'));\n resolve(true);\n });\n\n return animationEnded;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n if (!isServer) {\n window.addEventListener('click', this.onWindowClick, {capture: true});\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (!isServer) {\n window.removeEventListener('click', this.onWindowClick, {capture: true});\n }\n }\n\n private readonly onWindowClick = (e: MouseEvent) => {\n if (!this.stayOpenOnOutsideClick && !e.composedPath().includes(this)) {\n this.open = false;\n }\n };\n\n private onCloseMenu() {\n this.close();\n }\n\n private onDeactivateItems(e: Event) {\n e.stopPropagation();\n const items = this.items;\n for (const item of items) {\n item.active = false;\n item.selected = false;\n }\n }\n\n private handleDeactivateTypeahead(e: DeactivateTypeaheadEvent) {\n // stopPropagation so that this does not deactivate any typeaheads in menus\n // nested above it e.g. md-sub-menu-item\n e.stopPropagation();\n this.typeaheadActive = false;\n }\n\n private handleActivateTypeahead(e: ActivateTypeaheadEvent) {\n // stopPropagation so that this does not activate any typeaheads in menus\n // nested above it e.g. md-sub-menu-item\n e.stopPropagation();\n this.typeaheadActive = true;\n }\n\n private handleStayOpenOnFocusout(e: Event) {\n e.stopPropagation();\n this.stayOpenOnFocusout = true;\n }\n\n private handleCloseOnFocusout(e: Event) {\n e.stopPropagation();\n this.stayOpenOnFocusout = false;\n }\n\n override focus() {\n this.listElement?.focus();\n }\n\n close() {\n this.open = false;\n this.items.forEach(item => {\n item.close?.();\n });\n }\n\n show() {\n this.open = true;\n }\n\n /**\n * Activates the next item in the menu. If at the end of the menu, the first\n * item will be activated.\n *\n * @return The activated menu item or `null` if there are no items.\n */\n activateNextItem() {\n return this.listElement?.activateNextItem() as MenuItem ?? null;\n }\n\n /**\n * Activates the previous item in the menu. If at the start of the menu, the\n * last item will be activated.\n *\n * @return The activated menu item or `null` if there are no items.\n */\n activatePreviousItem() {\n return this.listElement?.activatePreviousItem() as MenuItem ?? null;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@material/web",
3
- "version": "1.0.0-pre.11",
3
+ "version": "1.0.0-pre.13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -99,9 +99,10 @@
99
99
  ]
100
100
  },
101
101
  "build:sass": {
102
- "command": "sass --style=compressed --load-path=node_modules --load-path=node_modules/sass-true/sass $(ls -d */ | grep -v node_modules)",
102
+ "command": "sass --style=compressed --load-path=node_modules --load-path=node_modules/sass-true/sass $(ls -d */ | grep -vE 'node_modules|catalog')",
103
103
  "files": [
104
- "**/*.scss"
104
+ "**/*.scss",
105
+ "!catalog"
105
106
  ],
106
107
  "output": [
107
108
  "**/*.css",
@@ -125,4 +126,4 @@
125
126
  ]
126
127
  }
127
128
  }
128
- }
129
+ }
@@ -107,10 +107,9 @@ export class SingleSelectionController {
107
107
  sibling.tabIndex = -1;
108
108
  }
109
109
  }
110
- // The next sibling should be checked and focused.
111
- nextSibling.checked = true;
110
+ // The next sibling should be checked, focused and dispatch a change event
112
111
  nextSibling.removeAttribute('tabindex');
113
- nextSibling.focus();
112
+ nextSibling.click();
114
113
  break;
115
114
  }
116
115
  };
@@ -1 +1 @@
1
- {"version":3,"file":"single-selection-controller.js","sourceRoot":"","sources":["single-selection-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,yBAAyB;IAIpC,YAA6B,IAA4B;QAA5B,SAAI,GAAJ,IAAI,CAAwB;QAHjD,YAAO,GAAG,KAAK,CAAC;QAChB,SAAI,GAAoB,IAAI,CAAC;QAyCpB,kBAAa,GAAG,GAAG,EAAE;YACpC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC,CAAC;QAEe,mBAAc,GAAG,GAAG,EAAE;YACrC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC,CAAC;QAmDF;;;;WAIG;QACc,kBAAa,GAAG,CAAC,KAAoB,EAAE,EAAE;YACxD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,KAAK,WAAW,CAAC;YACzC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,SAAS,CAAC;YACrC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,KAAK,WAAW,CAAC;YACzC,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OAGG;IACK,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACvB,OAAO,EAAE,CAAC;SACX;QAED,OAAO,KAAK,CAAC,IAAI,CACb,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAyB,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC;IAC9E,CAAC;CAwEF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController} from 'lit';\n\n/**\n * An element that supports single-selection with `SingleSelectionController`.\n */\nexport interface SingleSelectionElement extends HTMLElement {\n /**\n * Whether or not the element is selected.\n */\n checked: boolean;\n}\n\n/**\n * A `ReactiveController` that provides root node-scoped single selection for\n * elements, similar to native `<input type=\"radio\">` selection.\n *\n * To use, elements should add the controller and call\n * `selectionController.handleCheckedChange()` in a getter/setter. This must\n * be synchronous to match native behavior.\n *\n * @example\n * const CHECKED = Symbol('checked');\n *\n * class MyToggle extends LitElement {\n * get checked() { return this[CHECKED]; }\n * set checked(checked: boolean) {\n * const oldValue = this.checked;\n * if (oldValue === checked) {\n * return;\n * }\n *\n * this[CHECKED] = checked;\n * this.selectionController.handleCheckedChange();\n * this.requestUpdate('checked', oldValue);\n * }\n *\n * [CHECKED] = false;\n *\n * private selectionController = new SingleSelectionController(this);\n *\n * constructor() {\n * super();\n * this.addController(this.selectionController);\n * }\n * }\n */\nexport class SingleSelectionController implements ReactiveController {\n private focused = false;\n private root: ParentNode|null = null;\n\n constructor(private readonly host: SingleSelectionElement) {}\n\n hostConnected() {\n this.root = this.host.getRootNode() as ParentNode;\n this.host.addEventListener('keydown', this.handleKeyDown);\n this.host.addEventListener('focusin', this.handleFocusIn);\n this.host.addEventListener('focusout', this.handleFocusOut);\n if (this.host.checked) {\n // Uncheck other siblings when attached if already checked. This mimics\n // native <input type=\"radio\"> behavior.\n this.uncheckSiblings();\n }\n\n // Update for the newly added host.\n this.updateTabIndices();\n }\n\n hostDisconnected() {\n this.host.removeEventListener('keydown', this.handleKeyDown);\n this.host.removeEventListener('focusin', this.handleFocusIn);\n this.host.removeEventListener('focusout', this.handleFocusOut);\n // Update for siblings that are still connected.\n this.updateTabIndices();\n this.root = null;\n }\n\n /**\n * Should be called whenever the host's `checked` property changes\n * synchronously.\n */\n handleCheckedChange() {\n if (!this.host.checked) {\n return;\n }\n\n this.uncheckSiblings();\n this.updateTabIndices();\n }\n\n private readonly handleFocusIn = () => {\n this.focused = true;\n this.updateTabIndices();\n };\n\n private readonly handleFocusOut = () => {\n this.focused = false;\n this.updateTabIndices();\n };\n\n private uncheckSiblings() {\n for (const sibling of this.getNamedSiblings()) {\n if (sibling !== this.host) {\n sibling.checked = false;\n }\n }\n }\n\n /**\n * Updates the `tabindex` of the host and its siblings.\n */\n private updateTabIndices() {\n // There are three tabindex states for a group of elements:\n // 1. If any are checked, that element is focusable.\n const siblings = this.getNamedSiblings();\n const checkedSibling = siblings.find(sibling => sibling.checked);\n // 2. If an element is focused, the others are no longer focusable.\n if (checkedSibling || this.focused) {\n const focusable = checkedSibling || this.host;\n focusable.removeAttribute('tabindex');\n\n for (const sibling of siblings) {\n if (sibling !== focusable) {\n sibling.tabIndex = -1;\n }\n }\n return;\n }\n\n // 3. If none are checked or focused, all are focusable.\n for (const sibling of siblings) {\n sibling.removeAttribute('tabindex');\n }\n }\n\n /**\n * Retrieves all siblings in the host element's root with the same `name`\n * attribute.\n */\n private getNamedSiblings() {\n const name = this.host.getAttribute('name');\n if (!name || !this.root) {\n return [];\n }\n\n return Array.from(\n this.root.querySelectorAll<SingleSelectionElement>(`[name=\"${name}\"]`));\n }\n\n /**\n * Handles arrow key events from the host. Using the arrow keys will\n * select and check the next or previous sibling with the host's\n * `name` attribute.\n */\n private readonly handleKeyDown = (event: KeyboardEvent) => {\n const isDown = event.key === 'ArrowDown';\n const isUp = event.key === 'ArrowUp';\n const isLeft = event.key === 'ArrowLeft';\n const isRight = event.key === 'ArrowRight';\n // Ignore non-arrow keys\n if (!isLeft && !isRight && !isDown && !isUp) {\n return;\n }\n\n // Don't try to select another sibling if there aren't any.\n const siblings = this.getNamedSiblings();\n if (!siblings.length) {\n return;\n }\n\n // Prevent default interactions on the element for arrow keys,\n // since this controller will introduce new behavior.\n event.preventDefault();\n\n // Check if moving forwards or backwards\n const isRtl = getComputedStyle(this.host).direction === 'rtl';\n const forwards = isRtl ? isLeft || isDown : isRight || isDown;\n\n const hostIndex = siblings.indexOf(this.host);\n let nextIndex = forwards ? hostIndex + 1 : hostIndex - 1;\n // Search for the next sibling that is not disabled to select.\n // If we return to the host index, there is nothing to select.\n while (nextIndex !== hostIndex) {\n if (nextIndex >= siblings.length) {\n // Return to start if moving past the last item.\n nextIndex = 0;\n } else if (nextIndex < 0) {\n // Go to end if moving before the first item.\n nextIndex = siblings.length - 1;\n }\n\n // Check if the next sibling is disabled. If so,\n // move the index and continue searching.\n const nextSibling = siblings[nextIndex];\n if (nextSibling.hasAttribute('disabled')) {\n if (forwards) {\n nextIndex++;\n } else {\n nextIndex--;\n }\n\n continue;\n }\n\n // Uncheck and remove focusability from other siblings.\n for (const sibling of siblings) {\n if (sibling !== nextSibling) {\n sibling.checked = false;\n sibling.tabIndex = -1;\n }\n }\n\n // The next sibling should be checked and focused.\n nextSibling.checked = true;\n nextSibling.removeAttribute('tabindex');\n nextSibling.focus();\n break;\n }\n };\n}\n"]}
1
+ {"version":3,"file":"single-selection-controller.js","sourceRoot":"","sources":["single-selection-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,yBAAyB;IAIpC,YAA6B,IAA4B;QAA5B,SAAI,GAAJ,IAAI,CAAwB;QAHjD,YAAO,GAAG,KAAK,CAAC;QAChB,SAAI,GAAoB,IAAI,CAAC;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AAC;QACjE,mEAAmE;QACnE,IAAI,cAAc,IAAI,IAAI,CAAC,OAAO,EAAE;YAClC,MAAM,SAAS,GAAG,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC;YAC9C,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YAEtC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC9B,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;iBACvB;aACF;YACD,OAAO;SACR;QAED,wDAAwD;QACxD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;SACrC;IACH,CAAC;IAED;;;OAGG;IACK,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACvB,OAAO,EAAE,CAAC;SACX;QAED,OAAO,KAAK,CAAC,IAAI,CACb,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAyB,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC;IAC9E,CAAC;CAuEF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController} from 'lit';\n\n/**\n * An element that supports single-selection with `SingleSelectionController`.\n */\nexport interface SingleSelectionElement extends HTMLElement {\n /**\n * Whether or not the element is selected.\n */\n checked: boolean;\n}\n\n/**\n * A `ReactiveController` that provides root node-scoped single selection for\n * elements, similar to native `<input type=\"radio\">` selection.\n *\n * To use, elements should add the controller and call\n * `selectionController.handleCheckedChange()` in a getter/setter. This must\n * be synchronous to match native behavior.\n *\n * @example\n * const CHECKED = Symbol('checked');\n *\n * class MyToggle extends LitElement {\n * get checked() { return this[CHECKED]; }\n * set checked(checked: boolean) {\n * const oldValue = this.checked;\n * if (oldValue === checked) {\n * return;\n * }\n *\n * this[CHECKED] = checked;\n * this.selectionController.handleCheckedChange();\n * this.requestUpdate('checked', oldValue);\n * }\n *\n * [CHECKED] = false;\n *\n * private selectionController = new SingleSelectionController(this);\n *\n * constructor() {\n * super();\n * this.addController(this.selectionController);\n * }\n * }\n */\nexport class SingleSelectionController implements ReactiveController {\n private focused = false;\n private root: ParentNode|null = null;\n\n constructor(private readonly host: SingleSelectionElement) {}\n\n hostConnected() {\n this.root = this.host.getRootNode() as ParentNode;\n this.host.addEventListener('keydown', this.handleKeyDown);\n this.host.addEventListener('focusin', this.handleFocusIn);\n this.host.addEventListener('focusout', this.handleFocusOut);\n if (this.host.checked) {\n // Uncheck other siblings when attached if already checked. This mimics\n // native <input type=\"radio\"> behavior.\n this.uncheckSiblings();\n }\n\n // Update for the newly added host.\n this.updateTabIndices();\n }\n\n hostDisconnected() {\n this.host.removeEventListener('keydown', this.handleKeyDown);\n this.host.removeEventListener('focusin', this.handleFocusIn);\n this.host.removeEventListener('focusout', this.handleFocusOut);\n // Update for siblings that are still connected.\n this.updateTabIndices();\n this.root = null;\n }\n\n /**\n * Should be called whenever the host's `checked` property changes\n * synchronously.\n */\n handleCheckedChange() {\n if (!this.host.checked) {\n return;\n }\n\n this.uncheckSiblings();\n this.updateTabIndices();\n }\n\n private readonly handleFocusIn = () => {\n this.focused = true;\n this.updateTabIndices();\n };\n\n private readonly handleFocusOut = () => {\n this.focused = false;\n this.updateTabIndices();\n };\n\n private uncheckSiblings() {\n for (const sibling of this.getNamedSiblings()) {\n if (sibling !== this.host) {\n sibling.checked = false;\n }\n }\n }\n\n /**\n * Updates the `tabindex` of the host and its siblings.\n */\n private updateTabIndices() {\n // There are three tabindex states for a group of elements:\n // 1. If any are checked, that element is focusable.\n const siblings = this.getNamedSiblings();\n const checkedSibling = siblings.find(sibling => sibling.checked);\n // 2. If an element is focused, the others are no longer focusable.\n if (checkedSibling || this.focused) {\n const focusable = checkedSibling || this.host;\n focusable.removeAttribute('tabindex');\n\n for (const sibling of siblings) {\n if (sibling !== focusable) {\n sibling.tabIndex = -1;\n }\n }\n return;\n }\n\n // 3. If none are checked or focused, all are focusable.\n for (const sibling of siblings) {\n sibling.removeAttribute('tabindex');\n }\n }\n\n /**\n * Retrieves all siblings in the host element's root with the same `name`\n * attribute.\n */\n private getNamedSiblings() {\n const name = this.host.getAttribute('name');\n if (!name || !this.root) {\n return [];\n }\n\n return Array.from(\n this.root.querySelectorAll<SingleSelectionElement>(`[name=\"${name}\"]`));\n }\n\n /**\n * Handles arrow key events from the host. Using the arrow keys will\n * select and check the next or previous sibling with the host's\n * `name` attribute.\n */\n private readonly handleKeyDown = (event: KeyboardEvent) => {\n const isDown = event.key === 'ArrowDown';\n const isUp = event.key === 'ArrowUp';\n const isLeft = event.key === 'ArrowLeft';\n const isRight = event.key === 'ArrowRight';\n // Ignore non-arrow keys\n if (!isLeft && !isRight && !isDown && !isUp) {\n return;\n }\n\n // Don't try to select another sibling if there aren't any.\n const siblings = this.getNamedSiblings();\n if (!siblings.length) {\n return;\n }\n\n // Prevent default interactions on the element for arrow keys,\n // since this controller will introduce new behavior.\n event.preventDefault();\n\n // Check if moving forwards or backwards\n const isRtl = getComputedStyle(this.host).direction === 'rtl';\n const forwards = isRtl ? isLeft || isDown : isRight || isDown;\n\n const hostIndex = siblings.indexOf(this.host);\n let nextIndex = forwards ? hostIndex + 1 : hostIndex - 1;\n // Search for the next sibling that is not disabled to select.\n // If we return to the host index, there is nothing to select.\n while (nextIndex !== hostIndex) {\n if (nextIndex >= siblings.length) {\n // Return to start if moving past the last item.\n nextIndex = 0;\n } else if (nextIndex < 0) {\n // Go to end if moving before the first item.\n nextIndex = siblings.length - 1;\n }\n\n // Check if the next sibling is disabled. If so,\n // move the index and continue searching.\n const nextSibling = siblings[nextIndex];\n if (nextSibling.hasAttribute('disabled')) {\n if (forwards) {\n nextIndex++;\n } else {\n nextIndex--;\n }\n\n continue;\n }\n\n // Uncheck and remove focusability from other siblings.\n for (const sibling of siblings) {\n if (sibling !== nextSibling) {\n sibling.checked = false;\n sibling.tabIndex = -1;\n }\n }\n\n // The next sibling should be checked, focused and dispatch a change event\n nextSibling.removeAttribute('tabindex');\n nextSibling.click();\n break;\n }\n };\n}\n"]}
package/select/harness.js CHANGED
@@ -40,7 +40,7 @@ export class SelectHarness extends Harness {
40
40
  if (!menu.open) {
41
41
  console.warn('Internal menu is not open. Try calling SelectHarness.prototype.click()');
42
42
  }
43
- this.getItems()[index].element.click();
43
+ (await this.getItems()[index].getInteractiveElement()).click();
44
44
  }
45
45
  }
46
46
  // Private class (not exported)
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACtC,QAAQ;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAC;IAClE,CAAC;IACD;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEQ,KAAK,CAAC,UAAU;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;QAC/E,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI;QACtB,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAE,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO,CAAC,IAAI,CACR,wEAAwE,CAAC,CAAC;SAC/E;QACD,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;CACF;AAED,+BAA+B;AAC/B,MAAM,mBAAoB,SAAQ,YAAY;IAC5C,4EAA4E;IACnE,qBAAqB;QAC5B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {FieldHarness} from '../field/harness.js';\nimport {Field} from '../field/lib/field.js';\nimport {Harness} from '../testing/harness.js';\n\nimport {Select} from './lib/select.js';\nimport {SelectOptionHarness} from './lib/selectoption/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class SelectHarness extends Harness<Select> {\n protected getField() {\n return this.element.renderRoot.querySelector('.field') as Field;\n }\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.getField();\n }\n\n override async startHover() {\n const field = await this.getField();\n const element = await (new SelectFieldHardness(field)).getInteractiveElement();\n this.simulateStartHover(element);\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.options.map((item) => new SelectOptionHarness(item));\n }\n\n async click(quick = true) {\n this.element.quick = quick;\n await this.element.updateComplete;\n const field = await this.getField();\n field.click();\n }\n\n async clickOption(index: number) {\n const menu = this.element.renderRoot.querySelector('md-menu')!;\n if (!menu.open) {\n console.warn(\n 'Internal menu is not open. Try calling SelectHarness.prototype.click()');\n }\n this.getItems()[index].element.click();\n }\n}\n\n// Private class (not exported)\nclass SelectFieldHardness extends FieldHarness {\n /* Expose so that we can call it from our internal code in SelectHarness. */\n override getInteractiveElement() {\n return super.getInteractiveElement();\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACtC,QAAQ;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAC;IAClE,CAAC;IACD;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEQ,KAAK,CAAC,UAAU;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,OAAO,GACT,MAAM,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;QACnE,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAC3B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAA8B,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI;QACtB,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAE,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO,CAAC,IAAI,CACR,wEAAwE,CAAC,CAAC;SAC/E;QACD,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACjE,CAAC;CACF;AAED,+BAA+B;AAC/B,MAAM,mBAAoB,SAAQ,YAAY;IAC5C,4EAA4E;IACnE,qBAAqB;QAC5B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {FieldHarness} from '../field/harness.js';\nimport {Field} from '../field/lib/field.js';\nimport {Harness} from '../testing/harness.js';\n\nimport {Select} from './lib/select.js';\nimport {SelectOptionHarness} from './lib/selectoption/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class SelectHarness extends Harness<Select> {\n protected getField() {\n return this.element.renderRoot.querySelector('.field') as Field;\n }\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.getField();\n }\n\n override async startHover() {\n const field = await this.getField();\n const element =\n await (new SelectFieldHardness(field)).getInteractiveElement();\n this.simulateStartHover(element);\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.options.map(\n (item) => new SelectOptionHarness(item as typeof item&LitElement));\n }\n\n async click(quick = true) {\n this.element.quick = quick;\n await this.element.updateComplete;\n const field = await this.getField();\n field.click();\n }\n\n async clickOption(index: number) {\n const menu = this.element.renderRoot.querySelector('md-menu')!;\n if (!menu.open) {\n console.warn(\n 'Internal menu is not open. Try calling SelectHarness.prototype.click()');\n }\n (await this.getItems()[index].getInteractiveElement()).click();\n }\n}\n\n// Private class (not exported)\nclass SelectFieldHardness extends FieldHarness {\n /* Expose so that we can call it from our internal code in SelectHarness. */\n override getInteractiveElement() {\n return super.getInteractiveElement();\n }\n}\n"]}
@@ -32,7 +32,8 @@
32
32
  .field,
33
33
  .select,
34
34
  md-menu {
35
- min-width: 100%;
35
+ min-width: inherit;
36
+ width: inherit;
36
37
  max-width: inherit;
37
38
  }
38
39