@material/web 1.4.2-nightly.d802f89.0 → 1.4.2-nightly.e1f9cbc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -216,6 +216,8 @@ export declare abstract class Menu extends LitElement {
216
216
  private readonly onWindowResize;
217
217
  connectedCallback(): void;
218
218
  disconnectedCallback(): void;
219
+ getBoundingClientRect(): DOMRect;
220
+ getClientRects(): DOMRectList;
219
221
  protected render(): import("lit-html").TemplateResult<1>;
220
222
  /**
221
223
  * Renders the positionable surface element and its contents.
@@ -501,6 +501,18 @@ export class Menu extends LitElement {
501
501
  super.disconnectedCallback();
502
502
  this.cleanUpGlobalEventListeners();
503
503
  }
504
+ getBoundingClientRect() {
505
+ if (!this.surfaceEl) {
506
+ return super.getBoundingClientRect();
507
+ }
508
+ return this.surfaceEl.getBoundingClientRect();
509
+ }
510
+ getClientRects() {
511
+ if (!this.surfaceEl) {
512
+ return super.getClientRects();
513
+ }
514
+ return this.surfaceEl.getClientRects();
515
+ }
504
516
  render() {
505
517
  return this.renderSurface();
506
518
  }
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,UAAU,EAAkB,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAC,MAAM,EAAE,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AACjF,OAAO,EACL,cAAc,EACd,aAAa,GACd,MAAM,wCAAwC,CAA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MAAM,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;qCAAa;AAM7D;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAC,CAAC;4CACR;AAS/C;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CACC;AAQF;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;wCAAyC;AAQ9E;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;AASzB;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CACU;AAQjD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAC,CAAC;8CAClC;AAEyB;IAAjD,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;uCAAqC;AAC3D;IAAhB,KAAK,EAAE;6CAAgC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\nimport '../../focus/md-focus-ring.js';\n\nimport {LitElement, PropertyValues, html, isServer, nothing} from 'lit';\nimport {property, query, queryAssignedElements, state} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\n\nimport {EASING, createAnimationSignal} from '../../internal/motion/animation.js';\nimport {\n ListController,\n NavigableKeys,\n} from '../../list/internal/list-controller.js';\nimport {\n getActiveItem,\n getFirstActivatableItem,\n getLastActivatableItem,\n} from '../../list/internal/list-navigation-helpers.js';\n\nimport {MenuItem} from './controllers/menuItemController.js';\nimport {\n ActivateTypeaheadEvent,\n DeactivateTypeaheadEvent,\n FocusState,\n isClosableKey,\n isElementInSubtree,\n} from './controllers/shared.js';\nimport {\n Corner,\n SurfacePositionController,\n SurfacePositionTarget,\n} from './controllers/surfacePositionController.js';\nimport {TypeaheadController} from './controllers/typeaheadController.js';\n\nexport {Corner} from './controllers/surfacePositionController.js';\n\n/**\n * The default value for the typeahead buffer time in Milliseconds.\n */\nexport const DEFAULT_TYPEAHEAD_BUFFER_TIME = 200;\n\nconst submenuNavKeys = new Set<string>([\n NavigableKeys.ArrowDown,\n NavigableKeys.ArrowUp,\n NavigableKeys.Home,\n NavigableKeys.End,\n]);\n\nconst menuNavKeys = new Set<string>([\n NavigableKeys.ArrowLeft,\n NavigableKeys.ArrowRight,\n ...submenuNavKeys,\n]);\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(\n activeDoc: Document | ShadowRoot = document,\n): HTMLElement | null {\n let activeEl = activeDoc.activeElement as HTMLElement | null;\n\n // Check for activeElement in the case that an element with a shadow root host\n // is currently focused.\n while (activeEl && activeEl?.shadowRoot?.activeElement) {\n activeEl = activeEl.shadowRoot.activeElement as HTMLElement | null;\n }\n\n return activeEl;\n}\n\n/**\n * @fires opening {Event} Fired before the opening animation begins\n * @fires opened {Event} Fired once the menu is open, after any animations\n * @fires closing {Event} Fired before the closing animation begins\n * @fires closed {Event} Fired once the menu is closed, after any animations\n */\nexport abstract class Menu extends LitElement {\n @query('.menu') private readonly surfaceEl!: HTMLElement | null;\n @query('slot') private readonly slotEl!: HTMLSlotElement | null;\n\n /**\n * The ID of the element in the same root node in which the menu should align\n * to. Overrides setting `anchorElement = elementReference`.\n *\n * __NOTE__: anchor or anchorElement must either be an HTMLElement or resolve\n * to an HTMLElement in order for menu to open.\n */\n @property() anchor = '';\n /**\n * Whether the positioning algorithm should calculate relative to the parent\n * of the anchor element (`absolute`), relative to the window (`fixed`), or\n * relative to the document (`document`). `popover` will use the popover API\n * to render the menu in the top-layer. If your browser does not support the\n * popover API, it will fall back to `fixed`.\n *\n * __Examples for `position = 'fixed'`:__\n *\n * - If there is no `position:relative` in the given parent tree and the\n * surface is `position:absolute`\n * - If the surface is `position:fixed`\n * - If the surface is in the \"top layer\"\n * - The anchor and the surface do not share a common `position:relative`\n * ancestor\n *\n * When using `positioning=fixed`, in most cases, the menu should position\n * itself above most other `position:absolute` or `position:fixed` elements\n * when placed inside of 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 * __Examples for `position = 'document'`:__\n *\n * - There is no parent that creates a relative positioning context e.g.\n * `position: relative`, `position: absolute`, `transform: translate(x, y)`,\n * etc.\n * - You put the effort into hoisting the menu to the top of the DOM like the\n * end of the `<body>` to render over everything or in a top-layer.\n * - You are reusing a single `md-menu` element that dynamically renders\n * content.\n *\n * __Examples for `position = 'popover'`:__\n *\n * - Your browser supports `popover`.\n * - Most cases. Once popover is in browsers, this will become the default.\n */\n @property() positioning: 'absolute' | 'fixed' | 'document' | 'popover' =\n 'absolute';\n /**\n * Skips the opening and closing animations.\n */\n @property({type: Boolean}) quick = false;\n /**\n * Displays overflow content like a submenu. Not required in most cases when\n * using `positioning=\"popover\"`.\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 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> e.g. `'end-start'`.\n *\n * NOTE: This value may not be respected by the menu positioning algorithm\n * if the menu would render outisde the viewport.\n */\n @property({attribute: 'anchor-corner'})\n anchorCorner: Corner = 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> e.g. `'start-start'`.\n *\n * NOTE: This value may not be respected by the menu positioning algorithm\n * if the menu would render outisde the viewport.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = 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 focusout 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 * NOTE: When setting default focus to 'LIST_ROOT', remember to change\n * `tabindex` to `0` and change md-menu's display to something other than\n * `display: contents` when necessary.\n */\n @property({attribute: 'default-focus'})\n defaultFocus: FocusState = FocusState.FIRST_ITEM;\n\n /**\n * Turns off navigation wrapping. By default, navigating past the end of the\n * menu items will wrap focus back to the beginning and vice versa. Use this\n * for ARIA patterns that do not wrap focus, like combobox.\n */\n @property({type: Boolean, attribute: 'no-navigation-wrap'})\n noNavigationWrap = false;\n\n @queryAssignedElements({flatten: true}) protected slotItems!: HTMLElement[];\n @state() private typeaheadActive = true;\n\n /**\n * Whether or not the current menu is a submenu and should not handle specific\n * navigation keys.\n *\n * @export\n */\n isSubmenu = false;\n\n /**\n * The event path of the last window pointerdown event.\n */\n private pointerPath: EventTarget[] = [];\n\n /**\n * Whether or not the menu is repositoining due to window / document resize\n */\n private isRepositioning = false;\n private readonly openCloseAnimationSignal = createAnimationSignal();\n\n private readonly listController = new ListController<MenuItem>({\n isItem: (maybeItem: HTMLElement): maybeItem is MenuItem => {\n return maybeItem.hasAttribute('md-menu-item');\n },\n getPossibleItems: () => this.slotItems,\n isRtl: () => getComputedStyle(this).direction === 'rtl',\n deactivateItem: (item: MenuItem) => {\n item.selected = false;\n item.tabIndex = -1;\n },\n activateItem: (item: MenuItem) => {\n item.selected = true;\n item.tabIndex = 0;\n },\n isNavigableKey: (key: string) => {\n if (!this.isSubmenu) {\n return menuNavKeys.has(key);\n }\n\n const isRtl = getComputedStyle(this).direction === 'rtl';\n // we want md-submenu to handle the submenu's left/right arrow exit\n // key so it can close the menu instead of navigate the list.\n // Therefore we need to include all keys but left/right arrow close\n // key\n const arrowOpen = isRtl\n ? NavigableKeys.ArrowLeft\n : NavigableKeys.ArrowRight;\n\n if (key === arrowOpen) {\n return true;\n }\n\n return submenuNavKeys.has(key);\n },\n wrapNavigation: () => !this.noNavigationWrap,\n });\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 private currentAnchorElement: HTMLElement | null = null;\n\n /**\n * The element which the menu should align to. If `anchor` is set to a\n * non-empty idref string, then `anchorEl` will resolve to the element with\n * the given id in the same root node. Otherwise, `null`.\n */\n get anchorElement(): (HTMLElement & Partial<SurfacePositionTarget>) | null {\n if (this.anchor) {\n return (this.getRootNode() as Document | ShadowRoot).querySelector(\n `#${this.anchor}`,\n );\n }\n\n return this.currentAnchorElement;\n }\n\n set anchorElement(\n element: (HTMLElement & Partial<SurfacePositionTarget>) | null,\n ) {\n this.currentAnchorElement = element;\n this.requestUpdate('anchorElement');\n }\n\n private readonly internals =\n // Cast needed for closure\n (this as HTMLElement).attachInternals();\n\n constructor() {\n super();\n if (!isServer) {\n this.internals.role = 'menu';\n this.addEventListener('keydown', this.handleKeydown);\n // Capture so that we can grab the event before it reaches the menu item\n // istelf. Specifically useful for the case where typeahead encounters a\n // space and we don't want the menu item to close the menu.\n this.addEventListener('keydown', this.captureKeydown, {capture: true});\n this.addEventListener('focusout', this.handleFocusout);\n }\n }\n\n /**\n * Handles positioning the surface and aligning it to the anchor as well as\n * keeping it in the viewport.\n */\n private readonly menuPositionController = new SurfacePositionController(\n this,\n () => {\n return {\n anchorCorner: this.anchorCorner,\n surfaceCorner: this.menuCorner,\n surfaceEl: this.surfaceEl,\n anchorEl: this.anchorElement,\n positioning:\n this.positioning === 'popover' ? 'document' : this.positioning,\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 // We can't resize components that have overflow like menus with\n // submenus because the overflow-y will show menu items / content\n // outside the bounds of the menu. Popover API fixes this because each\n // submenu is hoisted to the top-layer and are not considered overflow\n // content.\n repositionStrategy:\n this.hasOverflow && this.positioning !== 'popover'\n ? 'move'\n : 'resize',\n };\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 return this.listController.items;\n }\n\n protected override willUpdate(changed: PropertyValues<Menu>) {\n if (!changed.has('open')) {\n return;\n }\n\n if (this.open) {\n this.removeAttribute('aria-hidden');\n return;\n }\n\n this.setAttribute('aria-hidden', 'true');\n }\n\n override update(changed: PropertyValues<Menu>) {\n if (changed.has('open')) {\n if (this.open) {\n this.setUpGlobalEventListeners();\n } else {\n this.cleanUpGlobalEventListeners();\n }\n }\n\n // Firefox does not support popover. Fall-back to using fixed.\n if (\n changed.has('positioning') &&\n this.positioning === 'popover' &&\n // type required for Google JS conformance\n !(this as unknown as {showPopover?: () => void}).showPopover\n ) {\n this.positioning = 'fixed';\n }\n\n super.update(changed);\n }\n\n private readonly onWindowResize = () => {\n if (\n this.isRepositioning ||\n (this.positioning !== 'document' &&\n this.positioning !== 'fixed' &&\n this.positioning !== 'popover')\n ) {\n return;\n }\n this.isRepositioning = true;\n this.reposition();\n this.isRepositioning = false;\n };\n\n override connectedCallback() {\n super.connectedCallback();\n if (this.open) {\n this.setUpGlobalEventListeners();\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.cleanUpGlobalEventListeners();\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 return html`\n <div\n class=\"menu ${classMap(this.getSurfaceClasses())}\"\n style=${styleMap(this.menuPositionController.surfaceStyles)}\n popover=${this.positioning === 'popover' ? 'manual' : nothing}>\n ${this.renderElevation()}\n <div class=\"items\">\n <div class=\"item-padding\"> ${this.renderMenuItems()} </div>\n </div>\n </div>\n `;\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 @request-activation=${this.onRequestActivation}\n @deactivate-typeahead=${this.handleDeactivateTypeahead}\n @activate-typeahead=${this.handleActivateTypeahead}\n @stay-open-on-focusout=${this.handleStayOpenOnFocusout}\n @close-on-focusout=${this.handleCloseOnFocusout}\n @slotchange=${this.listController.onSlotchange}></slot>`;\n }\n\n /**\n * Renders the elevation component.\n */\n private renderElevation() {\n return html`<md-elevation part=\"elevation\"></md-elevation>`;\n }\n\n private getSurfaceClasses(): ClassInfo {\n return {\n open: this.open,\n fixed: this.positioning === 'fixed',\n 'has-overflow': this.hasOverflow,\n };\n }\n\n private readonly handleFocusout = async (event: FocusEvent) => {\n const anchorEl = this.anchorElement!;\n // Do not close if we focused out by clicking on the anchor element. We\n // can't assume anchor buttons can be the related target because of iOS does\n // not focus buttons.\n if (\n this.stayOpenOnFocusout ||\n !this.open ||\n this.pointerPath.includes(anchorEl)\n ) {\n return;\n }\n\n if (event.relatedTarget) {\n // Don't close the menu if we are switching focus between menu,\n // md-menu-item, and md-list or if the anchor was click focused, but check\n // if length of pointerPath is 0 because that means something was at least\n // clicked (shift+tab case).\n if (\n isElementInSubtree(event.relatedTarget, this) ||\n (this.pointerPath.length !== 0 &&\n isElementInSubtree(event.relatedTarget, anchorEl))\n ) {\n return;\n }\n } else if (this.pointerPath.includes(this)) {\n // If menu tabindex == -1 and the user clicks on the menu or a divider, we\n // want to keep the menu open.\n return;\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 private captureKeydown(event: KeyboardEvent) {\n if (\n event.target === this &&\n !event.defaultPrevented &&\n isClosableKey(event.code)\n ) {\n event.preventDefault();\n this.close();\n }\n\n this.typeaheadController.onKeydown(event);\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 = async () => {\n this.lastFocusedElement = getFocusedElement();\n\n const items = this.items;\n const activeItemRecord = getActiveItem(items);\n\n if (activeItemRecord && this.defaultFocus !== FocusState.NONE) {\n activeItemRecord.item.tabIndex = -1;\n }\n\n let animationAborted = !this.quick;\n\n if (this.quick) {\n this.dispatchEvent(new Event('opening'));\n } else {\n animationAborted = !!(await this.animateOpen());\n }\n\n // This must come after the opening animation or else it may focus one of\n // the items before the animation has begun and causes the list to slide\n // (block-padding-of-the-menu)px at the end of the animation\n switch (this.defaultFocus) {\n case FocusState.FIRST_ITEM:\n const first = getFirstActivatableItem(items);\n if (first) {\n first.tabIndex = 0;\n first.focus();\n await (first as LitElement & MenuItem).updateComplete;\n }\n break;\n case FocusState.LAST_ITEM:\n const last = getLastActivatableItem(items);\n if (last) {\n last.tabIndex = 0;\n last.focus();\n await (last as LitElement & MenuItem).updateComplete;\n }\n break;\n case FocusState.LIST_ROOT:\n this.focus();\n break;\n default:\n case FocusState.NONE:\n // Do nothing.\n break;\n }\n\n if (!animationAborted) {\n this.dispatchEvent(new Event('opened'));\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 * @return A promise that resolve to `true` if the animation was aborted,\n * `false` if it was not aborted.\n */\n private async animateOpen() {\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) return true;\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 = surfaceEl.animate(\n [{height: '0px'}, {height: `${height}px`}],\n {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED,\n },\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\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 0}, {opacity: 1}],\n SURFACE_OPACITY_DURATION,\n );\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('md-menu-hidden', true);\n animation.addEventListener('finish', () => {\n child.classList.toggle('md-menu-hidden', false);\n });\n\n childrenAnimations.push([child, animation]);\n }\n\n let resolveAnimation = (value: boolean) => {};\n const animationFinished = new Promise<boolean>((resolve) => {\n resolveAnimation = resolve;\n });\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n upPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n child.classList.toggle('md-menu-hidden', false);\n animation.cancel();\n });\n\n resolveAnimation(true);\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n this.openCloseAnimationSignal.finish();\n resolveAnimation(false);\n });\n\n return await animationFinished;\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 = 0.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\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 {\n transform: closingDownwards\n ? `translateY(-${height * (1 - END_HEIGHT_PERCENTAGE)}px)`\n : '',\n },\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED_ACCELERATE},\n );\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 1}, {opacity: 0}],\n {duration: SURFACE_OPACITY_DURATION, delay: SURFACE_OPACITY_DELAY},\n );\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('md-menu-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('md-menu-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('md-menu-hidden', false);\n });\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('closed'));\n resolve(true);\n });\n\n return animationEnded;\n }\n\n private handleKeydown(event: KeyboardEvent) {\n // At any key event, the pointer interaction is done so we need to clear our\n // cached pointerpath. This handles the case where the user clicks on the\n // anchor, and then hits shift+tab\n this.pointerPath = [];\n this.listController.handleKeydown(event);\n }\n\n private setUpGlobalEventListeners() {\n document.addEventListener('click', this.onDocumentClick, {capture: true});\n window.addEventListener('pointerdown', this.onWindowPointerdown);\n document.addEventListener('resize', this.onWindowResize, {passive: true});\n window.addEventListener('resize', this.onWindowResize, {passive: true});\n }\n\n private cleanUpGlobalEventListeners() {\n document.removeEventListener('click', this.onDocumentClick, {\n capture: true,\n });\n window.removeEventListener('pointerdown', this.onWindowPointerdown);\n document.removeEventListener('resize', this.onWindowResize);\n window.removeEventListener('resize', this.onWindowResize);\n }\n\n private readonly onWindowPointerdown = (event: PointerEvent) => {\n this.pointerPath = event.composedPath();\n };\n\n /**\n * We cannot listen to window click because Safari on iOS will not bubble a\n * click event on window if the item clicked is not a \"clickable\" item such as\n * <body>\n */\n private readonly onDocumentClick = (event: Event) => {\n if (!this.open) {\n return;\n }\n\n const path = event.composedPath();\n\n if (\n !this.stayOpenOnOutsideClick &&\n !path.includes(this) &&\n !path.includes(this.anchorElement!)\n ) {\n this.open = false;\n }\n };\n\n private onCloseMenu() {\n this.close();\n }\n\n private onDeactivateItems(event: Event) {\n event.stopPropagation();\n this.listController.onDeactivateItems();\n }\n\n private onRequestActivation(event: Event) {\n event.stopPropagation();\n this.listController.onRequestActivation(event);\n }\n\n private handleDeactivateTypeahead(event: DeactivateTypeaheadEvent) {\n // stopPropagation so that this does not deactivate any typeaheads in menus\n // nested above it e.g. md-sub-menu\n event.stopPropagation();\n this.typeaheadActive = false;\n }\n\n private handleActivateTypeahead(event: ActivateTypeaheadEvent) {\n // stopPropagation so that this does not activate any typeaheads in menus\n // nested above it e.g. md-sub-menu\n event.stopPropagation();\n this.typeaheadActive = true;\n }\n\n private handleStayOpenOnFocusout(event: Event) {\n event.stopPropagation();\n this.stayOpenOnFocusout = true;\n }\n\n private handleCloseOnFocusout(event: Event) {\n event.stopPropagation();\n this.stayOpenOnFocusout = false;\n }\n\n close() {\n this.open = false;\n const maybeSubmenu = this.slotItems as Array<\n HTMLElement & {close?: () => void}\n >;\n maybeSubmenu.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.listController.activateNextItem() ?? 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.listController.activatePreviousItem() ?? null;\n }\n\n /**\n * Repositions the menu if it is open.\n *\n * Useful for the case where document or window-positioned menus have their\n * anchors moved while open.\n */\n reposition() {\n if (this.open) {\n this.menuPositionController.position();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,UAAU,EAAkB,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAC,MAAM,EAAE,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AACjF,OAAO,EACL,cAAc,EACd,aAAa,GACd,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,gDAAgD,CAAC;AAGxD,OAAO,EAGL,UAAU,EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,MAAM,EACN,yBAAyB,GAE1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAC,MAAM,EAAC,MAAM,4CAA4C,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG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AAC,CAAC;qCAAa;AAM7D;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAC,CAAC;4CACR;AAS/C;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CACC;AAQF;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;wCAAyC;AAQ9E;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;AASzB;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CACU;AAQjD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAC,CAAC;8CAClC;AAEyB;IAAjD,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;uCAAqC;AAC3D;IAAhB,KAAK,EAAE;6CAAgC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\nimport '../../focus/md-focus-ring.js';\n\nimport {LitElement, PropertyValues, html, isServer, nothing} from 'lit';\nimport {property, query, queryAssignedElements, state} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\n\nimport {EASING, createAnimationSignal} from '../../internal/motion/animation.js';\nimport {\n ListController,\n NavigableKeys,\n} from '../../list/internal/list-controller.js';\nimport {\n getActiveItem,\n getFirstActivatableItem,\n getLastActivatableItem,\n} from '../../list/internal/list-navigation-helpers.js';\n\nimport {MenuItem} from './controllers/menuItemController.js';\nimport {\n ActivateTypeaheadEvent,\n DeactivateTypeaheadEvent,\n FocusState,\n isClosableKey,\n isElementInSubtree,\n} from './controllers/shared.js';\nimport {\n Corner,\n SurfacePositionController,\n SurfacePositionTarget,\n} from './controllers/surfacePositionController.js';\nimport {TypeaheadController} from './controllers/typeaheadController.js';\n\nexport {Corner} from './controllers/surfacePositionController.js';\n\n/**\n * The default value for the typeahead buffer time in Milliseconds.\n */\nexport const DEFAULT_TYPEAHEAD_BUFFER_TIME = 200;\n\nconst submenuNavKeys = new Set<string>([\n NavigableKeys.ArrowDown,\n NavigableKeys.ArrowUp,\n NavigableKeys.Home,\n NavigableKeys.End,\n]);\n\nconst menuNavKeys = new Set<string>([\n NavigableKeys.ArrowLeft,\n NavigableKeys.ArrowRight,\n ...submenuNavKeys,\n]);\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(\n activeDoc: Document | ShadowRoot = document,\n): HTMLElement | null {\n let activeEl = activeDoc.activeElement as HTMLElement | null;\n\n // Check for activeElement in the case that an element with a shadow root host\n // is currently focused.\n while (activeEl && activeEl?.shadowRoot?.activeElement) {\n activeEl = activeEl.shadowRoot.activeElement as HTMLElement | null;\n }\n\n return activeEl;\n}\n\n/**\n * @fires opening {Event} Fired before the opening animation begins\n * @fires opened {Event} Fired once the menu is open, after any animations\n * @fires closing {Event} Fired before the closing animation begins\n * @fires closed {Event} Fired once the menu is closed, after any animations\n */\nexport abstract class Menu extends LitElement {\n @query('.menu') private readonly surfaceEl!: HTMLElement | null;\n @query('slot') private readonly slotEl!: HTMLSlotElement | null;\n\n /**\n * The ID of the element in the same root node in which the menu should align\n * to. Overrides setting `anchorElement = elementReference`.\n *\n * __NOTE__: anchor or anchorElement must either be an HTMLElement or resolve\n * to an HTMLElement in order for menu to open.\n */\n @property() anchor = '';\n /**\n * Whether the positioning algorithm should calculate relative to the parent\n * of the anchor element (`absolute`), relative to the window (`fixed`), or\n * relative to the document (`document`). `popover` will use the popover API\n * to render the menu in the top-layer. If your browser does not support the\n * popover API, it will fall back to `fixed`.\n *\n * __Examples for `position = 'fixed'`:__\n *\n * - If there is no `position:relative` in the given parent tree and the\n * surface is `position:absolute`\n * - If the surface is `position:fixed`\n * - If the surface is in the \"top layer\"\n * - The anchor and the surface do not share a common `position:relative`\n * ancestor\n *\n * When using `positioning=fixed`, in most cases, the menu should position\n * itself above most other `position:absolute` or `position:fixed` elements\n * when placed inside of 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 * __Examples for `position = 'document'`:__\n *\n * - There is no parent that creates a relative positioning context e.g.\n * `position: relative`, `position: absolute`, `transform: translate(x, y)`,\n * etc.\n * - You put the effort into hoisting the menu to the top of the DOM like the\n * end of the `<body>` to render over everything or in a top-layer.\n * - You are reusing a single `md-menu` element that dynamically renders\n * content.\n *\n * __Examples for `position = 'popover'`:__\n *\n * - Your browser supports `popover`.\n * - Most cases. Once popover is in browsers, this will become the default.\n */\n @property() positioning: 'absolute' | 'fixed' | 'document' | 'popover' =\n 'absolute';\n /**\n * Skips the opening and closing animations.\n */\n @property({type: Boolean}) quick = false;\n /**\n * Displays overflow content like a submenu. Not required in most cases when\n * using `positioning=\"popover\"`.\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 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> e.g. `'end-start'`.\n *\n * NOTE: This value may not be respected by the menu positioning algorithm\n * if the menu would render outisde the viewport.\n */\n @property({attribute: 'anchor-corner'})\n anchorCorner: Corner = 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> e.g. `'start-start'`.\n *\n * NOTE: This value may not be respected by the menu positioning algorithm\n * if the menu would render outisde the viewport.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = 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 focusout 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 * NOTE: When setting default focus to 'LIST_ROOT', remember to change\n * `tabindex` to `0` and change md-menu's display to something other than\n * `display: contents` when necessary.\n */\n @property({attribute: 'default-focus'})\n defaultFocus: FocusState = FocusState.FIRST_ITEM;\n\n /**\n * Turns off navigation wrapping. By default, navigating past the end of the\n * menu items will wrap focus back to the beginning and vice versa. Use this\n * for ARIA patterns that do not wrap focus, like combobox.\n */\n @property({type: Boolean, attribute: 'no-navigation-wrap'})\n noNavigationWrap = false;\n\n @queryAssignedElements({flatten: true}) protected slotItems!: HTMLElement[];\n @state() private typeaheadActive = true;\n\n /**\n * Whether or not the current menu is a submenu and should not handle specific\n * navigation keys.\n *\n * @export\n */\n isSubmenu = false;\n\n /**\n * The event path of the last window pointerdown event.\n */\n private pointerPath: EventTarget[] = [];\n\n /**\n * Whether or not the menu is repositoining due to window / document resize\n */\n private isRepositioning = false;\n private readonly openCloseAnimationSignal = createAnimationSignal();\n\n private readonly listController = new ListController<MenuItem>({\n isItem: (maybeItem: HTMLElement): maybeItem is MenuItem => {\n return maybeItem.hasAttribute('md-menu-item');\n },\n getPossibleItems: () => this.slotItems,\n isRtl: () => getComputedStyle(this).direction === 'rtl',\n deactivateItem: (item: MenuItem) => {\n item.selected = false;\n item.tabIndex = -1;\n },\n activateItem: (item: MenuItem) => {\n item.selected = true;\n item.tabIndex = 0;\n },\n isNavigableKey: (key: string) => {\n if (!this.isSubmenu) {\n return menuNavKeys.has(key);\n }\n\n const isRtl = getComputedStyle(this).direction === 'rtl';\n // we want md-submenu to handle the submenu's left/right arrow exit\n // key so it can close the menu instead of navigate the list.\n // Therefore we need to include all keys but left/right arrow close\n // key\n const arrowOpen = isRtl\n ? NavigableKeys.ArrowLeft\n : NavigableKeys.ArrowRight;\n\n if (key === arrowOpen) {\n return true;\n }\n\n return submenuNavKeys.has(key);\n },\n wrapNavigation: () => !this.noNavigationWrap,\n });\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 private currentAnchorElement: HTMLElement | null = null;\n\n /**\n * The element which the menu should align to. If `anchor` is set to a\n * non-empty idref string, then `anchorEl` will resolve to the element with\n * the given id in the same root node. Otherwise, `null`.\n */\n get anchorElement(): (HTMLElement & Partial<SurfacePositionTarget>) | null {\n if (this.anchor) {\n return (this.getRootNode() as Document | ShadowRoot).querySelector(\n `#${this.anchor}`,\n );\n }\n\n return this.currentAnchorElement;\n }\n\n set anchorElement(\n element: (HTMLElement & Partial<SurfacePositionTarget>) | null,\n ) {\n this.currentAnchorElement = element;\n this.requestUpdate('anchorElement');\n }\n\n private readonly internals =\n // Cast needed for closure\n (this as HTMLElement).attachInternals();\n\n constructor() {\n super();\n if (!isServer) {\n this.internals.role = 'menu';\n this.addEventListener('keydown', this.handleKeydown);\n // Capture so that we can grab the event before it reaches the menu item\n // istelf. Specifically useful for the case where typeahead encounters a\n // space and we don't want the menu item to close the menu.\n this.addEventListener('keydown', this.captureKeydown, {capture: true});\n this.addEventListener('focusout', this.handleFocusout);\n }\n }\n\n /**\n * Handles positioning the surface and aligning it to the anchor as well as\n * keeping it in the viewport.\n */\n private readonly menuPositionController = new SurfacePositionController(\n this,\n () => {\n return {\n anchorCorner: this.anchorCorner,\n surfaceCorner: this.menuCorner,\n surfaceEl: this.surfaceEl,\n anchorEl: this.anchorElement,\n positioning:\n this.positioning === 'popover' ? 'document' : this.positioning,\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 // We can't resize components that have overflow like menus with\n // submenus because the overflow-y will show menu items / content\n // outside the bounds of the menu. Popover API fixes this because each\n // submenu is hoisted to the top-layer and are not considered overflow\n // content.\n repositionStrategy:\n this.hasOverflow && this.positioning !== 'popover'\n ? 'move'\n : 'resize',\n };\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 return this.listController.items;\n }\n\n protected override willUpdate(changed: PropertyValues<Menu>) {\n if (!changed.has('open')) {\n return;\n }\n\n if (this.open) {\n this.removeAttribute('aria-hidden');\n return;\n }\n\n this.setAttribute('aria-hidden', 'true');\n }\n\n override update(changed: PropertyValues<Menu>) {\n if (changed.has('open')) {\n if (this.open) {\n this.setUpGlobalEventListeners();\n } else {\n this.cleanUpGlobalEventListeners();\n }\n }\n\n // Firefox does not support popover. Fall-back to using fixed.\n if (\n changed.has('positioning') &&\n this.positioning === 'popover' &&\n // type required for Google JS conformance\n !(this as unknown as {showPopover?: () => void}).showPopover\n ) {\n this.positioning = 'fixed';\n }\n\n super.update(changed);\n }\n\n private readonly onWindowResize = () => {\n if (\n this.isRepositioning ||\n (this.positioning !== 'document' &&\n this.positioning !== 'fixed' &&\n this.positioning !== 'popover')\n ) {\n return;\n }\n this.isRepositioning = true;\n this.reposition();\n this.isRepositioning = false;\n };\n\n override connectedCallback() {\n super.connectedCallback();\n if (this.open) {\n this.setUpGlobalEventListeners();\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.cleanUpGlobalEventListeners();\n }\n\n override getBoundingClientRect() {\n if (!this.surfaceEl) {\n return super.getBoundingClientRect();\n }\n return this.surfaceEl.getBoundingClientRect();\n }\n\n override getClientRects() {\n if (!this.surfaceEl) {\n return super.getClientRects();\n }\n return this.surfaceEl.getClientRects();\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 return html`\n <div\n class=\"menu ${classMap(this.getSurfaceClasses())}\"\n style=${styleMap(this.menuPositionController.surfaceStyles)}\n popover=${this.positioning === 'popover' ? 'manual' : nothing}>\n ${this.renderElevation()}\n <div class=\"items\">\n <div class=\"item-padding\"> ${this.renderMenuItems()} </div>\n </div>\n </div>\n `;\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 @request-activation=${this.onRequestActivation}\n @deactivate-typeahead=${this.handleDeactivateTypeahead}\n @activate-typeahead=${this.handleActivateTypeahead}\n @stay-open-on-focusout=${this.handleStayOpenOnFocusout}\n @close-on-focusout=${this.handleCloseOnFocusout}\n @slotchange=${this.listController.onSlotchange}></slot>`;\n }\n\n /**\n * Renders the elevation component.\n */\n private renderElevation() {\n return html`<md-elevation part=\"elevation\"></md-elevation>`;\n }\n\n private getSurfaceClasses(): ClassInfo {\n return {\n open: this.open,\n fixed: this.positioning === 'fixed',\n 'has-overflow': this.hasOverflow,\n };\n }\n\n private readonly handleFocusout = async (event: FocusEvent) => {\n const anchorEl = this.anchorElement!;\n // Do not close if we focused out by clicking on the anchor element. We\n // can't assume anchor buttons can be the related target because of iOS does\n // not focus buttons.\n if (\n this.stayOpenOnFocusout ||\n !this.open ||\n this.pointerPath.includes(anchorEl)\n ) {\n return;\n }\n\n if (event.relatedTarget) {\n // Don't close the menu if we are switching focus between menu,\n // md-menu-item, and md-list or if the anchor was click focused, but check\n // if length of pointerPath is 0 because that means something was at least\n // clicked (shift+tab case).\n if (\n isElementInSubtree(event.relatedTarget, this) ||\n (this.pointerPath.length !== 0 &&\n isElementInSubtree(event.relatedTarget, anchorEl))\n ) {\n return;\n }\n } else if (this.pointerPath.includes(this)) {\n // If menu tabindex == -1 and the user clicks on the menu or a divider, we\n // want to keep the menu open.\n return;\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 private captureKeydown(event: KeyboardEvent) {\n if (\n event.target === this &&\n !event.defaultPrevented &&\n isClosableKey(event.code)\n ) {\n event.preventDefault();\n this.close();\n }\n\n this.typeaheadController.onKeydown(event);\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 = async () => {\n this.lastFocusedElement = getFocusedElement();\n\n const items = this.items;\n const activeItemRecord = getActiveItem(items);\n\n if (activeItemRecord && this.defaultFocus !== FocusState.NONE) {\n activeItemRecord.item.tabIndex = -1;\n }\n\n let animationAborted = !this.quick;\n\n if (this.quick) {\n this.dispatchEvent(new Event('opening'));\n } else {\n animationAborted = !!(await this.animateOpen());\n }\n\n // This must come after the opening animation or else it may focus one of\n // the items before the animation has begun and causes the list to slide\n // (block-padding-of-the-menu)px at the end of the animation\n switch (this.defaultFocus) {\n case FocusState.FIRST_ITEM:\n const first = getFirstActivatableItem(items);\n if (first) {\n first.tabIndex = 0;\n first.focus();\n await (first as LitElement & MenuItem).updateComplete;\n }\n break;\n case FocusState.LAST_ITEM:\n const last = getLastActivatableItem(items);\n if (last) {\n last.tabIndex = 0;\n last.focus();\n await (last as LitElement & MenuItem).updateComplete;\n }\n break;\n case FocusState.LIST_ROOT:\n this.focus();\n break;\n default:\n case FocusState.NONE:\n // Do nothing.\n break;\n }\n\n if (!animationAborted) {\n this.dispatchEvent(new Event('opened'));\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 * @return A promise that resolve to `true` if the animation was aborted,\n * `false` if it was not aborted.\n */\n private async animateOpen() {\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) return true;\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 = surfaceEl.animate(\n [{height: '0px'}, {height: `${height}px`}],\n {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED,\n },\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\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 0}, {opacity: 1}],\n SURFACE_OPACITY_DURATION,\n );\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('md-menu-hidden', true);\n animation.addEventListener('finish', () => {\n child.classList.toggle('md-menu-hidden', false);\n });\n\n childrenAnimations.push([child, animation]);\n }\n\n let resolveAnimation = (value: boolean) => {};\n const animationFinished = new Promise<boolean>((resolve) => {\n resolveAnimation = resolve;\n });\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n upPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n child.classList.toggle('md-menu-hidden', false);\n animation.cancel();\n });\n\n resolveAnimation(true);\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n this.openCloseAnimationSignal.finish();\n resolveAnimation(false);\n });\n\n return await animationFinished;\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 = 0.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\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 {\n transform: closingDownwards\n ? `translateY(-${height * (1 - END_HEIGHT_PERCENTAGE)}px)`\n : '',\n },\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED_ACCELERATE},\n );\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 1}, {opacity: 0}],\n {duration: SURFACE_OPACITY_DURATION, delay: SURFACE_OPACITY_DELAY},\n );\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('md-menu-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('md-menu-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('md-menu-hidden', false);\n });\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('closed'));\n resolve(true);\n });\n\n return animationEnded;\n }\n\n private handleKeydown(event: KeyboardEvent) {\n // At any key event, the pointer interaction is done so we need to clear our\n // cached pointerpath. This handles the case where the user clicks on the\n // anchor, and then hits shift+tab\n this.pointerPath = [];\n this.listController.handleKeydown(event);\n }\n\n private setUpGlobalEventListeners() {\n document.addEventListener('click', this.onDocumentClick, {capture: true});\n window.addEventListener('pointerdown', this.onWindowPointerdown);\n document.addEventListener('resize', this.onWindowResize, {passive: true});\n window.addEventListener('resize', this.onWindowResize, {passive: true});\n }\n\n private cleanUpGlobalEventListeners() {\n document.removeEventListener('click', this.onDocumentClick, {\n capture: true,\n });\n window.removeEventListener('pointerdown', this.onWindowPointerdown);\n document.removeEventListener('resize', this.onWindowResize);\n window.removeEventListener('resize', this.onWindowResize);\n }\n\n private readonly onWindowPointerdown = (event: PointerEvent) => {\n this.pointerPath = event.composedPath();\n };\n\n /**\n * We cannot listen to window click because Safari on iOS will not bubble a\n * click event on window if the item clicked is not a \"clickable\" item such as\n * <body>\n */\n private readonly onDocumentClick = (event: Event) => {\n if (!this.open) {\n return;\n }\n\n const path = event.composedPath();\n\n if (\n !this.stayOpenOnOutsideClick &&\n !path.includes(this) &&\n !path.includes(this.anchorElement!)\n ) {\n this.open = false;\n }\n };\n\n private onCloseMenu() {\n this.close();\n }\n\n private onDeactivateItems(event: Event) {\n event.stopPropagation();\n this.listController.onDeactivateItems();\n }\n\n private onRequestActivation(event: Event) {\n event.stopPropagation();\n this.listController.onRequestActivation(event);\n }\n\n private handleDeactivateTypeahead(event: DeactivateTypeaheadEvent) {\n // stopPropagation so that this does not deactivate any typeaheads in menus\n // nested above it e.g. md-sub-menu\n event.stopPropagation();\n this.typeaheadActive = false;\n }\n\n private handleActivateTypeahead(event: ActivateTypeaheadEvent) {\n // stopPropagation so that this does not activate any typeaheads in menus\n // nested above it e.g. md-sub-menu\n event.stopPropagation();\n this.typeaheadActive = true;\n }\n\n private handleStayOpenOnFocusout(event: Event) {\n event.stopPropagation();\n this.stayOpenOnFocusout = true;\n }\n\n private handleCloseOnFocusout(event: Event) {\n event.stopPropagation();\n this.stayOpenOnFocusout = false;\n }\n\n close() {\n this.open = false;\n const maybeSubmenu = this.slotItems as Array<\n HTMLElement & {close?: () => void}\n >;\n maybeSubmenu.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.listController.activateNextItem() ?? 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.listController.activatePreviousItem() ?? null;\n }\n\n /**\n * Repositions the menu if it is open.\n *\n * Useful for the case where document or window-positioned menus have their\n * anchors moved while open.\n */\n reposition() {\n if (this.open) {\n this.menuPositionController.position();\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@material/web",
3
- "version": "1.4.2-nightly.d802f89.0",
3
+ "version": "1.4.2-nightly.e1f9cbc.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -445,6 +445,7 @@ export class TextField extends textFieldBaseClass {
445
445
  aria-invalid=${this.hasError}
446
446
  aria-label=${ariaLabel}
447
447
  autocomplete=${autocomplete || nothing}
448
+ name=${this.name || nothing}
448
449
  ?disabled=${this.disabled}
449
450
  maxlength=${hasMaxLength ? this.maxLength : nothing}
450
451
  minlength=${hasMinLength ? this.minLength : nothing}
@@ -477,6 +478,7 @@ export class TextField extends textFieldBaseClass {
477
478
  aria-invalid=${this.hasError}
478
479
  aria-label=${ariaLabel}
479
480
  autocomplete=${autocomplete || nothing}
481
+ name=${this.name || nothing}
480
482
  ?disabled=${this.disabled}
481
483
  inputmode=${inputMode || nothing}
482
484
  max=${(this.max || nothing)}
@@ -1 +1 @@
1
- {"version":3,"file":"text-field.js","sourceRoot":"","sources":["text-field.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,UAAU,EAAkB,IAAI,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAC9D,OAAO,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,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;2CAAkB;AAOjB;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;2CAAkB;AAsC/C;IAAX,QAAQ,EAAE;uCAAW;AAsBtB;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;uCAC8B;AAQ7B;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;+CAAmB;AAkD5B;IAAhB,KAAK,EAAE;wCAAuB;AACd;IAAhB,KAAK,EAAE;0CAAyB;AAIhB;IAAhB,KAAK,EAAE;8CAA6B;AAKpB;IAAhB,KAAK,EAAE;kDAA8B;AAOrB;IADhB,KAAK,CAAC,QAAQ,CAAC;kDAIP;AACyB;IAAjC,KAAK,CAAC,QAAQ,CAAC;wCAAuC;AAEtC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,cAAc,EAAC,CAAC;+CACJ;AAEzB;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,eAAe,EAAC,CAAC;gDACJ","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement, PropertyValues, html, nothing} from 'lit';\nimport {property, query, queryAssignedElements, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {live} from 'lit/directives/live.js';\nimport {StyleInfo, styleMap} from 'lit/directives/style-map.js';\nimport {StaticValue, html as staticHtml} from 'lit/static-html.js';\n\nimport {Field} from '../../field/internal/field.js';\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {stringConverter} from '../../internal/controller/string-converter.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '../../labs/behaviors/constraint-validation.js';\nimport {mixinElementInternals} from '../../labs/behaviors/element-internals.js';\nimport {\n getFormValue,\n mixinFormAssociated,\n} from '../../labs/behaviors/form-associated.js';\nimport {\n mixinOnReportValidity,\n onReportValidity,\n} from '../../labs/behaviors/on-report-validity.js';\nimport {TextFieldValidator} from '../../labs/behaviors/validators/text-field-validator.js';\nimport {Validator} from '../../labs/behaviors/validators/validator.js';\n\n/**\n * Input types that are compatible with the text field.\n */\nexport type TextFieldType =\n | 'email'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'url'\n | 'textarea';\n\n/**\n * Input types that are not fully supported for the text field.\n */\nexport type UnsupportedTextFieldType =\n | 'color'\n | 'date'\n | 'datetime-local'\n | 'file'\n | 'month'\n | 'time'\n | 'week';\n\n/**\n * Input types that are incompatible with the text field.\n */\nexport type InvalidTextFieldType =\n | 'button'\n | 'checkbox'\n | 'hidden'\n | 'image'\n | 'radio'\n | 'range'\n | 'reset'\n | 'submit';\n\n// Separate variable needed for closure.\nconst textFieldBaseClass = mixinOnReportValidity(\n mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n ),\n);\n\n/**\n * A text field component.\n *\n * @fires select {Event} The native `select` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select_event)\n * --bubbles\n * @fires change {Event} The native `change` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)\n * --bubbles\n * @fires input {InputEvent} The native `input` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)\n * --bubbles --composed\n */\nexport abstract class TextField extends textFieldBaseClass {\n static {\n requestUpdateOnAriaChange(TextField);\n }\n\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Gets or sets whether or not the text field is in a visually invalid state.\n *\n * This error state overrides the error state controlled by\n * `reportValidity()`.\n */\n @property({type: Boolean, reflect: true}) error = false;\n\n /**\n * The error message that replaces supporting text when `error` is true. If\n * `errorText` is an empty string, then the supporting text will continue to\n * show.\n *\n * This error message overrides the error message displayed by\n * `reportValidity()`.\n */\n @property({attribute: 'error-text'}) errorText = '';\n\n /**\n * The floating Material label of the textfield component. It informs the user\n * about what information is requested for a text field. It is aligned with\n * the input text, is always visible, and it floats when focused or when text\n * is entered into the textfield. This label also sets accessibilty labels,\n * but the accessible label is overriden by `aria-label`.\n *\n * Learn more about floating labels from the Material Design guidelines:\n * https://m3.material.io/components/text-fields/guidelines\n */\n @property() label = '';\n\n /**\n * Indicates that the user must specify a value for the input before the\n * owning form can be submitted and will render an error state when\n * `reportValidity()` is invoked when value is empty. Additionally the\n * floating label will render an asterisk `\"*\"` when true.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required\n */\n @property({type: Boolean, reflect: true}) required = false;\n\n /**\n * The current value of the text field. It is always a string.\n */\n @property() value = '';\n\n /**\n * An optional prefix to display before the input value.\n */\n @property({attribute: 'prefix-text'}) prefixText = '';\n\n /**\n * An optional suffix to display after the input value.\n */\n @property({attribute: 'suffix-text'}) suffixText = '';\n\n /**\n * Whether or not the text field has a leading icon. Used for SSR.\n */\n @property({type: Boolean, attribute: 'has-leading-icon'})\n hasLeadingIcon = false;\n\n /**\n * Whether or not the text field has a trailing icon. Used for SSR.\n */\n @property({type: Boolean, attribute: 'has-trailing-icon'})\n hasTrailingIcon = false;\n\n /**\n * Conveys additional information below the text field, such as how it should\n * be used.\n */\n @property({attribute: 'supporting-text'}) supportingText = '';\n\n /**\n * Override the input text CSS `direction`. Useful for RTL languages that use\n * LTR notation for fractions.\n */\n @property({attribute: 'text-direction'}) textDirection = '';\n\n /**\n * The number of rows to display for a `type=\"textarea\"` text field.\n * Defaults to 2.\n */\n @property({type: Number}) rows = 2;\n\n /**\n * The number of cols to display for a `type=\"textarea\"` text field.\n * Defaults to 20.\n */\n @property({type: Number}) cols = 20;\n\n // <input> properties\n @property({reflect: true}) override inputMode = '';\n\n /**\n * Defines the greatest value in the range of permitted values.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max\n */\n @property() max = '';\n\n /**\n * The maximum number of characters a user can enter into the text field. Set\n * to -1 for none.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength\n */\n @property({type: Number}) maxLength = -1;\n\n /**\n * Defines the most negative value in the range of permitted values.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min\n */\n @property() min = '';\n\n /**\n * The minimum number of characters a user can enter into the text field. Set\n * to -1 for none.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength\n */\n @property({type: Number}) minLength = -1;\n\n /**\n * When true, hide the spinner for `type=\"number\"` text fields.\n */\n @property({type: Boolean, attribute: 'no-spinner'}) noSpinner = false;\n\n /**\n * A regular expression that the text field's value must match to pass\n * constraint validation.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern\n */\n @property() pattern = '';\n\n /**\n * Defines the text displayed in the textfield when it has no value. Provides\n * a brief hint to the user as to the expected type of data that should be\n * entered into the control. Unlike `label`, the placeholder is not visible\n * and does not float when the textfield has a value.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholder\n */\n @property({reflect: true, converter: stringConverter}) placeholder = '';\n\n /**\n * Indicates whether or not a user should be able to edit the text field's\n * value.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly\n */\n @property({type: Boolean, reflect: true}) readOnly = false;\n\n /**\n * Indicates that input accepts multiple email addresses.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#multiple\n */\n @property({type: Boolean, reflect: true}) multiple = false;\n\n /**\n * Gets or sets the direction in which selection occurred.\n */\n get selectionDirection() {\n return this.getInputOrTextarea().selectionDirection;\n }\n set selectionDirection(value: 'forward' | 'backward' | 'none' | null) {\n this.getInputOrTextarea().selectionDirection = value;\n }\n\n /**\n * Gets or sets the end position or offset of a text selection.\n */\n get selectionEnd() {\n return this.getInputOrTextarea().selectionEnd;\n }\n set selectionEnd(value: number | null) {\n this.getInputOrTextarea().selectionEnd = value;\n }\n\n /**\n * Gets or sets the starting position or offset of a text selection.\n */\n get selectionStart() {\n return this.getInputOrTextarea().selectionStart;\n }\n set selectionStart(value: number | null) {\n this.getInputOrTextarea().selectionStart = value;\n }\n\n /**\n * Returns or sets the element's step attribute, which works with min and max\n * to limit the increments at which a numeric or date-time value can be set.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step\n */\n @property() step = '';\n\n /**\n * The `<input>` type to use, defaults to \"text\". The type greatly changes how\n * the text field behaves.\n *\n * Text fields support a limited number of `<input>` types:\n *\n * - text\n * - textarea\n * - email\n * - number\n * - password\n * - search\n * - tel\n * - url\n *\n * See\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n * for more details on each input type.\n */\n @property({reflect: true})\n type: TextFieldType | UnsupportedTextFieldType = 'text';\n\n /**\n * Describes what, if any, type of autocomplete functionality the input\n * should provide.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\n */\n @property({reflect: true}) autocomplete = '';\n\n /**\n * The text field's value as a number.\n */\n get valueAsNumber() {\n const input = this.getInput();\n if (!input) {\n return NaN;\n }\n\n return input.valueAsNumber;\n }\n set valueAsNumber(value: number) {\n const input = this.getInput();\n if (!input) {\n return;\n }\n\n input.valueAsNumber = value;\n this.value = input.value;\n }\n\n /**\n * The text field's value as a Date.\n */\n get valueAsDate() {\n const input = this.getInput();\n if (!input) {\n return null;\n }\n\n return input.valueAsDate;\n }\n set valueAsDate(value: Date | null) {\n const input = this.getInput();\n if (!input) {\n return;\n }\n\n input.valueAsDate = value;\n this.value = input.value;\n }\n\n protected abstract readonly fieldTag: StaticValue;\n\n /**\n * Returns true when the text field has been interacted with. Native\n * validation errors only display in response to user interactions.\n */\n @state() private dirty = false;\n @state() private focused = false;\n /**\n * Whether or not a native error has been reported via `reportValidity()`.\n */\n @state() private nativeError = false;\n /**\n * The validation message displayed from a native error via\n * `reportValidity()`.\n */\n @state() private nativeErrorText = '';\n\n private get hasError() {\n return this.error || this.nativeError;\n }\n\n @query('.input')\n private readonly inputOrTextarea!:\n | HTMLInputElement\n | HTMLTextAreaElement\n | null;\n @query('.field') private readonly field!: Field | null;\n @queryAssignedElements({slot: 'leading-icon'})\n private readonly leadingIcons!: Element[];\n @queryAssignedElements({slot: 'trailing-icon'})\n private readonly trailingIcons!: Element[];\n\n /**\n * Selects all the text in the text field.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select\n */\n select() {\n this.getInputOrTextarea().select();\n }\n\n /**\n * Replaces a range of text with a new string.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setRangeText\n */\n setRangeText(replacement: string): void;\n setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectionMode?: SelectionMode,\n ): void;\n setRangeText(...args: unknown[]) {\n // Calling setRangeText with 1 vs 3-4 arguments has different behavior.\n // Use spread syntax and type casting to ensure correct usage.\n this.getInputOrTextarea().setRangeText(\n ...(args as Parameters<HTMLInputElement['setRangeText']>),\n );\n this.value = this.getInputOrTextarea().value;\n }\n\n /**\n * Sets the start and end positions of a selection in the text field.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange\n *\n * @param start The offset into the text field for the start of the selection.\n * @param end The offset into the text field for the end of the selection.\n * @param direction The direction in which the selection is performed.\n */\n setSelectionRange(\n start: number | null,\n end: number | null,\n direction?: 'forward' | 'backward' | 'none',\n ) {\n this.getInputOrTextarea().setSelectionRange(start, end, direction);\n }\n\n /**\n * Decrements the value of a numeric type text field by `step` or `n` `step`\n * number of times.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/stepDown\n *\n * @param stepDecrement The number of steps to decrement, defaults to 1.\n */\n stepDown(stepDecrement?: number) {\n const input = this.getInput();\n if (!input) {\n return;\n }\n\n input.stepDown(stepDecrement);\n this.value = input.value;\n }\n\n /**\n * Increments the value of a numeric type text field by `step` or `n` `step`\n * number of times.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/stepUp\n *\n * @param stepIncrement The number of steps to increment, defaults to 1.\n */\n stepUp(stepIncrement?: number) {\n const input = this.getInput();\n if (!input) {\n return;\n }\n\n input.stepUp(stepIncrement);\n this.value = input.value;\n }\n\n /**\n * Reset the text field to its default value.\n */\n reset() {\n this.dirty = false;\n this.value = this.getAttribute('value') ?? '';\n this.nativeError = false;\n this.nativeErrorText = '';\n }\n\n override attributeChangedCallback(\n attribute: string,\n newValue: string | null,\n oldValue: string | null,\n ) {\n if (attribute === 'value' && this.dirty) {\n // After user input, changing the value attribute no longer updates the\n // text field's value (until reset). This matches native <input> behavior.\n return;\n }\n\n super.attributeChangedCallback(attribute, newValue, oldValue);\n }\n\n protected override render() {\n const classes = {\n 'disabled': this.disabled,\n 'error': !this.disabled && this.hasError,\n 'textarea': this.type === 'textarea',\n 'no-spinner': this.noSpinner,\n };\n\n return html`\n <span class=\"text-field ${classMap(classes)}\">\n ${this.renderField()}\n </span>\n `;\n }\n\n protected override updated(changedProperties: PropertyValues) {\n // Keep changedProperties arg so that subclasses may call it\n\n // If a property such as `type` changes and causes the internal <input>\n // value to change without dispatching an event, re-sync it.\n const value = this.getInputOrTextarea().value;\n if (this.value !== value) {\n // Note this is typically inefficient in updated() since it schedules\n // another update. However, it is needed for the <input> to fully render\n // before checking its value.\n this.value = value;\n }\n }\n\n private renderField() {\n return staticHtml`<${this.fieldTag}\n class=\"field\"\n count=${this.value.length}\n ?disabled=${this.disabled}\n ?error=${this.hasError}\n error-text=${this.getErrorText()}\n ?focused=${this.focused}\n ?has-end=${this.hasTrailingIcon}\n ?has-start=${this.hasLeadingIcon}\n label=${this.label}\n max=${this.maxLength}\n ?populated=${!!this.value}\n ?required=${this.required}\n ?resizable=${this.type === 'textarea'}\n supporting-text=${this.supportingText}\n >\n ${this.renderLeadingIcon()}\n ${this.renderInputOrTextarea()}\n ${this.renderTrailingIcon()}\n <div id=\"description\" slot=\"aria-describedby\"></div>\n </${this.fieldTag}>`;\n }\n\n private renderLeadingIcon() {\n return html`\n <span class=\"icon leading\" slot=\"start\">\n <slot name=\"leading-icon\" @slotchange=${this.handleIconChange}></slot>\n </span>\n `;\n }\n\n private renderTrailingIcon() {\n return html`\n <span class=\"icon trailing\" slot=\"end\">\n <slot name=\"trailing-icon\" @slotchange=${this.handleIconChange}></slot>\n </span>\n `;\n }\n\n private renderInputOrTextarea() {\n const style: StyleInfo = {'direction': this.textDirection};\n const ariaLabel =\n (this as ARIAMixinStrict).ariaLabel || this.label || nothing;\n // lit-anaylzer `autocomplete` types are too strict\n // tslint:disable-next-line:no-any\n const autocomplete = this.autocomplete as any;\n\n // These properties may be set to null if the attribute is removed, and\n // `null > -1` is incorrectly `true`.\n const hasMaxLength = (this.maxLength ?? -1) > -1;\n const hasMinLength = (this.minLength ?? -1) > -1;\n if (this.type === 'textarea') {\n return html`\n <textarea\n class=\"input\"\n style=${styleMap(style)}\n aria-describedby=\"description\"\n aria-invalid=${this.hasError}\n aria-label=${ariaLabel}\n autocomplete=${autocomplete || nothing}\n ?disabled=${this.disabled}\n maxlength=${hasMaxLength ? this.maxLength : nothing}\n minlength=${hasMinLength ? this.minLength : nothing}\n placeholder=${this.placeholder || nothing}\n ?readonly=${this.readOnly}\n ?required=${this.required}\n rows=${this.rows}\n cols=${this.cols}\n .value=${live(this.value)}\n @change=${this.redispatchEvent}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n @input=${this.handleInput}\n @select=${this.redispatchEvent}></textarea>\n `;\n }\n\n const prefix = this.renderPrefix();\n const suffix = this.renderSuffix();\n\n // TODO(b/243805848): remove `as unknown as number` and `as any` once lit\n // analyzer is fixed\n // tslint:disable-next-line:no-any\n const inputMode = this.inputMode as any;\n return html`\n <div class=\"input-wrapper\">\n ${prefix}\n <input\n class=\"input\"\n style=${styleMap(style)}\n aria-describedby=\"description\"\n aria-invalid=${this.hasError}\n aria-label=${ariaLabel}\n autocomplete=${autocomplete || nothing}\n ?disabled=${this.disabled}\n inputmode=${inputMode || nothing}\n max=${(this.max || nothing) as unknown as number}\n maxlength=${hasMaxLength ? this.maxLength : nothing}\n min=${(this.min || nothing) as unknown as number}\n minlength=${hasMinLength ? this.minLength : nothing}\n pattern=${this.pattern || nothing}\n placeholder=${this.placeholder || nothing}\n ?readonly=${this.readOnly}\n ?required=${this.required}\n ?multiple=${this.multiple}\n step=${(this.step || nothing) as unknown as number}\n type=${this.type}\n .value=${live(this.value)}\n @change=${this.redispatchEvent}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n @input=${this.handleInput}\n @select=${this.redispatchEvent} />\n ${suffix}\n </div>\n `;\n }\n\n private renderPrefix() {\n return this.renderAffix(this.prefixText, /* isSuffix */ false);\n }\n\n private renderSuffix() {\n return this.renderAffix(this.suffixText, /* isSuffix */ true);\n }\n\n private renderAffix(text: string, isSuffix: boolean) {\n if (!text) {\n return nothing;\n }\n\n const classes = {\n 'suffix': isSuffix,\n 'prefix': !isSuffix,\n };\n\n return html`<span class=\"${classMap(classes)}\">${text}</span>`;\n }\n\n private getErrorText() {\n return this.error ? this.errorText : this.nativeErrorText;\n }\n\n private handleFocusChange() {\n // When calling focus() or reportValidity() during change, it's possible\n // for blur to be called after the new focus event. Rather than set\n // `this.focused` to true/false on focus/blur, we always set it to whether\n // or not the input itself is focused.\n this.focused = this.inputOrTextarea?.matches(':focus') ?? false;\n }\n\n private handleInput(event: InputEvent) {\n this.dirty = true;\n this.value = (event.target as HTMLInputElement).value;\n }\n\n private redispatchEvent(event: Event) {\n redispatchEvent(this, event);\n }\n\n private getInputOrTextarea() {\n if (!this.inputOrTextarea) {\n // If the input is not yet defined, synchronously render.\n // e.g.\n // const textField = document.createElement('md-outlined-text-field');\n // document.body.appendChild(textField);\n // textField.focus(); // synchronously render\n this.connectedCallback();\n this.scheduleUpdate();\n }\n\n if (this.isUpdatePending) {\n // If there are pending updates, synchronously perform them. This ensures\n // that constraint validation properties (like `required`) are synced\n // before interacting with input APIs that depend on them.\n this.scheduleUpdate();\n }\n\n return this.inputOrTextarea!;\n }\n\n private getInput() {\n if (this.type === 'textarea') {\n return null;\n }\n\n return this.getInputOrTextarea() as HTMLInputElement;\n }\n\n private handleIconChange() {\n this.hasLeadingIcon = this.leadingIcons.length > 0;\n this.hasTrailingIcon = this.trailingIcons.length > 0;\n }\n\n // Writable mixin properties for lit-html binding, needed for lit-analyzer\n declare disabled: boolean;\n declare name: string;\n\n override [getFormValue]() {\n return this.value;\n }\n\n override formResetCallback() {\n this.reset();\n }\n\n override formStateRestoreCallback(state: string) {\n this.value = state;\n }\n\n override focus() {\n // Required for the case that the user slots a focusable element into the\n // leading icon slot such as an iconbutton due to how delegatesFocus works.\n this.getInputOrTextarea().focus();\n }\n\n [createValidator](): Validator<unknown> {\n return new TextFieldValidator(() => ({\n state: this,\n renderedControl: this.inputOrTextarea,\n }));\n }\n\n [getValidityAnchor](): HTMLElement | null {\n return this.inputOrTextarea;\n }\n\n [onReportValidity](invalidEvent: Event | null) {\n // Prevent default pop-up behavior.\n invalidEvent?.preventDefault();\n\n const prevMessage = this.getErrorText();\n this.nativeError = !!invalidEvent;\n this.nativeErrorText = this.validationMessage;\n\n if (prevMessage === this.getErrorText()) {\n this.field?.reannounceError();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"text-field.js","sourceRoot":"","sources":["text-field.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,UAAU,EAAkB,IAAI,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,IAAI,EAAC,MAAM,wBA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AAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;2CAAkB;AAsC/C;IAAX,QAAQ,EAAE;uCAAW;AAsBtB;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;uCAC8B;AAQ7B;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;+CAAmB;AAkD5B;IAAhB,KAAK,EAAE;wCAAuB;AACd;IAAhB,KAAK,EAAE;0CAAyB;AAIhB;IAAhB,KAAK,EAAE;8CAA6B;AAKpB;IAAhB,KAAK,EAAE;kDAA8B;AAOrB;IADhB,KAAK,CAAC,QAAQ,CAAC;kDAIP;AACyB;IAAjC,KAAK,CAAC,QAAQ,CAAC;wCAAuC;AAEtC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,cAAc,EAAC,CAAC;+CACJ;AAEzB;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,eAAe,EAAC,CAAC;gDACJ","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement, PropertyValues, html, nothing} from 'lit';\nimport {property, query, queryAssignedElements, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {live} from 'lit/directives/live.js';\nimport {StyleInfo, styleMap} from 'lit/directives/style-map.js';\nimport {StaticValue, html as staticHtml} from 'lit/static-html.js';\n\nimport {Field} from '../../field/internal/field.js';\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {stringConverter} from '../../internal/controller/string-converter.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '../../labs/behaviors/constraint-validation.js';\nimport {mixinElementInternals} from '../../labs/behaviors/element-internals.js';\nimport {\n getFormValue,\n mixinFormAssociated,\n} from '../../labs/behaviors/form-associated.js';\nimport {\n mixinOnReportValidity,\n onReportValidity,\n} from '../../labs/behaviors/on-report-validity.js';\nimport {TextFieldValidator} from '../../labs/behaviors/validators/text-field-validator.js';\nimport {Validator} from '../../labs/behaviors/validators/validator.js';\n\n/**\n * Input types that are compatible with the text field.\n */\nexport type TextFieldType =\n | 'email'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'url'\n | 'textarea';\n\n/**\n * Input types that are not fully supported for the text field.\n */\nexport type UnsupportedTextFieldType =\n | 'color'\n | 'date'\n | 'datetime-local'\n | 'file'\n | 'month'\n | 'time'\n | 'week';\n\n/**\n * Input types that are incompatible with the text field.\n */\nexport type InvalidTextFieldType =\n | 'button'\n | 'checkbox'\n | 'hidden'\n | 'image'\n | 'radio'\n | 'range'\n | 'reset'\n | 'submit';\n\n// Separate variable needed for closure.\nconst textFieldBaseClass = mixinOnReportValidity(\n mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n ),\n);\n\n/**\n * A text field component.\n *\n * @fires select {Event} The native `select` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select_event)\n * --bubbles\n * @fires change {Event} The native `change` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)\n * --bubbles\n * @fires input {InputEvent} The native `input` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)\n * --bubbles --composed\n */\nexport abstract class TextField extends textFieldBaseClass {\n static {\n requestUpdateOnAriaChange(TextField);\n }\n\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Gets or sets whether or not the text field is in a visually invalid state.\n *\n * This error state overrides the error state controlled by\n * `reportValidity()`.\n */\n @property({type: Boolean, reflect: true}) error = false;\n\n /**\n * The error message that replaces supporting text when `error` is true. If\n * `errorText` is an empty string, then the supporting text will continue to\n * show.\n *\n * This error message overrides the error message displayed by\n * `reportValidity()`.\n */\n @property({attribute: 'error-text'}) errorText = '';\n\n /**\n * The floating Material label of the textfield component. It informs the user\n * about what information is requested for a text field. It is aligned with\n * the input text, is always visible, and it floats when focused or when text\n * is entered into the textfield. This label also sets accessibilty labels,\n * but the accessible label is overriden by `aria-label`.\n *\n * Learn more about floating labels from the Material Design guidelines:\n * https://m3.material.io/components/text-fields/guidelines\n */\n @property() label = '';\n\n /**\n * Indicates that the user must specify a value for the input before the\n * owning form can be submitted and will render an error state when\n * `reportValidity()` is invoked when value is empty. Additionally the\n * floating label will render an asterisk `\"*\"` when true.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required\n */\n @property({type: Boolean, reflect: true}) required = false;\n\n /**\n * The current value of the text field. It is always a string.\n */\n @property() value = '';\n\n /**\n * An optional prefix to display before the input value.\n */\n @property({attribute: 'prefix-text'}) prefixText = '';\n\n /**\n * An optional suffix to display after the input value.\n */\n @property({attribute: 'suffix-text'}) suffixText = '';\n\n /**\n * Whether or not the text field has a leading icon. Used for SSR.\n */\n @property({type: Boolean, attribute: 'has-leading-icon'})\n hasLeadingIcon = false;\n\n /**\n * Whether or not the text field has a trailing icon. Used for SSR.\n */\n @property({type: Boolean, attribute: 'has-trailing-icon'})\n hasTrailingIcon = false;\n\n /**\n * Conveys additional information below the text field, such as how it should\n * be used.\n */\n @property({attribute: 'supporting-text'}) supportingText = '';\n\n /**\n * Override the input text CSS `direction`. Useful for RTL languages that use\n * LTR notation for fractions.\n */\n @property({attribute: 'text-direction'}) textDirection = '';\n\n /**\n * The number of rows to display for a `type=\"textarea\"` text field.\n * Defaults to 2.\n */\n @property({type: Number}) rows = 2;\n\n /**\n * The number of cols to display for a `type=\"textarea\"` text field.\n * Defaults to 20.\n */\n @property({type: Number}) cols = 20;\n\n // <input> properties\n @property({reflect: true}) override inputMode = '';\n\n /**\n * Defines the greatest value in the range of permitted values.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max\n */\n @property() max = '';\n\n /**\n * The maximum number of characters a user can enter into the text field. Set\n * to -1 for none.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength\n */\n @property({type: Number}) maxLength = -1;\n\n /**\n * Defines the most negative value in the range of permitted values.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min\n */\n @property() min = '';\n\n /**\n * The minimum number of characters a user can enter into the text field. Set\n * to -1 for none.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength\n */\n @property({type: Number}) minLength = -1;\n\n /**\n * When true, hide the spinner for `type=\"number\"` text fields.\n */\n @property({type: Boolean, attribute: 'no-spinner'}) noSpinner = false;\n\n /**\n * A regular expression that the text field's value must match to pass\n * constraint validation.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern\n */\n @property() pattern = '';\n\n /**\n * Defines the text displayed in the textfield when it has no value. Provides\n * a brief hint to the user as to the expected type of data that should be\n * entered into the control. Unlike `label`, the placeholder is not visible\n * and does not float when the textfield has a value.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholder\n */\n @property({reflect: true, converter: stringConverter}) placeholder = '';\n\n /**\n * Indicates whether or not a user should be able to edit the text field's\n * value.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly\n */\n @property({type: Boolean, reflect: true}) readOnly = false;\n\n /**\n * Indicates that input accepts multiple email addresses.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#multiple\n */\n @property({type: Boolean, reflect: true}) multiple = false;\n\n /**\n * Gets or sets the direction in which selection occurred.\n */\n get selectionDirection() {\n return this.getInputOrTextarea().selectionDirection;\n }\n set selectionDirection(value: 'forward' | 'backward' | 'none' | null) {\n this.getInputOrTextarea().selectionDirection = value;\n }\n\n /**\n * Gets or sets the end position or offset of a text selection.\n */\n get selectionEnd() {\n return this.getInputOrTextarea().selectionEnd;\n }\n set selectionEnd(value: number | null) {\n this.getInputOrTextarea().selectionEnd = value;\n }\n\n /**\n * Gets or sets the starting position or offset of a text selection.\n */\n get selectionStart() {\n return this.getInputOrTextarea().selectionStart;\n }\n set selectionStart(value: number | null) {\n this.getInputOrTextarea().selectionStart = value;\n }\n\n /**\n * Returns or sets the element's step attribute, which works with min and max\n * to limit the increments at which a numeric or date-time value can be set.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step\n */\n @property() step = '';\n\n /**\n * The `<input>` type to use, defaults to \"text\". The type greatly changes how\n * the text field behaves.\n *\n * Text fields support a limited number of `<input>` types:\n *\n * - text\n * - textarea\n * - email\n * - number\n * - password\n * - search\n * - tel\n * - url\n *\n * See\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n * for more details on each input type.\n */\n @property({reflect: true})\n type: TextFieldType | UnsupportedTextFieldType = 'text';\n\n /**\n * Describes what, if any, type of autocomplete functionality the input\n * should provide.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\n */\n @property({reflect: true}) autocomplete = '';\n\n /**\n * The text field's value as a number.\n */\n get valueAsNumber() {\n const input = this.getInput();\n if (!input) {\n return NaN;\n }\n\n return input.valueAsNumber;\n }\n set valueAsNumber(value: number) {\n const input = this.getInput();\n if (!input) {\n return;\n }\n\n input.valueAsNumber = value;\n this.value = input.value;\n }\n\n /**\n * The text field's value as a Date.\n */\n get valueAsDate() {\n const input = this.getInput();\n if (!input) {\n return null;\n }\n\n return input.valueAsDate;\n }\n set valueAsDate(value: Date | null) {\n const input = this.getInput();\n if (!input) {\n return;\n }\n\n input.valueAsDate = value;\n this.value = input.value;\n }\n\n protected abstract readonly fieldTag: StaticValue;\n\n /**\n * Returns true when the text field has been interacted with. Native\n * validation errors only display in response to user interactions.\n */\n @state() private dirty = false;\n @state() private focused = false;\n /**\n * Whether or not a native error has been reported via `reportValidity()`.\n */\n @state() private nativeError = false;\n /**\n * The validation message displayed from a native error via\n * `reportValidity()`.\n */\n @state() private nativeErrorText = '';\n\n private get hasError() {\n return this.error || this.nativeError;\n }\n\n @query('.input')\n private readonly inputOrTextarea!:\n | HTMLInputElement\n | HTMLTextAreaElement\n | null;\n @query('.field') private readonly field!: Field | null;\n @queryAssignedElements({slot: 'leading-icon'})\n private readonly leadingIcons!: Element[];\n @queryAssignedElements({slot: 'trailing-icon'})\n private readonly trailingIcons!: Element[];\n\n /**\n * Selects all the text in the text field.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select\n */\n select() {\n this.getInputOrTextarea().select();\n }\n\n /**\n * Replaces a range of text with a new string.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setRangeText\n */\n setRangeText(replacement: string): void;\n setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectionMode?: SelectionMode,\n ): void;\n setRangeText(...args: unknown[]) {\n // Calling setRangeText with 1 vs 3-4 arguments has different behavior.\n // Use spread syntax and type casting to ensure correct usage.\n this.getInputOrTextarea().setRangeText(\n ...(args as Parameters<HTMLInputElement['setRangeText']>),\n );\n this.value = this.getInputOrTextarea().value;\n }\n\n /**\n * Sets the start and end positions of a selection in the text field.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange\n *\n * @param start The offset into the text field for the start of the selection.\n * @param end The offset into the text field for the end of the selection.\n * @param direction The direction in which the selection is performed.\n */\n setSelectionRange(\n start: number | null,\n end: number | null,\n direction?: 'forward' | 'backward' | 'none',\n ) {\n this.getInputOrTextarea().setSelectionRange(start, end, direction);\n }\n\n /**\n * Decrements the value of a numeric type text field by `step` or `n` `step`\n * number of times.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/stepDown\n *\n * @param stepDecrement The number of steps to decrement, defaults to 1.\n */\n stepDown(stepDecrement?: number) {\n const input = this.getInput();\n if (!input) {\n return;\n }\n\n input.stepDown(stepDecrement);\n this.value = input.value;\n }\n\n /**\n * Increments the value of a numeric type text field by `step` or `n` `step`\n * number of times.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/stepUp\n *\n * @param stepIncrement The number of steps to increment, defaults to 1.\n */\n stepUp(stepIncrement?: number) {\n const input = this.getInput();\n if (!input) {\n return;\n }\n\n input.stepUp(stepIncrement);\n this.value = input.value;\n }\n\n /**\n * Reset the text field to its default value.\n */\n reset() {\n this.dirty = false;\n this.value = this.getAttribute('value') ?? '';\n this.nativeError = false;\n this.nativeErrorText = '';\n }\n\n override attributeChangedCallback(\n attribute: string,\n newValue: string | null,\n oldValue: string | null,\n ) {\n if (attribute === 'value' && this.dirty) {\n // After user input, changing the value attribute no longer updates the\n // text field's value (until reset). This matches native <input> behavior.\n return;\n }\n\n super.attributeChangedCallback(attribute, newValue, oldValue);\n }\n\n protected override render() {\n const classes = {\n 'disabled': this.disabled,\n 'error': !this.disabled && this.hasError,\n 'textarea': this.type === 'textarea',\n 'no-spinner': this.noSpinner,\n };\n\n return html`\n <span class=\"text-field ${classMap(classes)}\">\n ${this.renderField()}\n </span>\n `;\n }\n\n protected override updated(changedProperties: PropertyValues) {\n // Keep changedProperties arg so that subclasses may call it\n\n // If a property such as `type` changes and causes the internal <input>\n // value to change without dispatching an event, re-sync it.\n const value = this.getInputOrTextarea().value;\n if (this.value !== value) {\n // Note this is typically inefficient in updated() since it schedules\n // another update. However, it is needed for the <input> to fully render\n // before checking its value.\n this.value = value;\n }\n }\n\n private renderField() {\n return staticHtml`<${this.fieldTag}\n class=\"field\"\n count=${this.value.length}\n ?disabled=${this.disabled}\n ?error=${this.hasError}\n error-text=${this.getErrorText()}\n ?focused=${this.focused}\n ?has-end=${this.hasTrailingIcon}\n ?has-start=${this.hasLeadingIcon}\n label=${this.label}\n max=${this.maxLength}\n ?populated=${!!this.value}\n ?required=${this.required}\n ?resizable=${this.type === 'textarea'}\n supporting-text=${this.supportingText}\n >\n ${this.renderLeadingIcon()}\n ${this.renderInputOrTextarea()}\n ${this.renderTrailingIcon()}\n <div id=\"description\" slot=\"aria-describedby\"></div>\n </${this.fieldTag}>`;\n }\n\n private renderLeadingIcon() {\n return html`\n <span class=\"icon leading\" slot=\"start\">\n <slot name=\"leading-icon\" @slotchange=${this.handleIconChange}></slot>\n </span>\n `;\n }\n\n private renderTrailingIcon() {\n return html`\n <span class=\"icon trailing\" slot=\"end\">\n <slot name=\"trailing-icon\" @slotchange=${this.handleIconChange}></slot>\n </span>\n `;\n }\n\n private renderInputOrTextarea() {\n const style: StyleInfo = {'direction': this.textDirection};\n const ariaLabel =\n (this as ARIAMixinStrict).ariaLabel || this.label || nothing;\n // lit-anaylzer `autocomplete` types are too strict\n // tslint:disable-next-line:no-any\n const autocomplete = this.autocomplete as any;\n\n // These properties may be set to null if the attribute is removed, and\n // `null > -1` is incorrectly `true`.\n const hasMaxLength = (this.maxLength ?? -1) > -1;\n const hasMinLength = (this.minLength ?? -1) > -1;\n if (this.type === 'textarea') {\n return html`\n <textarea\n class=\"input\"\n style=${styleMap(style)}\n aria-describedby=\"description\"\n aria-invalid=${this.hasError}\n aria-label=${ariaLabel}\n autocomplete=${autocomplete || nothing}\n name=${this.name || nothing}\n ?disabled=${this.disabled}\n maxlength=${hasMaxLength ? this.maxLength : nothing}\n minlength=${hasMinLength ? this.minLength : nothing}\n placeholder=${this.placeholder || nothing}\n ?readonly=${this.readOnly}\n ?required=${this.required}\n rows=${this.rows}\n cols=${this.cols}\n .value=${live(this.value)}\n @change=${this.redispatchEvent}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n @input=${this.handleInput}\n @select=${this.redispatchEvent}></textarea>\n `;\n }\n\n const prefix = this.renderPrefix();\n const suffix = this.renderSuffix();\n\n // TODO(b/243805848): remove `as unknown as number` and `as any` once lit\n // analyzer is fixed\n // tslint:disable-next-line:no-any\n const inputMode = this.inputMode as any;\n return html`\n <div class=\"input-wrapper\">\n ${prefix}\n <input\n class=\"input\"\n style=${styleMap(style)}\n aria-describedby=\"description\"\n aria-invalid=${this.hasError}\n aria-label=${ariaLabel}\n autocomplete=${autocomplete || nothing}\n name=${this.name || nothing}\n ?disabled=${this.disabled}\n inputmode=${inputMode || nothing}\n max=${(this.max || nothing) as unknown as number}\n maxlength=${hasMaxLength ? this.maxLength : nothing}\n min=${(this.min || nothing) as unknown as number}\n minlength=${hasMinLength ? this.minLength : nothing}\n pattern=${this.pattern || nothing}\n placeholder=${this.placeholder || nothing}\n ?readonly=${this.readOnly}\n ?required=${this.required}\n ?multiple=${this.multiple}\n step=${(this.step || nothing) as unknown as number}\n type=${this.type}\n .value=${live(this.value)}\n @change=${this.redispatchEvent}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n @input=${this.handleInput}\n @select=${this.redispatchEvent} />\n ${suffix}\n </div>\n `;\n }\n\n private renderPrefix() {\n return this.renderAffix(this.prefixText, /* isSuffix */ false);\n }\n\n private renderSuffix() {\n return this.renderAffix(this.suffixText, /* isSuffix */ true);\n }\n\n private renderAffix(text: string, isSuffix: boolean) {\n if (!text) {\n return nothing;\n }\n\n const classes = {\n 'suffix': isSuffix,\n 'prefix': !isSuffix,\n };\n\n return html`<span class=\"${classMap(classes)}\">${text}</span>`;\n }\n\n private getErrorText() {\n return this.error ? this.errorText : this.nativeErrorText;\n }\n\n private handleFocusChange() {\n // When calling focus() or reportValidity() during change, it's possible\n // for blur to be called after the new focus event. Rather than set\n // `this.focused` to true/false on focus/blur, we always set it to whether\n // or not the input itself is focused.\n this.focused = this.inputOrTextarea?.matches(':focus') ?? false;\n }\n\n private handleInput(event: InputEvent) {\n this.dirty = true;\n this.value = (event.target as HTMLInputElement).value;\n }\n\n private redispatchEvent(event: Event) {\n redispatchEvent(this, event);\n }\n\n private getInputOrTextarea() {\n if (!this.inputOrTextarea) {\n // If the input is not yet defined, synchronously render.\n // e.g.\n // const textField = document.createElement('md-outlined-text-field');\n // document.body.appendChild(textField);\n // textField.focus(); // synchronously render\n this.connectedCallback();\n this.scheduleUpdate();\n }\n\n if (this.isUpdatePending) {\n // If there are pending updates, synchronously perform them. This ensures\n // that constraint validation properties (like `required`) are synced\n // before interacting with input APIs that depend on them.\n this.scheduleUpdate();\n }\n\n return this.inputOrTextarea!;\n }\n\n private getInput() {\n if (this.type === 'textarea') {\n return null;\n }\n\n return this.getInputOrTextarea() as HTMLInputElement;\n }\n\n private handleIconChange() {\n this.hasLeadingIcon = this.leadingIcons.length > 0;\n this.hasTrailingIcon = this.trailingIcons.length > 0;\n }\n\n // Writable mixin properties for lit-html binding, needed for lit-analyzer\n declare disabled: boolean;\n declare name: string;\n\n override [getFormValue]() {\n return this.value;\n }\n\n override formResetCallback() {\n this.reset();\n }\n\n override formStateRestoreCallback(state: string) {\n this.value = state;\n }\n\n override focus() {\n // Required for the case that the user slots a focusable element into the\n // leading icon slot such as an iconbutton due to how delegatesFocus works.\n this.getInputOrTextarea().focus();\n }\n\n [createValidator](): Validator<unknown> {\n return new TextFieldValidator(() => ({\n state: this,\n renderedControl: this.inputOrTextarea,\n }));\n }\n\n [getValidityAnchor](): HTMLElement | null {\n return this.inputOrTextarea;\n }\n\n [onReportValidity](invalidEvent: Event | null) {\n // Prevent default pop-up behavior.\n invalidEvent?.preventDefault();\n\n const prevMessage = this.getErrorText();\n this.nativeError = !!invalidEvent;\n this.nativeErrorText = this.validationMessage;\n\n if (prevMessage === this.getErrorText()) {\n this.field?.reannounceError();\n }\n }\n}\n"]}