@m3e/web 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/LICENSE +1 -1
  2. package/dist/all.js +249 -26
  3. package/dist/all.js.map +1 -1
  4. package/dist/all.min.js +45 -45
  5. package/dist/all.min.js.map +1 -1
  6. package/dist/app-bar.js +1 -1
  7. package/dist/app-bar.min.js +1 -1
  8. package/dist/autocomplete.js +27 -7
  9. package/dist/autocomplete.js.map +1 -1
  10. package/dist/autocomplete.min.js +2 -2
  11. package/dist/autocomplete.min.js.map +1 -1
  12. package/dist/avatar.js +1 -1
  13. package/dist/avatar.min.js +1 -1
  14. package/dist/badge.js +1 -1
  15. package/dist/badge.min.js +1 -1
  16. package/dist/bottom-sheet.js +1 -1
  17. package/dist/bottom-sheet.min.js +1 -1
  18. package/dist/button-group.js +1 -1
  19. package/dist/button-group.min.js +1 -1
  20. package/dist/button.js +1 -1
  21. package/dist/button.min.js +1 -1
  22. package/dist/calendar.js +1 -1
  23. package/dist/calendar.min.js +1 -1
  24. package/dist/card.js +1 -1
  25. package/dist/card.min.js +1 -1
  26. package/dist/checkbox.js +1 -1
  27. package/dist/checkbox.min.js +1 -1
  28. package/dist/chips.js +1 -1
  29. package/dist/chips.min.js +1 -1
  30. package/dist/core-a11y.js +5 -3
  31. package/dist/core-a11y.js.map +1 -1
  32. package/dist/core-a11y.min.js +6 -6
  33. package/dist/core-a11y.min.js.map +1 -1
  34. package/dist/core-anchoring.js +1 -1
  35. package/dist/core-anchoring.min.js +1 -1
  36. package/dist/core-bidi.js +1 -1
  37. package/dist/core-bidi.min.js +1 -1
  38. package/dist/core-layout.js +1 -1
  39. package/dist/core-layout.min.js +1 -1
  40. package/dist/core-platform.js +1 -1
  41. package/dist/core-platform.min.js +1 -1
  42. package/dist/core.js +4 -4
  43. package/dist/core.js.map +1 -1
  44. package/dist/core.min.js +1 -1
  45. package/dist/core.min.js.map +1 -1
  46. package/dist/css-custom-data.json +60 -60
  47. package/dist/custom-elements.json +986 -837
  48. package/dist/datepicker.js +1 -1
  49. package/dist/datepicker.min.js +1 -1
  50. package/dist/dialog.js +1 -1
  51. package/dist/dialog.min.js +1 -1
  52. package/dist/divider.js +1 -1
  53. package/dist/divider.min.js +1 -1
  54. package/dist/drawer-container.js +1 -1
  55. package/dist/drawer-container.min.js +1 -1
  56. package/dist/expansion-panel.js +1 -1
  57. package/dist/expansion-panel.min.js +1 -1
  58. package/dist/fab-menu.js +1 -1
  59. package/dist/fab-menu.min.js +1 -1
  60. package/dist/fab.js +1 -1
  61. package/dist/fab.min.js +1 -1
  62. package/dist/form-field.js +1 -1
  63. package/dist/form-field.min.js +1 -1
  64. package/dist/heading.js +1 -1
  65. package/dist/heading.min.js +1 -1
  66. package/dist/html-custom-data.json +25 -25
  67. package/dist/icon-button.js +1 -1
  68. package/dist/icon-button.min.js +1 -1
  69. package/dist/icon.js +146 -6
  70. package/dist/icon.js.map +1 -1
  71. package/dist/icon.min.js +2 -2
  72. package/dist/icon.min.js.map +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/index.min.js +1 -1
  75. package/dist/list.js +1 -1
  76. package/dist/list.min.js +1 -1
  77. package/dist/loading-indicator.js +1 -1
  78. package/dist/loading-indicator.min.js +1 -1
  79. package/dist/menu.js +1 -1
  80. package/dist/menu.min.js +1 -1
  81. package/dist/nav-bar.js +1 -1
  82. package/dist/nav-bar.min.js +1 -1
  83. package/dist/nav-menu.js +1 -1
  84. package/dist/nav-menu.min.js +1 -1
  85. package/dist/nav-rail.js +1 -1
  86. package/dist/nav-rail.min.js +1 -1
  87. package/dist/option.js +1 -1
  88. package/dist/option.min.js +1 -1
  89. package/dist/paginator.js +1 -1
  90. package/dist/paginator.min.js +1 -1
  91. package/dist/progress-indicator.js +1 -1
  92. package/dist/progress-indicator.min.js +1 -1
  93. package/dist/radio-group.js +1 -1
  94. package/dist/radio-group.min.js +1 -1
  95. package/dist/search.js +1 -1
  96. package/dist/search.min.js +1 -1
  97. package/dist/segmented-button.js +1 -1
  98. package/dist/segmented-button.min.js +1 -1
  99. package/dist/select.js +29 -10
  100. package/dist/select.js.map +1 -1
  101. package/dist/select.min.js +2 -2
  102. package/dist/select.min.js.map +1 -1
  103. package/dist/shape.js +1 -1
  104. package/dist/shape.min.js +1 -1
  105. package/dist/skeleton.js +48 -4
  106. package/dist/skeleton.js.map +1 -1
  107. package/dist/skeleton.min.js +2 -2
  108. package/dist/skeleton.min.js.map +1 -1
  109. package/dist/slide-group.js +1 -1
  110. package/dist/slide-group.min.js +1 -1
  111. package/dist/slider.js +1 -1
  112. package/dist/slider.min.js +1 -1
  113. package/dist/snackbar.js +1 -1
  114. package/dist/snackbar.min.js +1 -1
  115. package/dist/split-button.js +1 -1
  116. package/dist/split-button.min.js +1 -1
  117. package/dist/split-pane.js +1 -1
  118. package/dist/split-pane.min.js +1 -1
  119. package/dist/src/autocomplete/AutocompleteElement.d.ts.map +1 -1
  120. package/dist/src/core/a11y/list-key/ListKeyManager.d.ts.map +1 -1
  121. package/dist/src/core/shared/primitives/ElevationElement.d.ts +1 -1
  122. package/dist/src/core/shared/primitives/FocusRingElement.d.ts +1 -1
  123. package/dist/src/core/shared/primitives/RippleElement.d.ts +1 -1
  124. package/dist/src/icon/IconElement.d.ts +7 -1
  125. package/dist/src/icon/IconElement.d.ts.map +1 -1
  126. package/dist/src/icon/IconRegistry.d.ts +54 -0
  127. package/dist/src/icon/IconRegistry.d.ts.map +1 -0
  128. package/dist/src/icon/IconWeight.d.ts +3 -0
  129. package/dist/src/icon/IconWeight.d.ts.map +1 -0
  130. package/dist/src/icon/index.d.ts +1 -0
  131. package/dist/src/icon/index.d.ts.map +1 -1
  132. package/dist/src/icon/registerIcon.d.ts +14 -0
  133. package/dist/src/icon/registerIcon.d.ts.map +1 -0
  134. package/dist/src/select/SelectElement.d.ts.map +1 -1
  135. package/dist/src/skeleton/SkeletonElement.d.ts.map +1 -1
  136. package/dist/stepper.js +1 -1
  137. package/dist/stepper.min.js +1 -1
  138. package/dist/switch.js +1 -1
  139. package/dist/switch.min.js +1 -1
  140. package/dist/tabs.js +1 -1
  141. package/dist/tabs.min.js +1 -1
  142. package/dist/textarea-autosize.js +1 -1
  143. package/dist/textarea-autosize.min.js +1 -1
  144. package/dist/theme.js +1 -1
  145. package/dist/theme.min.js +1 -1
  146. package/dist/toc.js +1 -1
  147. package/dist/toc.min.js +1 -1
  148. package/dist/toolbar.js +1 -1
  149. package/dist/toolbar.min.js +1 -1
  150. package/dist/tooltip.js +1 -1
  151. package/dist/tooltip.min.js +1 -1
  152. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.min.js","sources":["../../src/autocomplete/AutocompleteElement.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, PropertyValues } from \"lit\";\r\nimport { property } from \"lit/decorators.js\";\r\n\r\nimport {\r\n HtmlFor,\r\n prefersReducedMotion,\r\n scrollIntoViewIfNeeded,\r\n forcedColorsActive,\r\n setCustomState,\r\n deleteCustomState,\r\n addCustomState,\r\n customElement,\r\n MutationController,\r\n EventAttribute,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { ListKeyManager, M3eLiveAnnouncer } from \"@m3e/web/core/a11y\";\r\nimport { M3eOptGroupElement, M3eOptionElement, M3eOptionPanelElement } from \"@m3e/web/option\";\r\nimport type { M3eFormFieldElement } from \"@m3e/web/form-field\";\r\n\r\nimport { AutocompleteFilterMode } from \"./AutocompleteFilterMode\";\r\nimport { AutocompleteQueryEventDetail } from \"./AutocompleteQueryEventDetail\";\r\n\r\n/**\r\n * Enhances a text input with suggested options.\r\n *\r\n * @description\r\n * The `m3e-autocomplete` component augments a text input field with a dynamically positioned menu of filterable suggestions,\r\n * following Material Design 3 principles. It provides real-time filtering, keyboard navigation, automatic option activation,\r\n * and text highlighting to guide user selection. The component manages focus, selection state, and menu visibility while\r\n * integrating seamlessly with form field containers and supporting both required and optional selection modes.\r\n *\r\n * @example\r\n * The following example illustrates use of the `m3e-autocomplete` paired with a `m3e-form-field`.\r\n * ```html\r\n * <m3e-form-field>\r\n * <label slot=\"label\" for=\"fruit\">Choose your favorite fruit</label>\r\n * <input id=\"fruit\" />\r\n * </m3e-form-field>\r\n * <m3e-autocomplete for=\"fruit\">\r\n * <m3e-option>Apples</m3e-option>\r\n * <m3e-option>Oranges</m3e-option>\r\n * <m3e-option>Bananas</m3e-option>\r\n * <m3e-option>Grapes</m3e-option>\r\n * </m3e-autocomplete>\r\n * ```\r\n *\r\n * @tag m3e-autocomplete\r\n *\r\n * @attr auto-activate - Whether the first option should be automatically activated.\r\n * @attr case-sensitive - Whether filtering is case sensitive.\r\n * @attr filter - Mode in which to filter options.\r\n * @attr hide-selection-indicator - Whether to hide the selection indicator.\r\n * @attr hide-loading - Whether to hide the menu when loading options.\r\n * @attr hide-no-data - Whether to hide the menu when there are no options to show.\r\n * @attr loading - Whether options are being loaded.\r\n * @attr loading-label - The text announced and presented when loading options.\r\n * @attr no-data-label - The text announced and presented when no options are available for the current term.\r\n * @attr panel-class - Class or list of classes to be applied to the autocomplete's overlay panel.\r\n * @attr required - Whether the user is required to make a selection when interacting with the autocomplete.\r\n * @attr results-label - The text announced when available options change for the current term.\r\n *\r\n * @slot - Renders the options of the autocomplete.\r\n * @slot loading - Renders content when loading options.\r\n * @slot no-data - Renders content when there are no options to show.\r\n *\r\n * @fires toggle - Emitted when the options menu opens or closes.\r\n * @fires query - Emitted when the input is focused or when the user modifies its value.\r\n * @fires change - Emitted when the committed value changes due to selecting an option or clearing the input.\r\n */\r\n@customElement(\"m3e-autocomplete\")\r\nexport class M3eAutocompleteElement extends EventAttribute(HtmlFor(LitElement), \"query\") {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: contents;\r\n }\r\n .options {\r\n display: none;\r\n }\r\n `;\r\n\r\n /** @private */ private static __nextId = 0;\r\n\r\n /** @private */ readonly #id = `m3e-autocomplete-${M3eAutocompleteElement.__nextId}`;\r\n /** @private */ readonly #menuId = `${this.#id}-menu`;\r\n /** @private */ private _options = new Array<M3eOptionElement>();\r\n /** @private */ #clone?: HTMLElement;\r\n /** @private */ #ignoreFocusVisible = false;\r\n /** @private */ #menu?: M3eOptionPanelElement;\r\n /** @private */ #ignoreHideMenuOnBlur = false;\r\n /** @private */ #inputChanged = false;\r\n /** @private */ #hasFocus = false;\r\n /** @private */ #mutationAbortController?: AbortController;\r\n\r\n /** @private */ readonly #clickHandler = () => this.#handleClick();\r\n /** @private */ readonly #formFieldPointerDownHandler = () => this.#handleFormFieldPointerDown();\r\n /** @private */ readonly #focusHandler = () => this.#handleFocus();\r\n /** @private */ readonly #blurHandler = () => this.#handleBlur();\r\n /** @private */ readonly #keyDownHandler = (e: KeyboardEvent) => this.#handleKeyDown(e);\r\n /** @private */ readonly #inputHandler = (e: Event) => this.#handleInput(e);\r\n /** @private */ readonly #changeHandler = () => this.#handleChange();\r\n /** @private */ readonly #menuToggleHandler = (e: ToggleEvent) => this.#handleMenuToggle(e);\r\n /** @private */ readonly #menuPointerDownHandler = (e: PointerEvent) => this.#handleMenuPointerDown(e);\r\n\r\n /** @private */ private readonly _listKeyManager = new ListKeyManager<M3eOptionElement>()\r\n .withWrap()\r\n .withHomeAndEnd()\r\n .withPageUpAndDown()\r\n .withVerticalOrientation()\r\n .withSkipPredicate((item) => item.disabled || item.hidden === true)\r\n .onActiveItemChange(() => {\r\n if (this._listKeyManager.activeItem) {\r\n this.#activateOption(this._listKeyManager.activeItem);\r\n }\r\n });\r\n\r\n constructor() {\r\n super();\r\n\r\n new MutationController(this, {\r\n config: {\r\n childList: true,\r\n subtree: true,\r\n },\r\n callback: () => this.#handleMutation(),\r\n });\r\n }\r\n\r\n /**\r\n * Whether to hide the selection indicator.\r\n * @default false\r\n */\r\n @property({ attribute: \"hide-selection-indicator\", type: Boolean }) hideSelectionIndicator = false;\r\n\r\n /**\r\n * Whether the user is required to make a selection when interacting with the autocomplete.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) required = false;\r\n\r\n /**\r\n * Whether the first option should be automatically activated.\r\n * @default false\r\n */\r\n @property({ attribute: \"auto-activate\", type: Boolean }) autoActivate = false;\r\n\r\n /**\r\n * Whether filtering is case sensitive.\r\n * @default false\r\n */\r\n @property({ attribute: \"case-sensitive\", type: Boolean }) caseSensitive = false;\r\n\r\n /**\r\n * Mode in which to filter options.\r\n * @default \"contains\"\r\n */\r\n @property({\r\n converter: {\r\n fromAttribute(value: string | null): AutocompleteFilterMode {\r\n if (value === null) return \"contains\";\r\n if (value === \"starts-with\" || value === \"ends-with\" || value === \"contains\" || value === \"none\") {\r\n return value;\r\n }\r\n return \"contains\";\r\n },\r\n },\r\n })\r\n filter: AutocompleteFilterMode | ((option: M3eOptionElement, term: string) => boolean) = \"contains\";\r\n\r\n /**\r\n * Whether options are being loaded.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) loading = false;\r\n\r\n /**\r\n * Whether to hide the menu when there are no options to show.\r\n * @default false\r\n */\r\n @property({ attribute: \"hide-no-data\", type: Boolean }) hideNoData = false;\r\n\r\n /**\r\n * Whether to hide the menu when loading options.\r\n * @default false\r\n */\r\n @property({ attribute: \"hide-loading\", type: Boolean }) hideLoading = false;\r\n\r\n /**\r\n * The text announced and presented when loading options.\r\n * @default \"Loading...\"\r\n */\r\n @property({ attribute: \"loading-label\" }) loadingLabel = \"Loading...\";\r\n\r\n /**\r\n * The text announced and presented when no options are available for the current term.\r\n * @default \"No options\"\r\n */\r\n @property({ attribute: \"no-data-label\" }) noDataLabel = \"No options\";\r\n\r\n /**\r\n * The text announced when available options change for the current term.\r\n * @default (count) => `${count} options`\r\n */\r\n @property({ attribute: \"results-label\" }) resultsLabel: string | ((count: number) => string) = (count) =>\r\n `${count} options`;\r\n\r\n /**\r\n * Class or list of classes to be applied to the autocomplete's overlay panel.\r\n * @default \"\"\r\n */\r\n @property({ attribute: \"panel-class\" }) panelClass = \"\";\r\n\r\n /** The options that can be selected. */\r\n get options(): readonly M3eOptionElement[] {\r\n return this._options ?? [];\r\n }\r\n\r\n /** The selected option. */\r\n get selected(): M3eOptionElement | null {\r\n return this.options.find((x) => x.selected) ?? null;\r\n }\r\n\r\n /** The selected (enabled) value. */\r\n get value(): string | null {\r\n const selected = this.selected;\r\n return selected && !selected.disabled ? selected.value : null;\r\n }\r\n\r\n /** @private */\r\n get #options(): readonly M3eOptionElement[] {\r\n return this._listKeyManager?.items ?? [];\r\n }\r\n\r\n /** @private */\r\n get #input(): HTMLInputElement | null {\r\n return this.control ? <HTMLInputElement>this.control : null;\r\n }\r\n\r\n /** @private */\r\n get #hasNoDataSlot(): boolean {\r\n return (this.#clone?.querySelector(\"[slot='no-data']\") ?? null) !== null;\r\n }\r\n\r\n /** @private */\r\n get #hasLoadingSlot(): boolean {\r\n return (this.#clone?.querySelector(\"[slot='loading']\") ?? null) !== null;\r\n }\r\n\r\n /** @private */\r\n get #shouldShowMenu(): boolean {\r\n return (\r\n this.#options.some((x) => x.hidden === false) ||\r\n (this.loading && !this.hideLoading && this.loadingLabel.length > 0) ||\r\n (!this.loading && !this.hideNoData && this.noDataLabel.length > 0)\r\n );\r\n }\r\n\r\n /** @private */\r\n get #formField(): M3eFormFieldElement | null {\r\n return this.control?.closest(\"m3e-form-field\") ?? null;\r\n }\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n if (!(control instanceof HTMLInputElement)) return;\r\n\r\n super.attach(control);\r\n\r\n control.autocomplete = \"off\";\r\n control.role = \"combobox\";\r\n control.ariaAutoComplete = \"list\";\r\n control.ariaExpanded = \"false\";\r\n\r\n control.addEventListener(\"click\", this.#clickHandler);\r\n control.addEventListener(\"focus\", this.#focusHandler);\r\n control.addEventListener(\"blur\", this.#blurHandler);\r\n control.addEventListener(\"keydown\", this.#keyDownHandler);\r\n control.addEventListener(\"input\", this.#inputHandler);\r\n control.addEventListener(\"change\", this.#changeHandler);\r\n\r\n this.#formField?.addEventListener(\"pointerdown\", this.#formFieldPointerDownHandler);\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control) {\r\n this.#formField?.removeEventListener(\"pointerdown\", this.#formFieldPointerDownHandler);\r\n\r\n this.control.role = null;\r\n this.control.ariaAutoComplete = null;\r\n this.control.ariaExpanded = null;\r\n\r\n this.control.removeEventListener(\"click\", this.#clickHandler);\r\n this.control.removeEventListener(\"focus\", this.#focusHandler);\r\n this.control.removeEventListener(\"blur\", this.#blurHandler);\r\n this.control.removeEventListener(\"keydown\", this.#keyDownHandler);\r\n this.control.removeEventListener(\"input\", this.#inputHandler);\r\n this.control.removeEventListener(\"change\", this.#changeHandler);\r\n }\r\n super.detach();\r\n }\r\n\r\n /**\r\n * Clears the value of the element.\r\n * @param [restoreFocus=false] Whether to restore input focus.\r\n */\r\n clear(restoreFocus = false): void {\r\n if (!this.#input) return;\r\n\r\n this.#input.value = \"\";\r\n if (this.#clearOptions()) {\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n this.#filterOptions();\r\n\r\n if (restoreFocus) {\r\n this.#input.focus();\r\n } else {\r\n this.#hideMenu();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.#handleMutation();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"hideNoData\") && this.hideNoData && this.#menu) {\r\n setCustomState(this.#menu, \"-no-data\", false);\r\n }\r\n\r\n if (changedProperties.has(\"loading\")) {\r\n if (this.loading) {\r\n if (this.#hasFocus) {\r\n if (this.loadingLabel) {\r\n M3eLiveAnnouncer.announce(this.loadingLabel, \"polite\");\r\n }\r\n if (!this.#menu && this.#shouldShowMenu) {\r\n this.#showMenu();\r\n }\r\n }\r\n } else if (this.#menu && !this.#shouldShowMenu) {\r\n this.#hideMenu();\r\n } else if (this.#menu) {\r\n deleteCustomState(this.#menu, \"-loading\");\r\n } else if (this.#hasFocus) {\r\n this.#showMenu();\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"options\" aria-hidden=\"true\">\r\n <slot></slot>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n async #handleMutation(): Promise<void> {\r\n if (this.#mutationAbortController) {\r\n this.#mutationAbortController.abort();\r\n }\r\n const mutationAbortController = new AbortController();\r\n this.#mutationAbortController = mutationAbortController;\r\n\r\n const options = [...this.querySelectorAll(\"m3e-option\")];\r\n\r\n for (const option of options) {\r\n if (mutationAbortController.signal.aborted) {\r\n break;\r\n }\r\n if (option.isUpdatePending) {\r\n await option.updateComplete;\r\n }\r\n }\r\n\r\n if (mutationAbortController.signal.aborted) {\r\n return;\r\n }\r\n\r\n this._options = options;\r\n\r\n this.#clone = <HTMLElement>this.cloneNode(true);\r\n\r\n const { added } = this._listKeyManager.setItems([...this.#clone.querySelectorAll(\"m3e-option\")]);\r\n added.forEach((x) => {\r\n x.id = x.id || `${this.#id}-option-${this._listKeyManager.items.indexOf(x)}`;\r\n setCustomState(x, \"-hide-selection-indicator\", this.hideSelectionIndicator);\r\n });\r\n\r\n if (this.#menu) {\r\n const count = this.#filterOptions();\r\n this.#projectClone();\r\n if (!this.#shouldShowMenu) {\r\n this.#hideMenu();\r\n } else {\r\n this.#updateMenuState(this.#menu, count);\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleClick(): void {\r\n this.#ignoreFocusVisible = true;\r\n this.#showMenu();\r\n }\r\n\r\n /** @private */\r\n #handleFormFieldPointerDown(): void {\r\n this.#ignoreHideMenuOnBlur = true;\r\n }\r\n\r\n /** @private */\r\n #handleFocus(): void {\r\n this.#hasFocus = true;\r\n this.#ignoreFocusVisible = true;\r\n\r\n if (this.options.length == 0 && !(<HTMLInputElement>this.control).readOnly) {\r\n this.dispatchEvent(\r\n new CustomEvent<AutocompleteQueryEventDetail>(\"query\", {\r\n detail: { term: this.#input?.value ?? \"\" },\r\n bubbles: true,\r\n composed: true,\r\n }),\r\n );\r\n }\r\n\r\n this.#showMenu();\r\n }\r\n\r\n /** @private */\r\n #handleBlur(): void {\r\n this.#hasFocus = false;\r\n if (!this.#ignoreHideMenuOnBlur) {\r\n this.#hideMenu();\r\n }\r\n this.#ignoreHideMenuOnBlur = false;\r\n }\r\n\r\n /** @private */\r\n #handleInput(e: Event): void {\r\n if (!this.#input || e.defaultPrevented) return;\r\n\r\n this.dispatchEvent(\r\n new CustomEvent<AutocompleteQueryEventDetail>(\"query\", {\r\n detail: { term: this.#input.value },\r\n bubbles: true,\r\n composed: true,\r\n }),\r\n );\r\n\r\n if (this.#input.value === \"\" && this.#clearOptions()) {\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n this.#inputChanged = true;\r\n try {\r\n if (!this.#menu) {\r\n this.#showMenu();\r\n } else {\r\n this.#filterOptions();\r\n if (!this.#shouldShowMenu) {\r\n this.#hideMenu();\r\n }\r\n }\r\n } finally {\r\n this.#inputChanged = false;\r\n this.#formField?.notifyControlStateChange(true);\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleChange(): void {\r\n if (this.#input) {\r\n const selected = this.selected;\r\n if (this.required) {\r\n this.#input.value = selected?.label ?? \"\";\r\n } else if (selected && selected.label !== this.#input.value && this.#clearOptions()) {\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleKeyDown(e: KeyboardEvent): void {\r\n if (e.defaultPrevented) return;\r\n\r\n this.#ignoreFocusVisible = false;\r\n\r\n switch (e.key) {\r\n case \"Backspace\":\r\n case \"Delete\":\r\n if (this.#input && !this.#input.value) {\r\n this.#hideMenu();\r\n }\r\n break;\r\n\r\n case \"Enter\":\r\n if (this.#menu && this._listKeyManager.activeItem) {\r\n e.preventDefault();\r\n this.#selectOption(this._listKeyManager.activeItem);\r\n if (!prefersReducedMotion()) {\r\n setTimeout(() => this.#hideMenu(), 150);\r\n } else {\r\n this.#hideMenu();\r\n }\r\n } else if (this.#menu) {\r\n setTimeout(() => {\r\n if (this.#input && !this.#input.value) {\r\n this.#hideMenu();\r\n }\r\n });\r\n }\r\n break;\r\n\r\n case \"Escape\":\r\n case \"Tab\":\r\n this.#hideMenu();\r\n break;\r\n\r\n case \"Up\":\r\n case \"ArrowUp\":\r\n if (e.altKey) {\r\n this.#hideMenu();\r\n } else {\r\n this._listKeyManager.onKeyDown(e);\r\n }\r\n break;\r\n\r\n case \"Down\":\r\n case \"ArrowDown\":\r\n if (!this.#menu) {\r\n this.#showMenu();\r\n e.preventDefault();\r\n } else {\r\n this._listKeyManager.onKeyDown(e);\r\n }\r\n break;\r\n\r\n default:\r\n this._listKeyManager.onKeyDown(e);\r\n break;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleMenuPointerDown(e: PointerEvent): void {\r\n if (e.button === 2) return;\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n\r\n const option = <M3eOptionElement | undefined>(\r\n e.composedPath().find((x) => x instanceof HTMLElement && x.tagName === \"M3E-OPTION\")\r\n );\r\n\r\n if (option && !option.disabled) {\r\n this._listKeyManager.setActiveItem(option);\r\n this.#selectOption(option);\r\n if (!prefersReducedMotion()) {\r\n setTimeout(() => this.#hideMenu(), 150);\r\n } else {\r\n this.#hideMenu();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleMenuToggle(e: ToggleEvent): void {\r\n if (!this.#menu) return;\r\n\r\n if (e.newState !== \"closed\") {\r\n const option = this.#options.find((x) => x.selected && !x.disabled);\r\n if (option) {\r\n this._listKeyManager.setActiveItem(option);\r\n scrollIntoViewIfNeeded(option, this.#menu);\r\n } else {\r\n this.#autoActivate();\r\n }\r\n\r\n this.dispatchEvent(\r\n new ToggleEvent(\"toggle\", {\r\n oldState: e.oldState,\r\n newState: e.newState,\r\n }),\r\n );\r\n } else {\r\n if (prefersReducedMotion()) {\r\n this.#destroyMenu(e);\r\n } else {\r\n // NOTE: use transitionend is preferred but doesn't fire when used here.\r\n // This is a workaround until that is fixed.\r\n setTimeout(() => this.#destroyMenu(e), 100);\r\n }\r\n }\r\n }\r\n\r\n /** @private*/\r\n #destroyMenu(e: ToggleEvent): void {\r\n if (!this.#menu) return;\r\n\r\n this.#clone?.replaceChildren(...this.#menu.childNodes);\r\n\r\n this.#menu.remove();\r\n this.#menu.removeEventListener(\"toggle\", this.#menuToggleHandler);\r\n this.#menu.removeEventListener(\"pointerdown\", this.#menuPointerDownHandler);\r\n this.#menu = undefined;\r\n\r\n if (this.#input) {\r\n this.#input.ariaExpanded = \"false\";\r\n this.#input.removeAttribute(\"aria-controls\");\r\n this.#input.removeAttribute(\"aria-owns\");\r\n this.#input.removeAttribute(\"aria-activedescendant\");\r\n }\r\n this.requestUpdate();\r\n\r\n this.#formField?.notifyControlStateChange();\r\n\r\n this.dispatchEvent(\r\n new ToggleEvent(\"toggle\", {\r\n oldState: e.oldState,\r\n newState: e.newState,\r\n }),\r\n );\r\n\r\n if (this.#input?.slot === \"input\" && this.#input.parentElement?.tagName === \"M3E-INPUT-CHIP-SET\") {\r\n this.#clearOptions();\r\n }\r\n }\r\n\r\n /** @private */\r\n #showMenu(): void {\r\n if (this.#menu || !this.#input || this.#input.readOnly || this.#input.disabled) return;\r\n\r\n const count = this.#filterOptions();\r\n\r\n if (!this.#shouldShowMenu) return;\r\n\r\n this.#menu = document.createElement(\"m3e-option-panel\");\r\n this.#menu.id = this.#menuId;\r\n\r\n if (this.panelClass) {\r\n for (const klass of this.panelClass\r\n .split(/\\s+/)\r\n .map((d) => d.trim())\r\n .filter(Boolean)) {\r\n this.#menu.classList.add(klass);\r\n }\r\n }\r\n\r\n this.#menu.style.overflowX = \"hidden\";\r\n this.#menu.scrollStrategy = \"reposition\";\r\n this.#menu.fitAnchorWidth = true;\r\n this.#menu.addEventListener(\"toggle\", this.#menuToggleHandler);\r\n this.#menu.addEventListener(\"pointerdown\", this.#menuPointerDownHandler);\r\n\r\n this.#projectClone();\r\n\r\n this.#updateMenuState(this.#menu, count);\r\n\r\n (this.#formField ?? this.#input).insertAdjacentElement(\"afterend\", this.#menu);\r\n\r\n this.#input.setAttribute(\"aria-controls\", this.#menuId);\r\n this.#input.setAttribute(\"aria-owns\", this.#menuId);\r\n\r\n this.#formField?.notifyControlStateChange();\r\n\r\n if (this._listKeyManager.activeItem && this.autoActivate) {\r\n this.#activateOption(this._listKeyManager.activeItem, true);\r\n }\r\n\r\n const input = this.#input;\r\n setTimeout(() => this.#menu?.show(input, this.#formField?.menuAnchor));\r\n }\r\n\r\n /** @private */\r\n #projectClone(): void {\r\n if (!this.#clone || !this.#menu) return;\r\n const children = [...this.#clone.childNodes];\r\n if (!this.#hasNoDataSlot && this.noDataLabel) {\r\n const noDataSpan = document.createElement(\"span\");\r\n noDataSpan.slot = \"no-data\";\r\n noDataSpan.textContent = this.noDataLabel;\r\n children.push(noDataSpan);\r\n }\r\n if (!this.#hasLoadingSlot && this.loadingLabel) {\r\n const loadingSpan = document.createElement(\"span\");\r\n loadingSpan.slot = \"loading\";\r\n loadingSpan.textContent = this.loadingLabel;\r\n children.push(loadingSpan);\r\n }\r\n this.#menu.replaceChildren(...children);\r\n }\r\n\r\n /** @private */\r\n #updateMenuState(menu: M3eOptionPanelElement, count: number): void {\r\n setCustomState(menu, \"-loading\", this.loading);\r\n setCustomState(menu, \"-no-data\", count == 0);\r\n }\r\n\r\n /** @private */\r\n #hideMenu(): void {\r\n this.#menu?.hide();\r\n }\r\n\r\n /** @private */\r\n #activateOption(option: M3eOptionElement, forceFocusVisible = false): void {\r\n if (!this.#input) return;\r\n\r\n this.#input.setAttribute(\"aria-activedescendant\", option.id);\r\n\r\n if (this.#menu) {\r\n scrollIntoViewIfNeeded(option, this.#menu, { block: \"nearest\", behavior: \"instant\" });\r\n\r\n const focusVisible =\r\n forceFocusVisible ||\r\n (!this.#ignoreFocusVisible && (this.#input.matches(\":focus-visible\") || forcedColorsActive()));\r\n\r\n this.#options.forEach((x) => {\r\n const active = x === option && focusVisible;\r\n if (active) {\r\n x.focusRing?.show();\r\n x.stateLayer?.show(\"focused\");\r\n } else {\r\n x.focusRing?.hide();\r\n x.stateLayer?.hide(\"focused\");\r\n }\r\n });\r\n }\r\n }\r\n\r\n /** @private */\r\n async #updateSelectionState(clone: M3eOptionElement): Promise<void> {\r\n const option = this._options[this._listKeyManager.items.indexOf(clone)];\r\n if (option) {\r\n option.selected = clone.selected;\r\n if (option.isUpdatePending) {\r\n await option.updateComplete;\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n async #selectOption(option: M3eOptionElement): Promise<void> {\r\n if (option.selected) return;\r\n\r\n option.selected = true;\r\n await this.#updateSelectionState(option);\r\n if (option.isUpdatePending) {\r\n await option.updateComplete;\r\n }\r\n\r\n this.requestUpdate();\r\n if (this.isUpdatePending) {\r\n await this.updateComplete;\r\n }\r\n\r\n if (this.#input) {\r\n this.#input.value = option.label;\r\n }\r\n\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n\r\n this.#formField?.notifyControlStateChange(true);\r\n }\r\n\r\n /** @private */\r\n #filterOption(clone: M3eOptionElement, option: M3eOptionElement, term: string, exactTerm: string): boolean {\r\n const value = this.caseSensitive ? option.value : option.value.toLowerCase();\r\n switch (this.filter) {\r\n case \"starts-with\":\r\n clone.term = exactTerm;\r\n clone.highlightMode = this.filter;\r\n return value.startsWith(term);\r\n case \"ends-with\":\r\n clone.term = exactTerm;\r\n clone.highlightMode = this.filter;\r\n return value.endsWith(term);\r\n case \"contains\":\r\n clone.term = exactTerm;\r\n clone.highlightMode = this.filter;\r\n return value.includes(term);\r\n case \"none\":\r\n clone.disableHighlight = true;\r\n return true;\r\n default:\r\n clone.disableHighlight = true;\r\n return this.filter(option, exactTerm);\r\n }\r\n }\r\n\r\n /** @private */\r\n #filterOptions(): number {\r\n if (!this.#input) return 0;\r\n\r\n const oldCount = this.#options.filter((x) => x.hidden === false).length;\r\n const shouldAnnounce = !this.loading && this.#inputChanged;\r\n this.#inputChanged = false;\r\n\r\n const exactTerm = this.#input.value;\r\n const term = this.caseSensitive ? exactTerm : exactTerm.toLocaleLowerCase();\r\n\r\n let newCount = 0;\r\n let first = false;\r\n let last: M3eOptionElement | undefined;\r\n\r\n for (let i = 0; i < this.#options.length; i++) {\r\n const clone = this.#options[i];\r\n const option = this._options[i];\r\n clone.hidden = !this.#filterOption(clone, option, term, exactTerm);\r\n\r\n if (clone.hidden === true) {\r\n this.#deactivateOption(clone);\r\n deleteCustomState(clone, \"-first\");\r\n deleteCustomState(clone, \"-last\");\r\n } else {\r\n newCount++;\r\n if (!first && !(clone.parentElement instanceof M3eOptGroupElement)) {\r\n addCustomState(clone, \"-first\");\r\n first = true;\r\n addCustomState(clone, \"-last\");\r\n last = clone;\r\n } else {\r\n deleteCustomState(clone, \"-first\");\r\n if (last) {\r\n deleteCustomState(last, \"-last\");\r\n }\r\n addCustomState(clone, \"-last\");\r\n last = clone;\r\n }\r\n }\r\n }\r\n\r\n if (this.#menu) {\r\n this.#updateMenuState(this.#menu, newCount);\r\n }\r\n\r\n const groups = this.#menu?.querySelectorAll(\"m3e-optgroup\") ?? this.#clone?.querySelectorAll(\"m3e-optgroup\") ?? [];\r\n for (const group of groups) {\r\n group.hidden = [...group.querySelectorAll(\"m3e-option\")].every((x) => x.hidden === true);\r\n }\r\n\r\n if (shouldAnnounce) {\r\n this.#announceResults(oldCount, newCount);\r\n }\r\n\r\n this.#autoActivate();\r\n return newCount;\r\n }\r\n\r\n /** @private */\r\n #clearOptions(): boolean {\r\n const selected = this._listKeyManager.items.filter((x) => x.selected);\r\n if (selected.length > 0) {\r\n selected.forEach((x) => {\r\n x.selected = false;\r\n this.#updateSelectionState(x);\r\n });\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** @private */\r\n #announceResults(oldCount: number, newCount: number): void {\r\n if (!this.#hasFocus) return;\r\n if (newCount == 0) {\r\n if (oldCount > 0 && this.noDataLabel) {\r\n M3eLiveAnnouncer.announce(this.noDataLabel, \"polite\");\r\n }\r\n } else if (oldCount != newCount) {\r\n const message = this.resultsLabel instanceof Function ? this.resultsLabel(newCount) : this.resultsLabel;\r\n if (message) {\r\n M3eLiveAnnouncer.announce(message, \"polite\");\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #autoActivate(): void {\r\n if (this.autoActivate && (!this._listKeyManager.activeItem || !this._listKeyManager.activeItem.selected)) {\r\n const option = this.#options.find((x) => !x.disabled && x.hidden === false);\r\n if (option) {\r\n this._listKeyManager.setActiveItem(option);\r\n if (this.#menu) {\r\n scrollIntoViewIfNeeded(option, this.#menu, { block: \"nearest\", behavior: \"instant\" });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #deactivateOption(option: M3eOptionElement): void {\r\n option.focusRing?.hide();\r\n option.stateLayer?.hide(\"focused\");\r\n if (option === this._listKeyManager.activeItem) {\r\n this._listKeyManager.updateActiveItem(null);\r\n this.#input?.removeAttribute(\"aria-activedescendant\");\r\n }\r\n }\r\n}\r\n\r\ninterface M3eAutocompleteElementEventMap extends HTMLElementEventMap {\r\n toggle: ToggleEvent;\r\n query: CustomEvent<AutocompleteQueryEventDetail>;\r\n}\r\n\r\nexport interface M3eAutocompleteElement {\r\n addEventListener<K extends keyof M3eAutocompleteElementEventMap>(\r\n type: K,\r\n listener: (this: M3eAutocompleteElement, ev: M3eAutocompleteElementEventMap[K]) => void,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n addEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener<K extends keyof M3eAutocompleteElementEventMap>(\r\n type: K,\r\n listener: (this: M3eAutocompleteElement, ev: M3eAutocompleteElementEventMap[K]) => void,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-autocomplete\": M3eAutocompleteElement;\r\n }\r\n}\r\n"],"names":["M3eAutocompleteElement","M3eAutocompleteElement_1","EventAttribute","HtmlFor","LitElement","constructor","super","_M3eAutocompleteElement_id","set","this","__nextId","_M3eAutocompleteElement_menuId","__classPrivateFieldGet","_options","Array","_M3eAutocompleteElement_clone","_M3eAutocompleteElement_ignoreFocusVisible","_M3eAutocompleteElement_menu","_M3eAutocompleteElement_ignoreHideMenuOnBlur","_M3eAutocompleteElement_inputChanged","_M3eAutocompleteElement_hasFocus","_M3eAutocompleteElement_mutationAbortController","_M3eAutocompleteElement_clickHandler","_M3eAutocompleteElement_instances","_M3eAutocompleteElement_handleClick","call","_M3eAutocompleteElement_formFieldPointerDownHandler","_M3eAutocompleteElement_handleFormFieldPointerDown","_M3eAutocompleteElement_focusHandler","_M3eAutocompleteElement_handleFocus","_M3eAutocompleteElement_blurHandler","_M3eAutocompleteElement_handleBlur","_M3eAutocompleteElement_keyDownHandler","e","_M3eAutocompleteElement_inputHandler","_M3eAutocompleteElement_changeHandler","_M3eAutocompleteElement_handleChange","_M3eAutocompleteElement_menuToggleHandler","_M3eAutocompleteElement_menuPointerDownHandler","_listKeyManager","ListKeyManager","withWrap","withHomeAndEnd","withPageUpAndDown","withVerticalOrientation","withSkipPredicate","item","disabled","hidden","onActiveItemChange","activeItem","_M3eAutocompleteElement_activateOption","hideSelectionIndicator","required","autoActivate","caseSensitive","filter","loading","hideNoData","hideLoading","loadingLabel","noDataLabel","resultsLabel","count","panelClass","MutationController","config","childList","subtree","callback","_M3eAutocompleteElement_handleMutation","options","selected","find","x","value","attach","control","HTMLInputElement","autocomplete","role","ariaAutoComplete","ariaExpanded","addEventListener","_M3eAutocompleteElement_formField_get","detach","removeEventListener","clear","restoreFocus","_M3eAutocompleteElement_input_get","_M3eAutocompleteElement_clearOptions","dispatchEvent","Event","bubbles","_M3eAutocompleteElement_filterOptions","focus","_M3eAutocompleteElement_hideMenu","connectedCallback","update","changedProperties","has","setCustomState","M3eLiveAnnouncer","announce","_M3eAutocompleteElement_shouldShowMenu_get","_M3eAutocompleteElement_showMenu","deleteCustomState","render","html","items","querySelector","_M3eAutocompleteElement_options_get","some","length","closest","async","abort","mutationAbortController","AbortController","__classPrivateFieldSet","querySelectorAll","option","signal","aborted","isUpdatePending","updateComplete","cloneNode","added","setItems","forEach","id","indexOf","_M3eAutocompleteElement_projectClone","_M3eAutocompleteElement_updateMenuState","readOnly","CustomEvent","detail","term","composed","defaultPrevented","notifyControlStateChange","label","key","preventDefault","_M3eAutocompleteElement_selectOption","prefersReducedMotion","setTimeout","altKey","onKeyDown","button","stopImmediatePropagation","composedPath","HTMLElement","tagName","setActiveItem","newState","scrollIntoViewIfNeeded","_M3eAutocompleteElement_autoActivate","ToggleEvent","oldState","_M3eAutocompleteElement_destroyMenu","replaceChildren","childNodes","remove","undefined","removeAttribute","requestUpdate","slot","parentElement","document","createElement","klass","split","map","d","trim","Boolean","classList","add","style","overflowX","scrollStrategy","fitAnchorWidth","insertAdjacentElement","setAttribute","input","show","menuAnchor","children","_M3eAutocompleteElement_hasNoDataSlot_get","noDataSpan","textContent","push","_M3eAutocompleteElement_hasLoadingSlot_get","loadingSpan","menu","hide","forceFocusVisible","block","behavior","focusVisible","matches","forcedColorsActive","focusRing","stateLayer","clone","_M3eAutocompleteElement_updateSelectionState","_M3eAutocompleteElement_filterOption","exactTerm","toLowerCase","highlightMode","startsWith","endsWith","includes","disableHighlight","oldCount","shouldAnnounce","toLocaleLowerCase","last","newCount","first","i","_M3eAutocompleteElement_deactivateOption","M3eOptGroupElement","addCustomState","groups","group","every","_M3eAutocompleteElement_announceResults","message","Function","updateActiveItem","styles","css","__decorate","property","attribute","type","prototype","reflect","converter","fromAttribute","customElement"],"mappings":";;;;;uqBAwEO,IAAMA,GAAsBC,GAA5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,UAAW,2BAA4BC,KAAM7D,WAA0ChL,GAAA8O,UAAA,8BAAA,GAMvDJ,EAAA,CAA3CC,EAAS,CAAEE,KAAM7D,QAAS+D,SAAS,KAAyB/O,GAAA8O,UAAA,gBAAA,GAMJJ,EAAA,CAAxDC,EAAS,CAAEC,UAAW,gBAAiBC,KAAM7D,WAAgChL,GAAA8O,UAAA,oBAAA,GAMpBJ,EAAA,CAAzDC,EAAS,CAAEC,UAAW,iBAAkBC,KAAM7D,WAAiChL,GAAA8O,UAAA,qBAAA,GAiBhFJ,EAAA,CAXCC,EAAS,CACRK,UAAW,CACTC,cAActK,GACE,OAAVA,EAAuB,WACb,gBAAVA,GAAqC,cAAVA,GAAmC,aAAVA,GAAkC,SAAVA,EACvEA,EAEF,eAIuF3E,GAAA8O,UAAA,cAAA,GAMvEJ,EAAA,CAA5BC,EAAS,CAAEE,KAAM7D,WAA2BhL,GAAA8O,UAAA,eAAA,GAMWJ,EAAA,CAAvDC,EAAS,CAAEC,UAAW,eAAgBC,KAAM7D,WAA8BhL,GAAA8O,UAAA,kBAAA,GAMnBJ,EAAA,CAAvDC,EAAS,CAAEC,UAAW,eAAgBC,KAAM7D,WAA+BhL,GAAA8O,UAAA,mBAAA,GAMlCJ,EAAA,CAAzCC,EAAS,CAAEC,UAAW,mBAA+C5O,GAAA8O,UAAA,oBAAA,GAM5BJ,EAAA,CAAzCC,EAAS,CAAEC,UAAW,mBAA8C5O,GAAA8O,UAAA,mBAAA,GAM3BJ,EAAA,CAAzCC,EAAS,CAAEC,UAAW,mBACF5O,GAAA8O,UAAA,oBAAA,GAMmBJ,EAAA,CAAvCC,EAAS,CAAEC,UAAW,iBAAiC5O,GAAA8O,UAAA,kBAAA,GA5I7C9O,GAAsBC,GAAAyO,EAAA,CADlCQ,EAAc,qBACFlP"}
1
+ {"version":3,"file":"autocomplete.min.js","sources":["../../src/autocomplete/AutocompleteElement.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, PropertyValues } from \"lit\";\r\nimport { property } from \"lit/decorators.js\";\r\n\r\nimport {\r\n HtmlFor,\r\n prefersReducedMotion,\r\n scrollIntoViewIfNeeded,\r\n forcedColorsActive,\r\n setCustomState,\r\n deleteCustomState,\r\n addCustomState,\r\n customElement,\r\n MutationController,\r\n EventAttribute,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { ListKeyManager, M3eLiveAnnouncer } from \"@m3e/web/core/a11y\";\r\nimport { M3eOptGroupElement, M3eOptionElement, M3eOptionPanelElement } from \"@m3e/web/option\";\r\nimport type { M3eFormFieldElement } from \"@m3e/web/form-field\";\r\n\r\nimport { AutocompleteFilterMode } from \"./AutocompleteFilterMode\";\r\nimport { AutocompleteQueryEventDetail } from \"./AutocompleteQueryEventDetail\";\r\n\r\n/**\r\n * Enhances a text input with suggested options.\r\n *\r\n * @description\r\n * The `m3e-autocomplete` component augments a text input field with a dynamically positioned menu of filterable suggestions,\r\n * following Material Design 3 principles. It provides real-time filtering, keyboard navigation, automatic option activation,\r\n * and text highlighting to guide user selection. The component manages focus, selection state, and menu visibility while\r\n * integrating seamlessly with form field containers and supporting both required and optional selection modes.\r\n *\r\n * @example\r\n * The following example illustrates use of the `m3e-autocomplete` paired with a `m3e-form-field`.\r\n * ```html\r\n * <m3e-form-field>\r\n * <label slot=\"label\" for=\"fruit\">Choose your favorite fruit</label>\r\n * <input id=\"fruit\" />\r\n * </m3e-form-field>\r\n * <m3e-autocomplete for=\"fruit\">\r\n * <m3e-option>Apples</m3e-option>\r\n * <m3e-option>Oranges</m3e-option>\r\n * <m3e-option>Bananas</m3e-option>\r\n * <m3e-option>Grapes</m3e-option>\r\n * </m3e-autocomplete>\r\n * ```\r\n *\r\n * @tag m3e-autocomplete\r\n *\r\n * @attr auto-activate - Whether the first option should be automatically activated.\r\n * @attr case-sensitive - Whether filtering is case sensitive.\r\n * @attr filter - Mode in which to filter options.\r\n * @attr hide-selection-indicator - Whether to hide the selection indicator.\r\n * @attr hide-loading - Whether to hide the menu when loading options.\r\n * @attr hide-no-data - Whether to hide the menu when there are no options to show.\r\n * @attr loading - Whether options are being loaded.\r\n * @attr loading-label - The text announced and presented when loading options.\r\n * @attr no-data-label - The text announced and presented when no options are available for the current term.\r\n * @attr panel-class - Class or list of classes to be applied to the autocomplete's overlay panel.\r\n * @attr required - Whether the user is required to make a selection when interacting with the autocomplete.\r\n * @attr results-label - The text announced when available options change for the current term.\r\n *\r\n * @slot - Renders the options of the autocomplete.\r\n * @slot loading - Renders content when loading options.\r\n * @slot no-data - Renders content when there are no options to show.\r\n *\r\n * @fires toggle - Emitted when the options menu opens or closes.\r\n * @fires query - Emitted when the input is focused or when the user modifies its value.\r\n * @fires change - Emitted when the committed value changes due to selecting an option or clearing the input.\r\n */\r\n@customElement(\"m3e-autocomplete\")\r\nexport class M3eAutocompleteElement extends EventAttribute(HtmlFor(LitElement), \"query\") {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: contents;\r\n }\r\n .options {\r\n display: none;\r\n }\r\n `;\r\n\r\n /** @private */ private static __nextId = 0;\r\n\r\n /** @private */ readonly #id = `m3e-autocomplete-${M3eAutocompleteElement.__nextId}`;\r\n /** @private */ readonly #menuId = `${this.#id}-menu`;\r\n /** @private */ private _options = new Array<M3eOptionElement>();\r\n /** @private */ #clone?: HTMLElement;\r\n /** @private */ #ignoreFocusVisible = false;\r\n /** @private */ #menu?: M3eOptionPanelElement;\r\n /** @private */ #ignoreHideMenuOnBlur = false;\r\n /** @private */ #inputChanged = false;\r\n /** @private */ #hasFocus = false;\r\n /** @private */ #mutationAbortController?: AbortController;\r\n\r\n /** @private */ readonly #clickHandler = () => this.#handleClick();\r\n /** @private */ readonly #formFieldPointerDownHandler = () => this.#handleFormFieldPointerDown();\r\n /** @private */ readonly #focusHandler = () => this.#handleFocus();\r\n /** @private */ readonly #blurHandler = () => this.#handleBlur();\r\n /** @private */ readonly #keyDownHandler = (e: KeyboardEvent) => this.#handleKeyDown(e);\r\n /** @private */ readonly #inputHandler = (e: Event) => this.#handleInput(e);\r\n /** @private */ readonly #changeHandler = () => this.#handleChange();\r\n /** @private */ readonly #menuToggleHandler = (e: ToggleEvent) => this.#handleMenuToggle(e);\r\n /** @private */ readonly #menuPointerDownHandler = (e: PointerEvent) => this.#handleMenuPointerDown(e);\r\n /** @private */ readonly #menuPointerUpHandler = (e: PointerEvent) => this.#handleMenuPointerUp(e);\r\n /** @private */ #menuPressedOption?: M3eOptionElement;\r\n\r\n /** @private */ private readonly _listKeyManager = new ListKeyManager<M3eOptionElement>()\r\n .withWrap()\r\n .withHomeAndEnd()\r\n .withPageUpAndDown()\r\n .withVerticalOrientation()\r\n .withSkipPredicate((item) => item.disabled || item.hidden === true)\r\n .onActiveItemChange(() => {\r\n if (this._listKeyManager.activeItem) {\r\n this.#activateOption(this._listKeyManager.activeItem);\r\n }\r\n });\r\n\r\n constructor() {\r\n super();\r\n\r\n new MutationController(this, {\r\n config: {\r\n childList: true,\r\n subtree: true,\r\n },\r\n callback: () => this.#handleMutation(),\r\n });\r\n }\r\n\r\n /**\r\n * Whether to hide the selection indicator.\r\n * @default false\r\n */\r\n @property({ attribute: \"hide-selection-indicator\", type: Boolean }) hideSelectionIndicator = false;\r\n\r\n /**\r\n * Whether the user is required to make a selection when interacting with the autocomplete.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) required = false;\r\n\r\n /**\r\n * Whether the first option should be automatically activated.\r\n * @default false\r\n */\r\n @property({ attribute: \"auto-activate\", type: Boolean }) autoActivate = false;\r\n\r\n /**\r\n * Whether filtering is case sensitive.\r\n * @default false\r\n */\r\n @property({ attribute: \"case-sensitive\", type: Boolean }) caseSensitive = false;\r\n\r\n /**\r\n * Mode in which to filter options.\r\n * @default \"contains\"\r\n */\r\n @property({\r\n converter: {\r\n fromAttribute(value: string | null): AutocompleteFilterMode {\r\n if (value === null) return \"contains\";\r\n if (value === \"starts-with\" || value === \"ends-with\" || value === \"contains\" || value === \"none\") {\r\n return value;\r\n }\r\n return \"contains\";\r\n },\r\n },\r\n })\r\n filter: AutocompleteFilterMode | ((option: M3eOptionElement, term: string) => boolean) = \"contains\";\r\n\r\n /**\r\n * Whether options are being loaded.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) loading = false;\r\n\r\n /**\r\n * Whether to hide the menu when there are no options to show.\r\n * @default false\r\n */\r\n @property({ attribute: \"hide-no-data\", type: Boolean }) hideNoData = false;\r\n\r\n /**\r\n * Whether to hide the menu when loading options.\r\n * @default false\r\n */\r\n @property({ attribute: \"hide-loading\", type: Boolean }) hideLoading = false;\r\n\r\n /**\r\n * The text announced and presented when loading options.\r\n * @default \"Loading...\"\r\n */\r\n @property({ attribute: \"loading-label\" }) loadingLabel = \"Loading...\";\r\n\r\n /**\r\n * The text announced and presented when no options are available for the current term.\r\n * @default \"No options\"\r\n */\r\n @property({ attribute: \"no-data-label\" }) noDataLabel = \"No options\";\r\n\r\n /**\r\n * The text announced when available options change for the current term.\r\n * @default (count) => `${count} options`\r\n */\r\n @property({ attribute: \"results-label\" }) resultsLabel: string | ((count: number) => string) = (count) =>\r\n `${count} options`;\r\n\r\n /**\r\n * Class or list of classes to be applied to the autocomplete's overlay panel.\r\n * @default \"\"\r\n */\r\n @property({ attribute: \"panel-class\" }) panelClass = \"\";\r\n\r\n /** The options that can be selected. */\r\n get options(): readonly M3eOptionElement[] {\r\n return this._options ?? [];\r\n }\r\n\r\n /** The selected option. */\r\n get selected(): M3eOptionElement | null {\r\n return this.options.find((x) => x.selected) ?? null;\r\n }\r\n\r\n /** The selected (enabled) value. */\r\n get value(): string | null {\r\n const selected = this.selected;\r\n return selected && !selected.disabled ? selected.value : null;\r\n }\r\n\r\n /** @private */\r\n get #options(): readonly M3eOptionElement[] {\r\n return this._listKeyManager?.items ?? [];\r\n }\r\n\r\n /** @private */\r\n get #input(): HTMLInputElement | null {\r\n return this.control ? <HTMLInputElement>this.control : null;\r\n }\r\n\r\n /** @private */\r\n get #hasNoDataSlot(): boolean {\r\n return (this.#clone?.querySelector(\"[slot='no-data']\") ?? null) !== null;\r\n }\r\n\r\n /** @private */\r\n get #hasLoadingSlot(): boolean {\r\n return (this.#clone?.querySelector(\"[slot='loading']\") ?? null) !== null;\r\n }\r\n\r\n /** @private */\r\n get #shouldShowMenu(): boolean {\r\n return (\r\n this.#options.some((x) => x.hidden === false) ||\r\n (this.loading && !this.hideLoading && this.loadingLabel.length > 0) ||\r\n (!this.loading && !this.hideNoData && this.noDataLabel.length > 0)\r\n );\r\n }\r\n\r\n /** @private */\r\n get #formField(): M3eFormFieldElement | null {\r\n return this.control?.closest(\"m3e-form-field\") ?? null;\r\n }\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n if (!(control instanceof HTMLInputElement)) return;\r\n\r\n super.attach(control);\r\n\r\n control.autocomplete = \"off\";\r\n control.role = \"combobox\";\r\n control.ariaAutoComplete = \"list\";\r\n control.ariaExpanded = \"false\";\r\n\r\n control.addEventListener(\"click\", this.#clickHandler);\r\n control.addEventListener(\"focus\", this.#focusHandler);\r\n control.addEventListener(\"blur\", this.#blurHandler);\r\n control.addEventListener(\"keydown\", this.#keyDownHandler);\r\n control.addEventListener(\"input\", this.#inputHandler);\r\n control.addEventListener(\"change\", this.#changeHandler);\r\n\r\n this.#formField?.addEventListener(\"pointerdown\", this.#formFieldPointerDownHandler);\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control) {\r\n this.#formField?.removeEventListener(\"pointerdown\", this.#formFieldPointerDownHandler);\r\n\r\n this.control.role = null;\r\n this.control.ariaAutoComplete = null;\r\n this.control.ariaExpanded = null;\r\n\r\n this.control.removeEventListener(\"click\", this.#clickHandler);\r\n this.control.removeEventListener(\"focus\", this.#focusHandler);\r\n this.control.removeEventListener(\"blur\", this.#blurHandler);\r\n this.control.removeEventListener(\"keydown\", this.#keyDownHandler);\r\n this.control.removeEventListener(\"input\", this.#inputHandler);\r\n this.control.removeEventListener(\"change\", this.#changeHandler);\r\n }\r\n super.detach();\r\n }\r\n\r\n /**\r\n * Clears the value of the element.\r\n * @param [restoreFocus=false] Whether to restore input focus.\r\n */\r\n clear(restoreFocus = false): void {\r\n if (!this.#input) return;\r\n\r\n this.#input.value = \"\";\r\n if (this.#clearOptions()) {\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n this.#filterOptions();\r\n\r\n if (restoreFocus) {\r\n this.#input.focus();\r\n } else {\r\n this.#hideMenu();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.#handleMutation();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"hideNoData\") && this.hideNoData && this.#menu) {\r\n setCustomState(this.#menu, \"-no-data\", false);\r\n }\r\n\r\n if (changedProperties.has(\"loading\")) {\r\n if (this.loading) {\r\n if (this.#hasFocus) {\r\n if (this.loadingLabel) {\r\n M3eLiveAnnouncer.announce(this.loadingLabel, \"polite\");\r\n }\r\n if (!this.#menu && this.#shouldShowMenu) {\r\n this.#showMenu();\r\n }\r\n }\r\n } else if (this.#menu && !this.#shouldShowMenu) {\r\n this.#hideMenu();\r\n } else if (this.#menu) {\r\n deleteCustomState(this.#menu, \"-loading\");\r\n } else if (this.#hasFocus) {\r\n this.#showMenu();\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"options\" aria-hidden=\"true\">\r\n <slot></slot>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n async #handleMutation(): Promise<void> {\r\n if (this.#mutationAbortController) {\r\n this.#mutationAbortController.abort();\r\n }\r\n const mutationAbortController = new AbortController();\r\n this.#mutationAbortController = mutationAbortController;\r\n\r\n const options = [...this.querySelectorAll(\"m3e-option\")];\r\n\r\n for (const option of options) {\r\n if (mutationAbortController.signal.aborted) {\r\n break;\r\n }\r\n if (option.isUpdatePending) {\r\n await option.updateComplete;\r\n }\r\n }\r\n\r\n if (mutationAbortController.signal.aborted) {\r\n return;\r\n }\r\n\r\n this._options = options;\r\n\r\n this.#clone = <HTMLElement>this.cloneNode(true);\r\n\r\n const { added } = this._listKeyManager.setItems([...this.#clone.querySelectorAll(\"m3e-option\")]);\r\n added.forEach((x) => {\r\n x.id = x.id || `${this.#id}-option-${this._listKeyManager.items.indexOf(x)}`;\r\n setCustomState(x, \"-hide-selection-indicator\", this.hideSelectionIndicator);\r\n });\r\n\r\n if (this.#menu) {\r\n const count = this.#filterOptions();\r\n this.#projectClone();\r\n if (!this.#shouldShowMenu) {\r\n this.#hideMenu();\r\n } else {\r\n this.#updateMenuState(this.#menu, count);\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleClick(): void {\r\n this.#ignoreFocusVisible = true;\r\n this.#showMenu();\r\n }\r\n\r\n /** @private */\r\n #handleFormFieldPointerDown(): void {\r\n this.#ignoreHideMenuOnBlur = true;\r\n }\r\n\r\n /** @private */\r\n #handleFocus(): void {\r\n this.#hasFocus = true;\r\n this.#ignoreFocusVisible = true;\r\n\r\n if (this.options.length == 0 && !(<HTMLInputElement>this.control).readOnly) {\r\n this.dispatchEvent(\r\n new CustomEvent<AutocompleteQueryEventDetail>(\"query\", {\r\n detail: { term: this.#input?.value ?? \"\" },\r\n bubbles: true,\r\n composed: true,\r\n }),\r\n );\r\n }\r\n\r\n this.#showMenu();\r\n }\r\n\r\n /** @private */\r\n #handleBlur(): void {\r\n this.#hasFocus = false;\r\n if (!this.#ignoreHideMenuOnBlur) {\r\n this.#hideMenu();\r\n }\r\n this.#ignoreHideMenuOnBlur = false;\r\n }\r\n\r\n /** @private */\r\n #handleInput(e: Event): void {\r\n if (!this.#input || e.defaultPrevented) return;\r\n\r\n this.dispatchEvent(\r\n new CustomEvent<AutocompleteQueryEventDetail>(\"query\", {\r\n detail: { term: this.#input.value },\r\n bubbles: true,\r\n composed: true,\r\n }),\r\n );\r\n\r\n if (this.#input.value === \"\" && this.#clearOptions()) {\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n this.#inputChanged = true;\r\n try {\r\n if (!this.#menu) {\r\n this.#showMenu();\r\n } else {\r\n this.#filterOptions();\r\n if (!this.#shouldShowMenu) {\r\n this.#hideMenu();\r\n }\r\n }\r\n } finally {\r\n this.#inputChanged = false;\r\n this.#formField?.notifyControlStateChange(true);\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleChange(): void {\r\n if (this.#input) {\r\n const selected = this.selected;\r\n if (this.required) {\r\n this.#input.value = selected?.label ?? \"\";\r\n } else if (selected && selected.label !== this.#input.value && this.#clearOptions()) {\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleKeyDown(e: KeyboardEvent): void {\r\n if (e.defaultPrevented) return;\r\n\r\n this.#ignoreFocusVisible = false;\r\n\r\n switch (e.key) {\r\n case \"Backspace\":\r\n case \"Delete\":\r\n if (this.#input && !this.#input.value) {\r\n this.#hideMenu();\r\n }\r\n break;\r\n\r\n case \"Enter\":\r\n if (this.#menu && this._listKeyManager.activeItem) {\r\n e.preventDefault();\r\n this.#selectOption(this._listKeyManager.activeItem);\r\n if (!prefersReducedMotion()) {\r\n setTimeout(() => this.#hideMenu(), 150);\r\n } else {\r\n this.#hideMenu();\r\n }\r\n } else if (this.#menu) {\r\n setTimeout(() => {\r\n if (this.#input && !this.#input.value) {\r\n this.#hideMenu();\r\n }\r\n });\r\n }\r\n break;\r\n\r\n case \"Escape\":\r\n case \"Tab\":\r\n this.#hideMenu();\r\n break;\r\n\r\n case \"Up\":\r\n case \"ArrowUp\":\r\n if (e.altKey) {\r\n this.#hideMenu();\r\n } else {\r\n this._listKeyManager.onKeyDown(e);\r\n }\r\n break;\r\n\r\n case \"Down\":\r\n case \"ArrowDown\":\r\n if (!this.#menu) {\r\n this.#showMenu();\r\n e.preventDefault();\r\n } else {\r\n this._listKeyManager.onKeyDown(e);\r\n }\r\n break;\r\n\r\n default:\r\n this._listKeyManager.onKeyDown(e);\r\n break;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleMenuPointerDown(e: PointerEvent): void {\r\n this.#menuPressedOption = undefined;\r\n\r\n if (e.button === 2) return;\r\n // Prevent click to avoid stealing focus.\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n\r\n const option = <M3eOptionElement | undefined>(\r\n e.composedPath().find((x) => x instanceof HTMLElement && x.tagName === \"M3E-OPTION\")\r\n );\r\n\r\n if (option && !option.disabled) {\r\n this.#menuPressedOption = option;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleMenuPointerUp(e: PointerEvent): void {\r\n const pressedOption = this.#menuPressedOption;\r\n this.#menuPressedOption = undefined;\r\n\r\n if (e.button === 2) return;\r\n\r\n if (!pressedOption) return;\r\n\r\n const option = <M3eOptionElement | undefined>(\r\n e.composedPath().find((x) => x instanceof HTMLElement && x.tagName === \"M3E-OPTION\")\r\n );\r\n\r\n if (option === pressedOption) {\r\n this._listKeyManager.setActiveItem(option);\r\n this.#selectOption(option);\r\n }\r\n\r\n if (!prefersReducedMotion()) {\r\n setTimeout(() => this.#hideMenu(), 150);\r\n } else {\r\n this.#hideMenu();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleMenuToggle(e: ToggleEvent): void {\r\n if (!this.#menu) return;\r\n\r\n if (e.newState !== \"closed\") {\r\n const option = this.#options.find((x) => x.selected && !x.disabled);\r\n if (option) {\r\n this._listKeyManager.setActiveItem(option);\r\n scrollIntoViewIfNeeded(option, this.#menu);\r\n } else {\r\n this.#autoActivate();\r\n }\r\n\r\n this.dispatchEvent(\r\n new ToggleEvent(\"toggle\", {\r\n oldState: e.oldState,\r\n newState: e.newState,\r\n }),\r\n );\r\n } else {\r\n if (prefersReducedMotion()) {\r\n this.#destroyMenu(e);\r\n } else {\r\n // NOTE: use transitionend is preferred but doesn't fire when used here.\r\n // This is a workaround until that is fixed.\r\n setTimeout(() => this.#destroyMenu(e), 100);\r\n }\r\n }\r\n }\r\n\r\n /** @private*/\r\n #destroyMenu(e: ToggleEvent): void {\r\n if (!this.#menu) return;\r\n\r\n this.#clone?.replaceChildren(...this.#menu.childNodes);\r\n\r\n this.#menu.remove();\r\n this.#menu.removeEventListener(\"toggle\", this.#menuToggleHandler);\r\n this.#menu.removeEventListener(\"pointerdown\", this.#menuPointerDownHandler);\r\n this.#menu.removeEventListener(\"pointerup\", this.#menuPointerUpHandler);\r\n this.#menu = undefined;\r\n\r\n if (this.#input) {\r\n this.#input.ariaExpanded = \"false\";\r\n this.#input.removeAttribute(\"aria-controls\");\r\n this.#input.removeAttribute(\"aria-owns\");\r\n this.#input.removeAttribute(\"aria-activedescendant\");\r\n }\r\n this.requestUpdate();\r\n\r\n this.#formField?.notifyControlStateChange();\r\n\r\n this.dispatchEvent(\r\n new ToggleEvent(\"toggle\", {\r\n oldState: e.oldState,\r\n newState: e.newState,\r\n }),\r\n );\r\n\r\n if (this.#input?.slot === \"input\" && this.#input.parentElement?.tagName === \"M3E-INPUT-CHIP-SET\") {\r\n this.#clearOptions();\r\n }\r\n }\r\n\r\n /** @private */\r\n #showMenu(): void {\r\n if (this.#menu || !this.#input || this.#input.readOnly || this.#input.disabled) return;\r\n\r\n const count = this.#filterOptions();\r\n\r\n if (!this.#shouldShowMenu) return;\r\n\r\n this.#menu = document.createElement(\"m3e-option-panel\");\r\n this.#menu.id = this.#menuId;\r\n\r\n if (this.panelClass) {\r\n for (const klass of this.panelClass\r\n .split(/\\s+/)\r\n .map((d) => d.trim())\r\n .filter(Boolean)) {\r\n this.#menu.classList.add(klass);\r\n }\r\n }\r\n\r\n this.#menu.style.overflowX = \"hidden\";\r\n this.#menu.scrollStrategy = \"reposition\";\r\n this.#menu.fitAnchorWidth = true;\r\n this.#menu.addEventListener(\"toggle\", this.#menuToggleHandler);\r\n this.#menu.addEventListener(\"pointerdown\", this.#menuPointerDownHandler);\r\n this.#menu.addEventListener(\"pointerup\", this.#menuPointerUpHandler);\r\n\r\n this.#projectClone();\r\n\r\n this.#updateMenuState(this.#menu, count);\r\n\r\n (this.#formField ?? this.#input).insertAdjacentElement(\"afterend\", this.#menu);\r\n\r\n this.#input.setAttribute(\"aria-controls\", this.#menuId);\r\n this.#input.setAttribute(\"aria-owns\", this.#menuId);\r\n\r\n this.#formField?.notifyControlStateChange();\r\n\r\n if (this._listKeyManager.activeItem && this.autoActivate) {\r\n this.#activateOption(this._listKeyManager.activeItem, true);\r\n }\r\n\r\n const input = this.#input;\r\n setTimeout(() => this.#menu?.show(input, this.#formField?.menuAnchor));\r\n }\r\n\r\n /** @private */\r\n #projectClone(): void {\r\n if (!this.#clone || !this.#menu) return;\r\n const children = [...this.#clone.childNodes];\r\n if (!this.#hasNoDataSlot && this.noDataLabel) {\r\n const noDataSpan = document.createElement(\"span\");\r\n noDataSpan.slot = \"no-data\";\r\n noDataSpan.textContent = this.noDataLabel;\r\n children.push(noDataSpan);\r\n }\r\n if (!this.#hasLoadingSlot && this.loadingLabel) {\r\n const loadingSpan = document.createElement(\"span\");\r\n loadingSpan.slot = \"loading\";\r\n loadingSpan.textContent = this.loadingLabel;\r\n children.push(loadingSpan);\r\n }\r\n this.#menu.replaceChildren(...children);\r\n }\r\n\r\n /** @private */\r\n #updateMenuState(menu: M3eOptionPanelElement, count: number): void {\r\n setCustomState(menu, \"-loading\", this.loading);\r\n setCustomState(menu, \"-no-data\", count == 0);\r\n }\r\n\r\n /** @private */\r\n #hideMenu(): void {\r\n this.#menu?.hide();\r\n }\r\n\r\n /** @private */\r\n #activateOption(option: M3eOptionElement, forceFocusVisible = false): void {\r\n if (!this.#input) return;\r\n\r\n this.#input.setAttribute(\"aria-activedescendant\", option.id);\r\n\r\n if (this.#menu) {\r\n scrollIntoViewIfNeeded(option, this.#menu, { block: \"nearest\", behavior: \"instant\" });\r\n\r\n const focusVisible =\r\n forceFocusVisible ||\r\n (!this.#ignoreFocusVisible && (this.#input.matches(\":focus-visible\") || forcedColorsActive()));\r\n\r\n this.#options.forEach((x) => {\r\n const active = x === option && focusVisible;\r\n if (active) {\r\n x.focusRing?.show();\r\n x.stateLayer?.show(\"focused\");\r\n } else {\r\n x.focusRing?.hide();\r\n x.stateLayer?.hide(\"focused\");\r\n }\r\n });\r\n }\r\n }\r\n\r\n /** @private */\r\n async #updateSelectionState(clone: M3eOptionElement): Promise<void> {\r\n const option = this._options[this._listKeyManager.items.indexOf(clone)];\r\n if (option) {\r\n option.selected = clone.selected;\r\n if (option.isUpdatePending) {\r\n await option.updateComplete;\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n async #selectOption(option: M3eOptionElement): Promise<void> {\r\n if (option.selected) return;\r\n\r\n option.selected = true;\r\n await this.#updateSelectionState(option);\r\n if (option.isUpdatePending) {\r\n await option.updateComplete;\r\n }\r\n\r\n this.requestUpdate();\r\n if (this.isUpdatePending) {\r\n await this.updateComplete;\r\n }\r\n\r\n if (this.#input) {\r\n this.#input.value = option.label;\r\n }\r\n\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n\r\n this.#formField?.notifyControlStateChange(true);\r\n }\r\n\r\n /** @private */\r\n #filterOption(clone: M3eOptionElement, option: M3eOptionElement, term: string, exactTerm: string): boolean {\r\n const value = this.caseSensitive ? option.value : option.value.toLowerCase();\r\n switch (this.filter) {\r\n case \"starts-with\":\r\n clone.term = exactTerm;\r\n clone.highlightMode = this.filter;\r\n return value.startsWith(term);\r\n case \"ends-with\":\r\n clone.term = exactTerm;\r\n clone.highlightMode = this.filter;\r\n return value.endsWith(term);\r\n case \"contains\":\r\n clone.term = exactTerm;\r\n clone.highlightMode = this.filter;\r\n return value.includes(term);\r\n case \"none\":\r\n clone.disableHighlight = true;\r\n return true;\r\n default:\r\n clone.disableHighlight = true;\r\n return this.filter(option, exactTerm);\r\n }\r\n }\r\n\r\n /** @private */\r\n #filterOptions(): number {\r\n if (!this.#input) return 0;\r\n\r\n const oldCount = this.#options.filter((x) => x.hidden === false).length;\r\n const shouldAnnounce = !this.loading && this.#inputChanged;\r\n this.#inputChanged = false;\r\n\r\n const exactTerm = this.#input.value;\r\n const term = this.caseSensitive ? exactTerm : exactTerm.toLocaleLowerCase();\r\n\r\n let newCount = 0;\r\n let first = false;\r\n let last: M3eOptionElement | undefined;\r\n\r\n for (let i = 0; i < this.#options.length; i++) {\r\n const clone = this.#options[i];\r\n const option = this._options[i];\r\n clone.hidden = !this.#filterOption(clone, option, term, exactTerm);\r\n\r\n if (clone.hidden === true) {\r\n this.#deactivateOption(clone);\r\n deleteCustomState(clone, \"-first\");\r\n deleteCustomState(clone, \"-last\");\r\n } else {\r\n newCount++;\r\n if (!first && !(clone.parentElement instanceof M3eOptGroupElement)) {\r\n addCustomState(clone, \"-first\");\r\n first = true;\r\n addCustomState(clone, \"-last\");\r\n last = clone;\r\n } else {\r\n deleteCustomState(clone, \"-first\");\r\n if (last) {\r\n deleteCustomState(last, \"-last\");\r\n }\r\n addCustomState(clone, \"-last\");\r\n last = clone;\r\n }\r\n }\r\n }\r\n\r\n if (this.#menu) {\r\n this.#updateMenuState(this.#menu, newCount);\r\n }\r\n\r\n const groups = this.#menu?.querySelectorAll(\"m3e-optgroup\") ?? this.#clone?.querySelectorAll(\"m3e-optgroup\") ?? [];\r\n for (const group of groups) {\r\n group.hidden = [...group.querySelectorAll(\"m3e-option\")].every((x) => x.hidden === true);\r\n }\r\n\r\n if (shouldAnnounce) {\r\n this.#announceResults(oldCount, newCount);\r\n }\r\n\r\n this.#autoActivate();\r\n return newCount;\r\n }\r\n\r\n /** @private */\r\n #clearOptions(): boolean {\r\n const selected = this._listKeyManager.items.filter((x) => x.selected);\r\n if (selected.length > 0) {\r\n selected.forEach((x) => {\r\n x.selected = false;\r\n this.#updateSelectionState(x);\r\n });\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** @private */\r\n #announceResults(oldCount: number, newCount: number): void {\r\n if (!this.#hasFocus) return;\r\n if (newCount == 0) {\r\n if (oldCount > 0 && this.noDataLabel) {\r\n M3eLiveAnnouncer.announce(this.noDataLabel, \"polite\");\r\n }\r\n } else if (oldCount != newCount) {\r\n const message = this.resultsLabel instanceof Function ? this.resultsLabel(newCount) : this.resultsLabel;\r\n if (message) {\r\n M3eLiveAnnouncer.announce(message, \"polite\");\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #autoActivate(): void {\r\n if (this.autoActivate && (!this._listKeyManager.activeItem || !this._listKeyManager.activeItem.selected)) {\r\n const option = this.#options.find((x) => !x.disabled && x.hidden === false);\r\n if (option) {\r\n this._listKeyManager.setActiveItem(option);\r\n if (this.#menu) {\r\n scrollIntoViewIfNeeded(option, this.#menu, { block: \"nearest\", behavior: \"instant\" });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #deactivateOption(option: M3eOptionElement): void {\r\n option.focusRing?.hide();\r\n option.stateLayer?.hide(\"focused\");\r\n if (option === this._listKeyManager.activeItem) {\r\n this._listKeyManager.updateActiveItem(null);\r\n this.#input?.removeAttribute(\"aria-activedescendant\");\r\n }\r\n }\r\n}\r\n\r\ninterface M3eAutocompleteElementEventMap extends HTMLElementEventMap {\r\n toggle: ToggleEvent;\r\n query: CustomEvent<AutocompleteQueryEventDetail>;\r\n}\r\n\r\nexport interface M3eAutocompleteElement {\r\n addEventListener<K extends keyof M3eAutocompleteElementEventMap>(\r\n type: K,\r\n listener: (this: M3eAutocompleteElement, ev: M3eAutocompleteElementEventMap[K]) => void,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n addEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener<K extends keyof M3eAutocompleteElementEventMap>(\r\n type: K,\r\n listener: (this: M3eAutocompleteElement, ev: M3eAutocompleteElementEventMap[K]) => void,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-autocomplete\": M3eAutocompleteElement;\r\n }\r\n}\r\n"],"names":["M3eAutocompleteElement","M3eAutocompleteElement_1","EventAttribute","HtmlFor","LitElement","constructor","super","_M3eAutocompleteElement_id","set","this","__nextId","_M3eAutocompleteElement_menuId","__classPrivateFieldGet","_options","Array","_M3eAutocompleteElement_clone","_M3eAutocompleteElement_ignoreFocusVisible","_M3eAutocompleteElement_menu","_M3eAutocompleteElement_ignoreHideMenuOnBlur","_M3eAutocompleteElement_inputChanged","_M3eAutocompleteElement_hasFocus","_M3eAutocompleteElement_mutationAbortController","_M3eAutocompleteElement_clickHandler","_M3eAutocompleteElement_instances","_M3eAutocompleteElement_handleClick","call","_M3eAutocompleteElement_formFieldPointerDownHandler","_M3eAutocompleteElement_handleFormFieldPointerDown","_M3eAutocompleteElement_focusHandler","_M3eAutocompleteElement_handleFocus","_M3eAutocompleteElement_blurHandler","_M3eAutocompleteElement_handleBlur","_M3eAutocompleteElement_keyDownHandler","e","_M3eAutocompleteElement_inputHandler","_M3eAutocompleteElement_changeHandler","_M3eAutocompleteElement_handleChange","_M3eAutocompleteElement_menuToggleHandler","_M3eAutocompleteElement_menuPointerDownHandler","_M3eAutocompleteElement_menuPointerUpHandler","_M3eAutocompleteElement_menuPressedOption","_listKeyManager","ListKeyManager","withWrap","withHomeAndEnd","withPageUpAndDown","withVerticalOrientation","withSkipPredicate","item","disabled","hidden","onActiveItemChange","activeItem","_M3eAutocompleteElement_activateOption","hideSelectionIndicator","required","autoActivate","caseSensitive","filter","loading","hideNoData","hideLoading","loadingLabel","noDataLabel","resultsLabel","count","panelClass","MutationController","config","childList","subtree","callback","_M3eAutocompleteElement_handleMutation","options","selected","find","x","value","attach","control","HTMLInputElement","autocomplete","role","ariaAutoComplete","ariaExpanded","addEventListener","_M3eAutocompleteElement_formField_get","detach","removeEventListener","clear","restoreFocus","_M3eAutocompleteElement_input_get","_M3eAutocompleteElement_clearOptions","dispatchEvent","Event","bubbles","_M3eAutocompleteElement_filterOptions","focus","_M3eAutocompleteElement_hideMenu","connectedCallback","update","changedProperties","has","setCustomState","M3eLiveAnnouncer","announce","_M3eAutocompleteElement_shouldShowMenu_get","_M3eAutocompleteElement_showMenu","deleteCustomState","render","html","items","querySelector","_M3eAutocompleteElement_options_get","some","length","closest","async","abort","mutationAbortController","AbortController","__classPrivateFieldSet","querySelectorAll","option","signal","aborted","isUpdatePending","updateComplete","cloneNode","added","setItems","forEach","id","indexOf","_M3eAutocompleteElement_projectClone","_M3eAutocompleteElement_updateMenuState","readOnly","CustomEvent","detail","term","composed","defaultPrevented","notifyControlStateChange","label","key","preventDefault","_M3eAutocompleteElement_selectOption","prefersReducedMotion","setTimeout","altKey","onKeyDown","undefined","button","stopImmediatePropagation","composedPath","HTMLElement","tagName","pressedOption","setActiveItem","newState","scrollIntoViewIfNeeded","_M3eAutocompleteElement_autoActivate","ToggleEvent","oldState","_M3eAutocompleteElement_destroyMenu","replaceChildren","childNodes","remove","removeAttribute","requestUpdate","slot","parentElement","document","createElement","klass","split","map","d","trim","Boolean","classList","add","style","overflowX","scrollStrategy","fitAnchorWidth","insertAdjacentElement","setAttribute","input","show","menuAnchor","children","_M3eAutocompleteElement_hasNoDataSlot_get","noDataSpan","textContent","push","_M3eAutocompleteElement_hasLoadingSlot_get","loadingSpan","menu","hide","forceFocusVisible","block","behavior","focusVisible","matches","forcedColorsActive","focusRing","stateLayer","clone","_M3eAutocompleteElement_updateSelectionState","_M3eAutocompleteElement_filterOption","exactTerm","toLowerCase","highlightMode","startsWith","endsWith","includes","disableHighlight","oldCount","shouldAnnounce","toLocaleLowerCase","last","newCount","first","i","_M3eAutocompleteElement_deactivateOption","M3eOptGroupElement","addCustomState","groups","group","every","_M3eAutocompleteElement_announceResults","message","Function","updateActiveItem","styles","css","__decorate","property","attrib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AMWJ,EAAA,CAAvDC,EAAS,CAAEC,UAAW,eAAgBC,KAAM7D,WAA8BnL,GAAAiP,UAAA,kBAAA,GAMnBJ,EAAA,CAAvDC,EAAS,CAAEC,UAAW,eAAgBC,KAAM7D,WAA+BnL,GAAAiP,UAAA,mBAAA,GAMlCJ,EAAA,CAAzCC,EAAS,CAAEC,UAAW,mBAA+C/O,GAAAiP,UAAA,oBAAA,GAM5BJ,EAAA,CAAzCC,EAAS,CAAEC,UAAW,mBAA8C/O,GAAAiP,UAAA,mBAAA,GAM3BJ,EAAA,CAAzCC,EAAS,CAAEC,UAAW,mBACF/O,GAAAiP,UAAA,oBAAA,GAMmBJ,EAAA,CAAvCC,EAAS,CAAEC,UAAW,iBAAiC/O,GAAAiP,UAAA,kBAAA,GA9I7CjP,GAAsBC,GAAA4O,EAAA,CADlCQ,EAAc,qBACFrP"}
package/dist/avatar.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import { __decorate } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import{__decorate as e}from"tslib";import{css as t,LitElement as a,html as r}from"lit";import{DesignToken as i,customElement as o}from"@m3e/web/core";let l=class extends a{render(){return r`<div class="base"><slot></slot></div>`}};l.styles=t`:host { display: inline-block; vertical-align: middle; aspect-ratio: 1 / 1; width: var(--m3e-avatar-size, 2.5rem); } .base { user-select: none; white-space: nowrap; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: var(--m3e-avatar-shape, ${i.shape.corner.full}); font-size: var(--m3e-avatar-font-size, ${i.typescale.standard.title.medium.fontSize}); font-weight: var(--m3e-avatar-font-weight, ${i.typescale.standard.title.medium.fontWeight}); line-height: var(--m3e-avatar-line-height, ${i.typescale.standard.title.medium.lineHeight}); letter-spacing: var(--m3e-avatar-tracking, ${i.typescale.standard.title.medium.tracking}); background-color: var(--m3e-avatar-color, ${i.color.primaryContainer}); color: var(--m3e-avatar-label-color, ${i.color.onPrimaryContainer}); } ::slotted(img) { display: block; margin: 0 auto; overflow: hidden; object-fit: cover; width: 100%; height: 100%; }`,l=e([o("m3e-avatar")],l);export{l as M3eAvatarElement};
package/dist/badge.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from 'tslib';
package/dist/badge.min.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import{__classPrivateFieldGet as e,__classPrivateFieldSet as t,__decorate as a}from"tslib";import{LitElement as r,html as o,css as s}from"lit";import{property as i}from"lit/decorators.js";import{HtmlFor as l,DesignToken as n,customElement as d}from"@m3e/web/core";import{M3eDirectionality as f}from"@m3e/web/core/bidi";import{positionAnchor as b}from"@m3e/web/core/anchoring";var c,h,m,p,g,v;let x=class extends(l(r)){constructor(){super(...arguments),c.add(this),h.set(this,void 0),m.set(this,void 0),this.size="medium",this.position="above-after"}attach(t){super.attach(t),e(this,c,"m",v).call(this)}detach(){super.detach(),e(this,c,"m",g).call(this)}connectedCallback(){super.connectedCallback(),t(this,h,f.observe(()=>e(this,c,"m",v).call(this)),"f")}disconnectedCallback(){super.disconnectedCallback(),e(this,h,"f")?.call(this)}update(t){super.update(t),(t.has("position")||t.has("size")||t.has("htmlFor"))&&e(this,c,"m",v).call(this)}render(){return o`<div class="base"><slot @slotchange="${e(this,c,"m",p)}"><span aria-hidden="true">&nbsp;</span></slot></div>`}};h=new WeakMap,m=new WeakMap,c=new WeakSet,p=function(){this.isConnected&&this.style.setProperty("--_badge-padding",this.textContent&&this.textContent.length>2?"0 "+("medium"===this.size?"0.25rem":"large"===this.size?"0.5rem":"0"):"")},g=function(){e(this,m,"f")?.call(this),t(this,m,void 0,"f")},v=async function(){if(e(this,c,"m",g).call(this),!this.control)return;let a="top-end";switch(this.position){case"above":a="top";break;case"above-before":a="top-start";break;case"after":a="right";break;case"before":a="left";break;case"below":a="bottom";break;case"below-after":a="bottom-end";break;case"below-before":a="bottom-start"}t(this,m,await b(this,this.control,{position:a},(e,t)=>{this.position.includes("before")&&"before"!==this.position&&("rtl"===f.current?e+=this.clientWidth:e-=this.clientWidth),this.position.includes("after")&&"after"!==this.position&&("rtl"===f.current?e-=this.clientWidth:e+=this.clientWidth),this.style.left=`${e}px`,this.style.top=`${t}px`}),"f")},x.styles=s`:host { display: inline-block; vertical-align: baseline; } .base { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap; vertical-align: baseline; box-sizing: border-box; user-select: none; padding: var(--_badge-padding); border-radius: var(--m3e-badge-shape, ${n.shape.corner.full}); color: var(--m3e-badge-color, ${n.color.onError}); background-color: var(--m3e-badge-container-color, ${n.color.error}); } :host([for]) { position: absolute; z-index: 1; } :host([for][position="above"]) { transform: translateY(var(--_badge-offset, 0px)); } :host([for][position="above-after"]:not(:dir(rtl))) { transform: translate3d(calc(0px - var(--_badge-offset, 0px)), var(--_badge-offset, 0px), 0); } :host([for][position="above-after"]:dir(rtl)) { transform: translate3d(var(--_badge-offset, 0px), var(--_badge-offset, 0px), 0); } :host([for][position="above-before"]:not(:dir(rtl))) { transform: translate3d(var(--_badge-offset, 0px), var(--_badge-offset, 0px), 0); } :host([for][position="above-before"]:dir(rtl)) { transform: translate3d(calc(0px - var(--_badge-offset, 0px)), var(--_badge-offset, 0px), 0); } :host([for][position="below"]) { transform: translateY(calc(0px - var(--_badge-offset, 0px))); } :host([for][position="below-after"]:not(:dir(rtl))) { transform: translate3d(calc(0px - var(--_badge-offset, 0px)), calc(0px - var(--_badge-offset, 0px)), 0); } :host([for][position="below-after"]:dir(rtl)) { transform: translate3d(var(--_badge-offset, 0px), calc(0px - var(--_badge-offset, 0px)), 0); } :host([for][position="below-before"]:not(:dir(rtl))) { transform: translate3d(var(--_badge-offset, 0px), calc(0px - var(--_badge-offset, 0px)), 0); } :host([for][position="below-before"]:dir(rtl)) { transform: translate3d(calc(0px - var(--_badge-offset, 0px)), calc(0px - var(--_badge-offset, 0px)), 0); } :host([for][position="before"]:not(:dir(rtl))), :host([for][position="after"]:dir(rtl)) { transform: translateX(var(--_badge-offset, 0px)); } :host([for][position="before"]:dir(rtl)), :host([for][position="after"]:not(:dir(rtl))) { transform: translateX(calc(0px - var(--_badge-offset, 0px))); } :host([size="small"]) { height: var(--m3e-badge-small-size, 0.375rem); max-height: var(--m3e-badge-small-size, 0.375rem); width: var(--m3e-badge-small-size, 0.375rem); min-width: var(--m3e-badge-small-size, 0.375rem); --_badge-offset: var(--m3e-badge-small-offset, 0.375rem); } :host([size="small"]) .base { font-size: 0; } :host([size="medium"]) { height: var(--m3e-badge-medium-size, 1.375rem); min-width: var(--m3e-badge-medium-size, 1.375rem); --_badge-offset: var(--m3e-badge-small-offset, 0.75rem); } :host([size="medium"]) .base { font-size: var(--m3e-badge-medium-font-size, ${n.typescale.standard.label.small.fontSize}); font-weight: var(--m3e-badge-medium-font-weight, ${n.typescale.standard.label.small.fontWeight}); line-height: var(--m3e-badge-medium-line-height, ${n.typescale.standard.label.small.lineHeight}); letter-spacing: var(--m3e-badge-medium-tracking, ${n.typescale.standard.label.small.tracking}); } :host([size="large"]) { height: var(--m3e-badge-large-size, 1.75rem); min-width: var(--m3e-badge-large-size, 1.75rem); --_badge-offset: var(--m3e-badge-small-offset, 1rem); } :host([size="large"]) .base { font-size: var(--m3e-badge-large-font-size, ${n.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-badge-large-font-weight, ${n.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-badge-large-line-height, ${n.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-badge-large-tracking, ${n.typescale.standard.label.large.tracking}); } @media (forced-colors: active) { .base { background-color: ButtonFace; color: ButtonText; outline: 1px solid ButtonText; } }`,a([i({reflect:!0})],x.prototype,"size",void 0),a([i({reflect:!0})],x.prototype,"position",void 0),x=a([d("m3e-badge")],x);export{x as M3eBadgeElement};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import { __decorate, __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import{__decorate as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{customElement as o,ActionElementBase as s,EventAttribute as n,ReconnectedCallback as a,SuppressInitialAnimation as h,AttachInternals as l,VelocityTracker as r,ScrollLockController as d,InertController as c,ResizeController as m,focusWhenReady as p,setCustomState as f,hasAssignedNodes as u,hasCustomState as b,computeCssSize as g,prefersReducedMotion as v,registerStyleSheet as y,DesignToken as w,spaceSeparatedStringConverter as k,HtmlFor as $}from"@m3e/web/core";import{LitElement as x,nothing as E,html as S,css as H,unsafeCSS as M}from"lit";import{property as _}from"lit/decorators.js";import{M3eInteractivityChecker as z,isModifierAllowed as W,addAriaReferencedId as L,removeAriaReferencedId as B}from"@m3e/web/core/a11y";let C=class extends s{_onClick(){this.closest("m3e-bottom-sheet")?.hide()}};var F,q,Y,A,P,D,R,T,U,I,N,j,K,V,X,G,J,O,Q,Z,tt,et,it,ot,st,nt,at,ht,lt,rt,dt,ct,mt,pt,ft,ut,bt,gt,vt;C=t([o("m3e-bottom-sheet-action")],C);let yt=vt=class extends(n(a(h(l(x))),"opening","opened","cancel","closing","closed")){constructor(){super(...arguments),F.add(this),q.set(this,t=>e(this,F,"m",et).call(this,t)),Y.set(this,t=>e(this,F,"m",it).call(this,t)),A.set(this,()=>e(this,F,"m",ot).call(this)),P.set(this,new r),D.set(this,new d(this)),R.set(this,new c(this)),T.set(this,new m(this,{target:null,skipInitial:!0,callback:t=>e(this,F,"m",ft).call(this,t)})),U.set(this,null),I.set(this,void 0),N.set(this,!1),j.set(this,0),K.set(this,void 0),V.set(this,0),X.set(this,0),G.set(this,void 0),this.modal=!1,this.open=!1,this.handle=!1,this.handleLabel="Drag handle",this.detents=[],this.detent=0,this.hideable=!1,this.hideFriction=.5}show(t=this.detent){this.open?void 0!==t&&e(this,j,"f")!==t&&e(this,F,"m",ut).call(this,t):(i(this,K,t,"f"),this.open=!0)}hide(){this.open=!1}toggle(t){this.open?this.hide():this.show(t)}cycle(){var t;this.open?this.detents.length>0?e(this,j,"f")<this.detents.length-1?(i(this,j,(t=e(this,j,"f"),++t),"f"),e(this,F,"m",ut).call(this,e(this,j,"f"))):this.hideable&&this.hide():this.hide():this.show()}update(t){super.update(t),t.has("modal")&&(this.role=this.modal?"dialog":"region",this.ariaModal=this.modal?"true":null,this.popover=this.modal?"manual":null)}reconnectedCallback(){super.reconnectedCallback(),e(this,F,"m",J).call(this)}firstUpdated(t){super.firstUpdated(t),e(this,F,"m",J).call(this)}updated(t){if(super.updated(t),t.has("open")){if(this.open){if(!this.dispatchEvent(new Event("opening",{cancelable:!0})))return void(this.open=!1);vt.__openSheet!==this&&vt.__openSheet?.hide(),vt.__openSheet=this,this.inert=!1,window.addEventListener("resize",e(this,A,"f")),this.detents.length>0?(i(this,j,Math.min(Math.max(0,e(this,K,"f")??this.detent),this.detents.length-1),"f"),e(this,F,"m",gt).call(this,e(this,F,"m",rt).call(this,this.detents[e(this,j,"f")]))):e(this,F,"m",gt).call(this,Math.min(e(this,F,"m",rt).call(this,"fit"),e(this,F,"m",rt).call(this,"half"))),i(this,K,void 0,"f")}else{if(!this.dispatchEvent(new Event("closing",{cancelable:!0})))return void(this.open=!0);requestAnimationFrame(()=>this.inert=!0),window.removeEventListener("resize",e(this,A,"f")),vt.__openSheet===this&&(vt.__openSheet=void 0)}if(this.modal)if(this.open){i(this,U,document.activeElement,"f"),e(this,R,"f").lock(),e(this,D,"f").lock(),this.showPopover(),requestAnimationFrame(()=>{document.addEventListener("click",e(this,q,"f")),document.addEventListener("keydown",e(this,Y,"f"))});let t=this.querySelector("[autofocus]");t&&z.isFocusable(t)||(t=this.shadowRoot?.querySelector(".handle")),t&&p(t)}else e(this,F,"m",bt).call(this,0).then(()=>{e(this,R,"f").unlock(),e(this,D,"f").unlock(),document.removeEventListener("click",e(this,q,"f")),document.removeEventListener("keydown",e(this,Y,"f")),this.hidePopover(),e(this,U,"f")instanceof HTMLElement&&e(this,U,"f").focus(),i(this,U,null,"f")});this.dispatchEvent(new Event(this.open?"opened":"closed"))}}render(){return S`<m3e-focus-trap ?disabled="${!this.modal}"><div class="base"><m3e-elevation class="elevation"></m3e-elevation><div class="header" @pointerdown="${e(this,F,"m",Q)}" @pointermove="${e(this,F,"m",Z)}" @pointerup="${e(this,F,"m",tt)}">${this.handle?S`<div class="handle-row"><div id="handle" class="handle" role="button" aria-label="${this.handleLabel}" tabindex="0" @click="${e(this,F,"m",st)}" @keydown="${e(this,F,"m",nt)}"><m3e-focus-ring class="focus-ring" for="handle"></m3e-focus-ring><div class="handle-touch" aria-hidden="true"></div></div></div>`:E}<slot name="header" @slotchange="${e(this,F,"m",O)}"></slot></div><div class="body"><div class="content"><slot></slot></div></div></div></m3e-focus-trap>`}};q=new WeakMap,Y=new WeakMap,A=new WeakMap,P=new WeakMap,D=new WeakMap,R=new WeakMap,T=new WeakMap,U=new WeakMap,I=new WeakMap,N=new WeakMap,j=new WeakMap,K=new WeakMap,V=new WeakMap,X=new WeakMap,G=new WeakMap,F=new WeakSet,J=function(){const t=this.shadowRoot?.querySelector(".content");t&&(i(this,V,t.clientHeight,"f"),e(this,T,"f").observe(t));const o=this.shadowRoot?.querySelector(".header");o&&(i(this,X,o.clientHeight,"f"),e(this,T,"f").observe(o))},O=function(t){f(this,"has-header",u(t.target))},Q=function(t){t.target instanceof HTMLElement&&z.isFocusable(t.target)||(t.target.setPointerCapture(t.pointerId),t.target.style.cursor="grabbing",e(this,P,"f").reset(),e(this,P,"f").add(t.clientY),i(this,I,{startY:t.clientY,startHeight:this.clientHeight,maxHeight:e(this,F,"m",dt).call(this),minHeight:e(this,F,"m",ct).call(this)},"f"),i(this,N,!1,"f"))},Z=function(t){if(!e(this,I,"f"))return;if(Math.abs(t.clientY-e(this,I,"f").startY)<=8)return;(t.getCoalescedEvents?.()??[t]).forEach(i=>e(this,P,"f").add(i.clientY,t.timeStamp));let o=e(this,I,"f").startHeight-(t.clientY-e(this,I,"f").startY);if(o<e(this,I,"f").minHeight){const t=(e(this,I,"f").minHeight-o)*this.hideFriction;o=e(this,I,"f").minHeight-t}e(this,F,"m",gt).call(this,Math.min(e(this,I,"f").maxHeight,o)),i(this,N,!0,"f")},tt=function(t){if(e(this,I,"f"))try{if(t.target.releasePointerCapture(t.pointerId),t.target.style.cursor="",!e(this,N,"f"))return;const i="touch"===t.pointerType?1200:500,o=e(this,P,"f").getVelocity();if(e(this,P,"f").reset(),this.hideable&&o>=i)this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide();else if(Math.abs(o)>=i)if(this.detents.length>0){const t=e(this,F,"m",at).call(this);t!==e(this,j,"f")&&e(this,F,"m",ut).call(this,t)}else e(this,F,"m",bt).call(this,e(this,F,"m",rt).call(this,"full"));else{const t=20;if(this.hideable){const i=e(this,I,"f").minHeight;if(this.clientHeight<i-t)return void this.hide()}this.detents.length>0?e(this,F,"m",ut).call(this,e(this,F,"m",lt).call(this)):this.clientHeight<e(this,I,"f").minHeight&&e(this,F,"m",bt).call(this,e(this,I,"f").minHeight)}}finally{i(this,I,void 0,"f")}},et=function(t){this.open&&this.modal&&!t.composedPath().includes(this)&&this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide()},it=function(t){this.open&&this.modal&&"Escape"===t.key&&!t.shiftKey&&!t.ctrlKey&&(t.preventDefault(),this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide())},ot=function(){if(this.detents.length>0&&"half"===this.detents[e(this,j,"f")])return void e(this,F,"m",gt).call(this,e(this,F,"m",rt).call(this,"half"));const t=e(this,F,"m",dt).call(this);(b(this,"-full")||this.clientHeight>t)&&e(this,F,"m",gt).call(this,t)},st=function(){e(this,N,"f")||this.cycle(),i(this,N,!1,"f")},nt=function(t){if(!t.defaultPrevented&&W(t))switch(t.key){case"Up":case"ArrowUp":if(t.preventDefault(),this.detents.length>0){const t=e(this,F,"m",at).call(this);t!==e(this,j,"f")&&e(this,F,"m",ut).call(this,t)}else e(this,F,"m",bt).call(this,e(this,F,"m",rt).call(this,"full"));break;case"Down":case"ArrowDown":if(t.preventDefault(),this.detents.length>0){const t=e(this,F,"m",ht).call(this);t!==e(this,j,"f")?e(this,F,"m",ut).call(this,t):this.hideable&&this.hide()}else this.hideable&&this.hide()}},at=function(){const t=this.clientHeight;let i=1/0,o=e(this,j,"f");for(let s=0;s<this.detents.length;s++){if(s===e(this,j,"f"))continue;const n=e(this,F,"m",rt).call(this,this.detents[s]);n>t&&n<i&&(i=n,o=s)}return o},ht=function(){const t=this.clientHeight;let i=-1/0,o=e(this,j,"f");for(let s=0;s<this.detents.length;s++){if(s===e(this,j,"f"))continue;const n=e(this,F,"m",rt).call(this,this.detents[s]);n<t&&n>i&&(i=n,o=s)}return o},lt=function(){const t=this.clientHeight;let i=e(this,j,"f"),o=1/0;for(let s=0;s<this.detents.length;s++){const n=e(this,F,"m",rt).call(this,this.detents[s]),a=Math.abs(t-n);a<o&&(o=a,i=s)}return i},rt=function(t){switch(t){case"collapsed":return e(this,F,"m",ct).call(this);case"half":return.5*e(this,F,"m",dt).call(this);case"full":return e(this,F,"m",dt).call(this);case"fit":return e(this,F,"m",pt).call(this)}return t.endsWith("%")?e(this,F,"m",dt).call(this)*(parseFloat(t)/100):t.endsWith("px")?parseFloat(t):e(this,F,"m",ct).call(this)},dt=function(){const t=this.shadowRoot?.querySelector(".base");return window.innerHeight-(t?g(t,"var(--_bottom-sheet-top-space)"):0)},ct=function(){return this.detents.includes("fit")&&!this.detents.includes("collapsed")?e(this,F,"m",pt).call(this):e(this,F,"m",mt).call(this)},mt=function(){const t=this.shadowRoot?.querySelector(".base");return e(this,X,"f")+(t?g(t,"var(--_bottom-sheet-peek-height)"):0)},pt=function(){const t=this.shadowRoot?.querySelector(".body");if(!t)return 0;const i=getComputedStyle(t);return e(this,X,"f")+e(this,V,"f")+parseFloat(i.paddingBlockStart)+parseFloat(i.paddingBlockEnd)},ft=function(t){const o=e(this,V,"f"),s=e(this,X,"f");for(const e of t)e.target.classList.contains("content")?i(this,V,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f"):e.target.classList.contains("header")&&i(this,X,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f");if(this.open&&this.detents.length>0&&(o!==e(this,V,"f")||s!==e(this,X,"f")))switch(this.detents[e(this,j,"f")]){case"fit":e(this,F,"m",gt).call(this,e(this,F,"m",pt).call(this));break;case"collapsed":e(this,F,"m",gt).call(this,e(this,F,"m",ct).call(this))}},ut=function(t){t>=0&&t<this.detents.length&&(i(this,j,t,"f"),e(this,F,"m",bt).call(this,e(this,F,"m",rt).call(this,this.detents[t])))},bt=async function(t){e(this,G,"f")&&(e(this,F,"m",gt).call(this,this.clientHeight),e(this,G,"f")?.cancel(),i(this,G,void 0,"f")),v()?e(this,F,"m",gt).call(this,t):(i(this,G,this.animate([{"--_bottom-sheet-height":`${this.clientHeight}px`},{"--_bottom-sheet-height":`${t}px`}],{duration:250,easing:"cubic-bezier(0.2, 0.0, 0, 1.0)"}),"f"),e(this,G,"f").onfinish=()=>{e(this,F,"m",gt).call(this,t),i(this,G,void 0,"f")},await e(this,G,"f").finished)},gt=function(t){this.style.setProperty("--_bottom-sheet-height",`${t}px`),f(this,"-full",t===e(this,F,"m",dt).call(this));const i=this.shadowRoot?.querySelector(".content");i&&(i.inert=t<=e(this,F,"m",mt).call(this))},y(H`@property --_bottom-sheet-height { syntax: "<length>"; inherits: false; initial-value: 50vh; } m3e-bottom-sheet > [slot="header"] { margin-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); margin-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); }</length>`),yt.styles=H`:host { display: block; position: fixed; left: 50%; top: calc(100vh - var(--_bottom-sheet-height)); margin: 0; padding: 0; outline: none; overflow: hidden; border: none; box-sizing: border-box; width: var(--m3e-bottom-sheet-width, 100%); max-width: var(--m3e-bottom-sheet-max-width, 40rem); height: var(--_bottom-sheet-height); color: var(--m3e-bottom-sheet-color, ${w.color.onSurface}); background-color: var(--m3e-bottom-sheet-container-color, ${w.color.surfaceContainerLow}); } :host(:not(:state(-no-animate))) { transition: ${M(`transform ${w.motion.duration.medium2} ${w.motion.easing.standardDecelerate},\n border-radius ${w.motion.duration.medium2} ${w.motion.easing.standard}`)}; } :host(:not([modal]):not(:state(-full))) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-elevation, ${w.elevation.level1}); } :host([modal]:not(:state(-full))) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-modal-elevation, ${w.elevation.level1}); } :host(:state(-full)) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-full-elevation, ${w.elevation.level1}); } :host(:not([modal])) { z-index: var(--m3e-bottom-sheet-z-index, 10); } :host(:not([modal]):not([open])), :host([modal]:not(:popover-open)) { border-radius: var(--m3e-bottom-sheet-minimized-container-shape, ${w.shape.corner.none}); transform: translateX(-50%) translateY(100%); } :host(:not([modal])[open]:not(:state(-full))), :host([modal]:not(:state(-full)):popover-open) { border-radius: var(--m3e-bottom-sheet-container-shape, ${w.shape.corner.extraLargeTop}); } :host(:not([modal])[open]:state(-full)), :host([modal]:state(-full):popover-open) { border-radius: var(--m3e-bottom-sheet-full-container-shape, ${w.shape.corner.extraLargeTop}); } :host(:not([modal])[open]), :host([modal]:popover-open) { transform: translateX(-50%) translateY(0); } :host([modal]:not(:state(-no-animate)))::backdrop { transition: ${M(`background-color ${w.motion.duration.short3} ${w.motion.easing.standard}, \n overlay ${w.motion.duration.short3} ${w.motion.easing.standard} allow-discrete,\n visibility ${w.motion.duration.short3} ${w.motion.easing.standard} allow-discrete`)}; } :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${w.color.scrim}) var(--m3e-bottom-sheet-scrim-opacity, 32%), transparent ); } :host([modal]:popover-open:not(:state(-no-animate)))::backdrop { transition: ${M(`background-color ${w.motion.duration.long2} ${w.motion.easing.standard}, \n overlay ${w.motion.duration.long2} ${w.motion.easing.standard} allow-discrete,\n visibility ${w.motion.duration.long2} ${w.motion.easing.standard} allow-discrete`)}; } @starting-style { :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${w.color.scrim}) 0%, transparent ); } } .base { display: flex; border-radius: inherit; flex-direction: column; height: 100%; --_bottom-sheet-peek-height: var(--m3e-bottom-sheet-peek-height, 0); --_bottom-sheet-top-space: var(--m3e-bottom-sheet-compact-top-space, 4.5rem); } @media (max-height: 640px) { .base { --_bottom-sheet-top-space: var(--m3e-bottom-sheet-top-space, 3.5rem); } } .body { flex: 1 1 auto; overflow-y: auto; scrollbar-width: ${w.scrollbar.thinWidth}; scrollbar-color: ${w.scrollbar.color}; padding-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); padding-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); font-size: var(--m3e-bottom-sheet-content-font-size, ${w.typescale.standard.body.medium.fontSize}); font-weight: var( --m3e-bottom-sheet-content-font-weight, ${w.typescale.standard.body.medium.fontWeight} ); line-height: var( --m3e-bottom-sheet-content-line-height, ${w.typescale.standard.body.medium.lineHeight} ); letter-spacing: var(--m3e-bottom-sheet-content-tracking, ${w.typescale.standard.body.medium.tracking}); } .content { height: fit-content; } :host(:not([handle])) .header { display: none; } :host(:not([handle])) .body, .header { border-top-left-radius: inherit; border-top-right-radius: inherit; padding-block-start: var(--m3e-bottom-sheet-padding-block, 0.5rem); font-size: var(--m3e-bottom-sheet-header-font-size, ${w.typescale.standard.title.large.fontSize}); font-weight: var(--m3e-bottom-sheet-header-font-weight, ${w.typescale.standard.title.large.fontWeight}); line-height: var(--m3e-bottom-sheet-header-line-height, ${w.typescale.standard.title.large.lineHeight}); letter-spacing: var(--m3e-bottom-sheet-header-tracking, ${w.typescale.standard.title.large.tracking}); } .header { cursor: grab; touch-action: none; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); box-sizing: border-box; flex: none; display: flex; flex-direction: column; min-height: 3rem; --m3e-app-bar-container-color: var(--m3e-bottom-sheet-container-color, ${w.color.surfaceContainerLow}); } .handle-row { position: relative; flex: none; display: flex; align-items: center; justify-content: center; opacity: 1; visibility: visible; height: var(--m3e-bottom-sheet-handle-container-height, 1.5rem); } :host(:not(:state(-no-animate))) .handle-row { transition: ${M(`opacity ${w.motion.duration.short3} ${w.motion.easing.standard},\n padding ${w.motion.duration.short3} ${w.motion.easing.standard},\n height ${w.motion.duration.short3} ${w.motion.easing.standard},\n visibility ${w.motion.duration.short3} ${w.motion.easing.standard} allow-discrete`)}; } .handle { position: relative; width: var(--m3e-bottom-sheet-handle-width, 2rem); height: var(--m3e-bottom-sheet-handle-height, 4px); border-radius: var(--m3e-bottom-sheet-handle-shape, ${w.shape.corner.full}); background-color: var(--m3e-bottom-sheet-handle-color, ${w.color.onSurfaceVariant}); } .handle-touch { position: absolute; aspect-ratio: 1 / 1; height: 3rem; left: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); right: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); top: calc( 0px - calc( calc(3rem - var(--m3e-bottom-sheet-handle-container-height, 1.5rem)) - calc( var(--m3e-bottom-sheet-handle-height, 4px) / 2 ) ) ); } @media (prefers-reduced-motion) { :host(:not(:state(-no-animate))), :host([modal]:not(:state(-no-animate)))::backdrop, :host([modal]:popover-open:not(:state(-no-animate)))::backdrop, :host(:not(:state(-no-animate))) .handle-row { transition: none; } } @media (forced-colors: active) { :host([modal]:not(:state(-no-animate)))::backdrop, :host([modal]:popover-open:not(:state(-no-animate)))::backdrop { transition: none; } .base { border-style: solid; border-width: 1px; border-color: CanvasText; } .handle { background-color: ButtonText; } }`,t([_({type:Boolean,reflect:!0})],yt.prototype,"modal",void 0),t([_({type:Boolean,reflect:!0})],yt.prototype,"open",void 0),t([_({type:Boolean})],yt.prototype,"handle",void 0),t([_({attribute:"handle-label"})],yt.prototype,"handleLabel",void 0),t([_({attribute:"detents",converter:k})],yt.prototype,"detents",void 0),t([_({type:Number})],yt.prototype,"detent",void 0),t([_({type:Boolean,reflect:!0})],yt.prototype,"hideable",void 0),t([_({attribute:"hide-friction",type:Number})],yt.prototype,"hideFriction",void 0),yt=vt=t([o("m3e-bottom-sheet")],yt);let wt=class extends($(s)){constructor(){super(...arguments),this.secondary=!1}attach(t){t instanceof yt&&(super.attach(t),this.parentElement&&(t.modal?this.parentElement.ariaHasPopup="dialog":this.secondary||(this.parentElement.ariaExpanded="false",L(this.parentElement,"aria-controls",t.id),this.parentElement.id&&L(t,"aria-labelledby",this.parentElement.id))))}detach(){this.control&&this.parentElement&&!this.secondary&&B(this.parentElement,"aria-controls",this.control.id),super.detach()}_onClick(){this.control instanceof yt&&(this.control.modal?this.control.show(this.detent):(this.control.toggle(this.detent),!this.secondary&&this.parentElement&&(this.parentElement.ariaExpanded=`${this.control.open}`)))}};t([_({type:Number})],wt.prototype,"detent",void 0),t([_({type:Boolean})],wt.prototype,"secondary",void 0),wt=t([o("m3e-bottom-sheet-trigger")],wt);export{C as M3eBottomSheetActionElement,yt as M3eBottomSheetElement,wt as M3eBottomSheetTriggerElement};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import { __classPrivateFieldGet, __decorate } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import{__classPrivateFieldGet as e,__decorate as t}from"tslib";import{LitElement as a,html as s,css as r}from"lit";import{query as n,property as o,queryAssignedElements as l}from"lit/decorators.js";import{Role as i,PressedController as d,setCustomState as c,addCustomState as p,isSelectedMixin as u,DesignToken as h,customElement as m}from"@m3e/web/core";var g,b,v,f;let x=class extends(i(a,"group")){constructor(){super(...arguments),g.add(this),b.set(this,new d(this,{target:null,capture:!0,minPressedDuration:150,isPressedKey:e=>" "===e,callback:e=>{this._base&&(e&&"connected"!==this.variant?(this._base.classList.add("pressed"),this._base.style.setProperty("--_button-group-width",`${this._base.getBoundingClientRect().width}px`)):(this._base.style.removeProperty("--_button-group-width"),this._base.classList.remove("pressed")))}})),this.variant="standard",this.size="small",this.multi=!1}connectedCallback(){super.connectedCallback(),this.hasAttribute("disable-role")&&(this.role=null)}disconnectedCallback(){super.disconnectedCallback(),this._base?.style.removeProperty("--_button-group-width"),this._base?.classList.remove("pressed")}update(t){super.update(t),(t.has("multi")||t.has("variant"))&&e(this,g,"m",v).call(this),t.has("variant")&&this._base?.style.removeProperty("--_button-group-width")}render(){return s`<div class="base"><slot @slotchange="${e(this,g,"m",v)}" @change="${e(this,g,"m",f)}"></slot></div>`}};b=new WeakMap,g=new WeakSet,v=function(){const t=this.buttons;for(const t of e(this,b,"f").targets)e(this,b,"f").unobserve(t);const a=[...t].some(e=>e.toggle);this.hasAttribute("disable-role")||(this.role=a&&!this.multi?"radiogroup":"group");const s="radiogroup"===this.role?"radio":"button";t.forEach((a,r)=>{if(e(this,b,"f").observe(a),c(a,"-connected","connected"===this.variant),p(a,"-grouped"),c(a,"-first",0==r),c(a,"-last",r==t.length-1),!this.hasAttribute("disable-role")&&a.role!==s&&a.toggle){const e=a.toggle?a.selected?"true":"false":null;a.role=s,"button"===a.role?(a.ariaPressed=e,a.ariaChecked=null):(a.ariaChecked=e,a.ariaPressed=null)}})},f=function(e){if(!this.multi&&e.target instanceof HTMLElement&&("M3E-BUTTON"===e.target.tagName||"M3E-ICON-BUTTON"===e.target.tagName)){if(!u(e.target)||!e.target.selected)return;for(const t of this.buttons)t!==e.target&&t.selected&&(t.selected=!1)}},x.styles=r`:host { display: flex; vertical-align: middle; flex-wrap: nowrap; align-items: center; } .base { display: flex; vertical-align: middle; flex-wrap: nowrap; align-items: center; } :host([variant="standard"]) { justify-content: center; } :host([variant="connected"]) .base { flex: 1 1 auto; } :host([variant="standard"]) .base { width: fit-content; flex: none; } :host([variant="standard"]) .base.pressed { justify-content: space-between; width: var(--_button-group-width); } :host([variant="standard"][size="extra-small"]) .base { column-gap: var(--m3e-standard-button-group-extra-small-spacing, 1.125rem); } :host([variant="standard"][size="small"]) .base { column-gap: var(--m3e-standard-button-group-small-spacing, 0.75rem); } :host([variant="standard"][size="medium"]).base { column-gap: var(--m3e-standard-button-group-medium-spacing, 0.5rem); } :host([variant="standard"][size="large"]) .base { column-gap: var(--m3e-standard-button-group-large-spacing, 0.5rem); } :host([variant="standard"][size="extra-large"]) .base { column-gap: var(--m3e-standard-button-group-extra-large-spacing, 0.5rem); } :host([variant="connected"]) .base { column-gap: var(--m3e-connected-button-group-spacing, 0.125rem); } :host([variant="connected"][size="extra-small"]) ::slotted(:state(-first)[size="extra-small"]), :host([variant="connected"][size="extra-small"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="extra-small"]) { --_button-rounded-end-shape: var( --m3e-connected-button-group-extra-small-inner-shape, ${h.shape.corner.small} ); --_button-square-end-shape: var( --m3e-connected-button-group-extra-small-inner-shape, ${h.shape.corner.small} ); --_button-square-end-pressed-shape: var( --m3e-connected-button-group-extra-small-inner-pressed-shape, ${h.shape.corner.extraSmall} ); } :host([variant="connected"][size="extra-small"]) ::slotted(:state(-last)[size="extra-small"]), :host([variant="connected"][size="extra-small"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="extra-small"]) { --_button-rounded-start-shape: var( --m3e-connected-button-group-extra-small-inner-shape, ${h.shape.corner.small} ); --_button-square-start-shape: var( --m3e-connected-button-group-extra-small-inner-shape, ${h.shape.corner.small} ); --_button-square-start-pressed-shape: var( --m3e-connected-button-group-extra-small-inner-pressed-shape, ${h.shape.corner.extraSmall} ); } :host([variant="connected"][size="small"]) ::slotted(:state(-first)[size="small"]), :host([variant="connected"][size="small"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="small"]) { --_button-rounded-end-shape: var( --m3e-connected-button-group-small-inner-shape, ${h.shape.corner.small} ); --_button-square-end-shape: var( --m3e-connected-button-group-small-inner-shape, ${h.shape.corner.small} ); --_button-end-shape-pressed-morph: var( --m3e-connected-button-group-small-inner-pressed-shape, ${h.shape.corner.extraSmall} ); } :host([variant="connected"][size="small"]) ::slotted(:state(-last)[size="small"]), :host([variant="connected"][size="small"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="small"]) { --_button-rounded-start-shape: var( --m3e-connected-button-group-small-inner-shape, ${h.shape.corner.small} ); --_button-square-start-shape: var( --m3e-connected-button-group-small-inner-shape, ${h.shape.corner.small} ); --_button-start-shape-pressed-morph: var( --m3e-connected-button-group-small-inner-pressed-shape, ${h.shape.corner.extraSmall} ); } :host([variant="connected"][size="medium"]) ::slotted(:state(-first)[size="medium"]), :host([variant="connected"][size="medium"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="medium"]) { --_button-rounded-end-shape: var( --m3e-connected-button-group-medium-inner-shape, ${h.shape.corner.small} ); --_button-square-end-shape: var( --m3e-connected-button-group-medium-inner-shape, ${h.shape.corner.small} ); --_button-square-end-pressed-shape: var( --m3e-connected-button-group-medium-inner-pressed-shape, ${h.shape.corner.extraSmall} ); } :host([variant="connected"][size="medium"]) ::slotted(:state(-last)[size="medium"]), :host([variant="connected"][size="medium"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="medium"]) { --_button-rounded-start-shape: var( --m3e-connected-button-group-medium-inner-shape, ${h.shape.corner.small} ); --_button-square-start-shape: var( --m3e-connected-button-group-medium-inner-shape, ${h.shape.corner.small} ); --_button-square-start-pressed-shape: var( --m3e-connected-button-group-medium-inner-pressed-shape, ${h.shape.corner.extraSmall} ); } :host([variant="connected"][size="large"]) ::slotted(:state(-first)[size="large"]), :host([variant="connected"][size="large"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="large"]) { --_button-rounded-end-shape: var( --m3e-connected-button-group-large-inner-shape, ${h.shape.corner.large} ); --_button-square-end-shape: var( --m3e-connected-button-group-large-inner-shape, ${h.shape.corner.large} ); --_button-square-end-pressed-shape: var( --m3e-connected-button-group-large-inner-pressed-shape, ${h.shape.corner.medium} ); } :host([variant="connected"][size="large"]) ::slotted(:state(-last)[size="large"]), :host([variant="connected"][size="large"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="large"]) { --_button-rounded-start-shape: var( --m3e-connected-button-group-large-inner-shape, ${h.shape.corner.large} ); --_button-square-start-shape: var( --m3e-connected-button-group-large-inner-shape, ${h.shape.corner.large} ); --_button-square-start-pressed-shape: var( --m3e-connected-button-group-large-inner-pressed-shape, ${h.shape.corner.medium} ); } :host([variant="connected"][size="extra-large"]) ::slotted(:state(-first)[size="extra-large"]), :host([variant="connected"][size="extra-large"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="extra-large"]) { --_button-rounded-end-shape: var( --m3e-connected-button-group-extra-large-inner-shape, ${h.shape.corner.largeIncreased} ); --_button-square-end-shape: var( --m3e-connected-button-group-extra-large-inner-shape, ${h.shape.corner.largeIncreased} ); --_button-square-end-pressed-shape: var( --m3e-connected-button-group-extra-large-inner-pressed-shape, ${h.shape.corner.large} ); } :host([variant="connected"][size="extra-large"]) ::slotted(:state(-last)[size="extra-large"]), :host([variant="connected"][size="extra-large"]) ::slotted(:not(:state(-first)):not(:state(-last))[size="extra-large"]) { --_button-rounded-start-shape: var( --m3e-connected-button-group-extra-large-inner-shape, ${h.shape.corner.largeIncreased} ); --_button-square-start-shape: var( --m3e-connected-button-group-extra-large-inner-shape, ${h.shape.corner.largeIncreased} ); --_button-square-start-pressed-shape: var( --m3e-connected-button-group-extra-large-inner-pressed-shape, ${h.shape.corner.large} ); }`,t([n(".base")],x.prototype,"_base",void 0),t([o({reflect:!0})],x.prototype,"variant",void 0),t([o({reflect:!0})],x.prototype,"size",void 0),t([o({type:Boolean})],x.prototype,"multi",void 0),t([l({slot:"",selector:"m3e-button,m3e-icon-button",flatten:!0})],x.prototype,"buttons",void 0),x=t([m("m3e-button-group")],x);export{x as M3eButtonGroupElement};
package/dist/button.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license MIT
3
- * Copyright (c) 2025 matraic
3
+ * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
6
  import { __classPrivateFieldGet, __decorate } from 'tslib';