@m3e/web 2.5.4 → 2.5.6

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 (273) hide show
  1. package/README.md +1 -1
  2. package/dist/all.js +667 -532
  3. package/dist/all.js.map +1 -1
  4. package/dist/all.min.js +56 -56
  5. package/dist/all.min.js.map +1 -1
  6. package/dist/autocomplete.js +15 -15
  7. package/dist/autocomplete.js.map +1 -1
  8. package/dist/autocomplete.min.js +1 -1
  9. package/dist/autocomplete.min.js.map +1 -1
  10. package/dist/bottom-sheet.js +15 -18
  11. package/dist/bottom-sheet.js.map +1 -1
  12. package/dist/bottom-sheet.min.js +1 -1
  13. package/dist/bottom-sheet.min.js.map +1 -1
  14. package/dist/breadcrumb.js +5 -5
  15. package/dist/breadcrumb.js.map +1 -1
  16. package/dist/breadcrumb.min.js +1 -1
  17. package/dist/breadcrumb.min.js.map +1 -1
  18. package/dist/button-group.js +5 -5
  19. package/dist/button-group.js.map +1 -1
  20. package/dist/button-group.min.js +1 -1
  21. package/dist/button-group.min.js.map +1 -1
  22. package/dist/button.js +22 -23
  23. package/dist/button.js.map +1 -1
  24. package/dist/button.min.js +1 -1
  25. package/dist/button.min.js.map +1 -1
  26. package/dist/calendar.js +1 -1
  27. package/dist/calendar.js.map +1 -1
  28. package/dist/calendar.min.js.map +1 -1
  29. package/dist/card.js +1 -1
  30. package/dist/card.js.map +1 -1
  31. package/dist/card.min.js.map +1 -1
  32. package/dist/checkbox.js +11 -10
  33. package/dist/checkbox.js.map +1 -1
  34. package/dist/checkbox.min.js +1 -1
  35. package/dist/checkbox.min.js.map +1 -1
  36. package/dist/chips.js +26 -25
  37. package/dist/chips.js.map +1 -1
  38. package/dist/chips.min.js +1 -1
  39. package/dist/chips.min.js.map +1 -1
  40. package/dist/core-a11y.js +5 -3
  41. package/dist/core-a11y.js.map +1 -1
  42. package/dist/core-a11y.min.js +4 -4
  43. package/dist/core-a11y.min.js.map +1 -1
  44. package/dist/core-anchoring.js +4 -4
  45. package/dist/core-anchoring.js.map +1 -1
  46. package/dist/core-anchoring.min.js +1 -1
  47. package/dist/core-anchoring.min.js.map +1 -1
  48. package/dist/core.js +82 -45
  49. package/dist/core.js.map +1 -1
  50. package/dist/core.min.js +1 -1
  51. package/dist/core.min.js.map +1 -1
  52. package/dist/css-custom-data.json +523 -508
  53. package/dist/custom-elements.json +4405 -4011
  54. package/dist/datepicker.js +38 -14
  55. package/dist/datepicker.js.map +1 -1
  56. package/dist/datepicker.min.js +1 -1
  57. package/dist/datepicker.min.js.map +1 -1
  58. package/dist/dialog.js +7 -7
  59. package/dist/dialog.js.map +1 -1
  60. package/dist/dialog.min.js +1 -1
  61. package/dist/dialog.min.js.map +1 -1
  62. package/dist/drawer-container.js +15 -15
  63. package/dist/drawer-container.js.map +1 -1
  64. package/dist/drawer-container.min.js +1 -1
  65. package/dist/drawer-container.min.js.map +1 -1
  66. package/dist/expansion-panel.js +7 -7
  67. package/dist/expansion-panel.js.map +1 -1
  68. package/dist/expansion-panel.min.js +1 -1
  69. package/dist/expansion-panel.min.js.map +1 -1
  70. package/dist/fab-menu.js +5 -5
  71. package/dist/fab-menu.js.map +1 -1
  72. package/dist/fab-menu.min.js +1 -1
  73. package/dist/fab-menu.min.js.map +1 -1
  74. package/dist/fab.js +3 -3
  75. package/dist/fab.js.map +1 -1
  76. package/dist/fab.min.js +1 -1
  77. package/dist/fab.min.js.map +1 -1
  78. package/dist/form-field.js +19 -19
  79. package/dist/form-field.js.map +1 -1
  80. package/dist/form-field.min.js +2 -2
  81. package/dist/form-field.min.js.map +1 -1
  82. package/dist/html-custom-data.json +183 -168
  83. package/dist/icon-button.js +22 -23
  84. package/dist/icon-button.js.map +1 -1
  85. package/dist/icon-button.min.js +1 -1
  86. package/dist/icon-button.min.js.map +1 -1
  87. package/dist/list.js +33 -32
  88. package/dist/list.js.map +1 -1
  89. package/dist/list.min.js +1 -1
  90. package/dist/list.min.js.map +1 -1
  91. package/dist/menu.js +23 -23
  92. package/dist/menu.js.map +1 -1
  93. package/dist/menu.min.js +1 -1
  94. package/dist/menu.min.js.map +1 -1
  95. package/dist/nav-bar.js +52 -19
  96. package/dist/nav-bar.js.map +1 -1
  97. package/dist/nav-bar.min.js +1 -1
  98. package/dist/nav-bar.min.js.map +1 -1
  99. package/dist/nav-menu.js +13 -13
  100. package/dist/nav-menu.js.map +1 -1
  101. package/dist/nav-menu.min.js +1 -1
  102. package/dist/nav-menu.min.js.map +1 -1
  103. package/dist/nav-rail.js +18 -12
  104. package/dist/nav-rail.js.map +1 -1
  105. package/dist/nav-rail.min.js +1 -1
  106. package/dist/nav-rail.min.js.map +1 -1
  107. package/dist/option.js +13 -13
  108. package/dist/option.js.map +1 -1
  109. package/dist/option.min.js +1 -1
  110. package/dist/option.min.js.map +1 -1
  111. package/dist/paginator.js +1 -1
  112. package/dist/paginator.js.map +1 -1
  113. package/dist/paginator.min.js.map +1 -1
  114. package/dist/radio-group.js +14 -11
  115. package/dist/radio-group.js.map +1 -1
  116. package/dist/radio-group.min.js +1 -1
  117. package/dist/radio-group.min.js.map +1 -1
  118. package/dist/search.js +12 -12
  119. package/dist/search.js.map +1 -1
  120. package/dist/search.min.js +1 -1
  121. package/dist/search.min.js.map +1 -1
  122. package/dist/segmented-button.js +19 -18
  123. package/dist/segmented-button.js.map +1 -1
  124. package/dist/segmented-button.min.js +1 -1
  125. package/dist/segmented-button.min.js.map +1 -1
  126. package/dist/select.js +15 -15
  127. package/dist/select.js.map +1 -1
  128. package/dist/select.min.js +1 -1
  129. package/dist/select.min.js.map +1 -1
  130. package/dist/slider.js +49 -28
  131. package/dist/slider.js.map +1 -1
  132. package/dist/slider.min.js +1 -1
  133. package/dist/slider.min.js.map +1 -1
  134. package/dist/split-pane.js +27 -29
  135. package/dist/split-pane.js.map +1 -1
  136. package/dist/split-pane.min.js +1 -1
  137. package/dist/split-pane.min.js.map +1 -1
  138. package/dist/src/autocomplete/AutocompleteElement.d.ts +3 -3
  139. package/dist/src/autocomplete/AutocompleteQueryEventDetail.d.ts +1 -1
  140. package/dist/src/autocomplete/QueryEventDetail.d.ts +1 -1
  141. package/dist/src/bottom-sheet/BottomSheetElement.d.ts +6 -6
  142. package/dist/src/bottom-sheet/BottomSheetElement.d.ts.map +1 -1
  143. package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts +1 -1
  144. package/dist/src/button/ButtonElement.d.ts +2 -1
  145. package/dist/src/button/ButtonElement.d.ts.map +1 -1
  146. package/dist/src/button/styles/ButtonSizeStyle.d.ts.map +1 -1
  147. package/dist/src/button/styles/ButtonStyle.d.ts.map +1 -1
  148. package/dist/src/button/styles/ButtonVariantStyle.d.ts.map +1 -1
  149. package/dist/src/button-group/ButtonGroupElement.d.ts.map +1 -1
  150. package/dist/src/calendar/CalendarElement.d.ts +1 -1
  151. package/dist/src/card/CardElement.d.ts +1 -1
  152. package/dist/src/checkbox/CheckboxElement.d.ts +5 -4
  153. package/dist/src/checkbox/CheckboxElement.d.ts.map +1 -1
  154. package/dist/src/chips/AssistChipElement.d.ts +1 -1
  155. package/dist/src/chips/FilterChipElement.d.ts +4 -3
  156. package/dist/src/chips/FilterChipElement.d.ts.map +1 -1
  157. package/dist/src/chips/FilterChipSetElement.d.ts +3 -2
  158. package/dist/src/chips/FilterChipSetElement.d.ts.map +1 -1
  159. package/dist/src/chips/InputChipElement.d.ts +2 -2
  160. package/dist/src/chips/InputChipSetElement.d.ts +1 -1
  161. package/dist/src/chips/SuggestionChipElement.d.ts +1 -1
  162. package/dist/src/core/a11y/InteractivityChecker.d.ts +2 -1
  163. package/dist/src/core/a11y/InteractivityChecker.d.ts.map +1 -1
  164. package/dist/src/core/anchoring/FloatingPanelElement.d.ts +1 -1
  165. package/dist/src/core/shared/mixins/SuppressInitialAnimation.d.ts +9 -2
  166. package/dist/src/core/shared/mixins/SuppressInitialAnimation.d.ts.map +1 -1
  167. package/dist/src/core/shared/primitives/CollapsibleElement.d.ts +17 -4
  168. package/dist/src/core/shared/primitives/CollapsibleElement.d.ts.map +1 -1
  169. package/dist/src/core/shared/primitives/CollapsibleOrientation.d.ts +3 -0
  170. package/dist/src/core/shared/primitives/CollapsibleOrientation.d.ts.map +1 -0
  171. package/dist/src/core/shared/primitives/TextHighlightElement.d.ts +1 -1
  172. package/dist/src/core/shared/primitives/index.d.ts +1 -0
  173. package/dist/src/core/shared/primitives/index.d.ts.map +1 -1
  174. package/dist/src/datepicker/DatepickerElement.d.ts +7 -1
  175. package/dist/src/datepicker/DatepickerElement.d.ts.map +1 -1
  176. package/dist/src/dialog/DialogElement.d.ts +5 -5
  177. package/dist/src/drawer-container/DrawerContainerElement.d.ts +1 -1
  178. package/dist/src/drawer-container/styles/DrawerContainerStyle.d.ts.map +1 -1
  179. package/dist/src/expansion-panel/ExpansionHeaderElement.d.ts +1 -1
  180. package/dist/src/expansion-panel/ExpansionPanelElement.d.ts +4 -4
  181. package/dist/src/fab/FabElement.d.ts +1 -1
  182. package/dist/src/fab/FabElement.d.ts.map +1 -1
  183. package/dist/src/fab/styles/FabStyle.d.ts.map +1 -1
  184. package/dist/src/fab-menu/FabMenuElement.d.ts +1 -1
  185. package/dist/src/fab-menu/FabMenuItemElement.d.ts +1 -1
  186. package/dist/src/form-field/FormFieldElement.d.ts.map +1 -1
  187. package/dist/src/icon-button/IconButtonElement.d.ts +2 -1
  188. package/dist/src/icon-button/IconButtonElement.d.ts.map +1 -1
  189. package/dist/src/icon-button/styles/IconButtonSizeStyle.d.ts.map +1 -1
  190. package/dist/src/icon-button/styles/IconButtonStyle.d.ts.map +1 -1
  191. package/dist/src/icon-button/styles/IconButtonVariantStyle.d.ts.map +1 -1
  192. package/dist/src/list/ExpandableListItemElement.d.ts +4 -4
  193. package/dist/src/list/ListActionElement.d.ts +1 -1
  194. package/dist/src/list/ListOptionElement.d.ts +4 -3
  195. package/dist/src/list/ListOptionElement.d.ts.map +1 -1
  196. package/dist/src/list/SelectionListElement.d.ts +3 -2
  197. package/dist/src/list/SelectionListElement.d.ts.map +1 -1
  198. package/dist/src/menu/MenuElement.d.ts +1 -1
  199. package/dist/src/menu/MenuItemCheckboxElement.d.ts +1 -1
  200. package/dist/src/menu/MenuItemElement.d.ts +1 -1
  201. package/dist/src/menu/MenuItemRadioElement.d.ts +1 -1
  202. package/dist/src/nav-bar/NavBarElement.d.ts +3 -1
  203. package/dist/src/nav-bar/NavBarElement.d.ts.map +1 -1
  204. package/dist/src/nav-bar/NavItemElement.d.ts +11 -4
  205. package/dist/src/nav-bar/NavItemElement.d.ts.map +1 -1
  206. package/dist/src/nav-menu/NavMenuItemElement.d.ts +5 -5
  207. package/dist/src/nav-rail/NavRailElement.d.ts +13 -6
  208. package/dist/src/nav-rail/NavRailElement.d.ts.map +1 -1
  209. package/dist/src/paginator/PageEventDetail.d.ts +1 -1
  210. package/dist/src/paginator/PaginatorElement.d.ts +1 -1
  211. package/dist/src/paginator/PaginatorPageEventDetail.d.ts +1 -1
  212. package/dist/src/paginator/PaginatorPageEventDetail.d.ts.map +1 -1
  213. package/dist/src/radio-group/RadioElement.d.ts +4 -3
  214. package/dist/src/radio-group/RadioElement.d.ts.map +1 -1
  215. package/dist/src/radio-group/RadioGroupElement.d.ts +3 -1
  216. package/dist/src/radio-group/RadioGroupElement.d.ts.map +1 -1
  217. package/dist/src/search/SearchViewQueryEventDetail.d.ts +1 -1
  218. package/dist/src/search/styles/SearchBarStyle.d.ts.map +1 -1
  219. package/dist/src/segmented-button/ButtonSegmentElement.d.ts +4 -3
  220. package/dist/src/segmented-button/ButtonSegmentElement.d.ts.map +1 -1
  221. package/dist/src/segmented-button/SegmentedButtonElement.d.ts +3 -2
  222. package/dist/src/segmented-button/SegmentedButtonElement.d.ts.map +1 -1
  223. package/dist/src/select/SelectElement.d.ts +3 -2
  224. package/dist/src/select/SelectElement.d.ts.map +1 -1
  225. package/dist/src/slider/SliderElement.d.ts +4 -0
  226. package/dist/src/slider/SliderElement.d.ts.map +1 -1
  227. package/dist/src/slider/SliderThumbElement.d.ts +4 -3
  228. package/dist/src/slider/SliderThumbElement.d.ts.map +1 -1
  229. package/dist/src/split-pane/SplitPaneElement.d.ts +3 -2
  230. package/dist/src/split-pane/SplitPaneElement.d.ts.map +1 -1
  231. package/dist/src/stepper/StepElement.d.ts +4 -3
  232. package/dist/src/stepper/StepElement.d.ts.map +1 -1
  233. package/dist/src/stepper/StepperElement.d.ts +5 -1
  234. package/dist/src/stepper/StepperElement.d.ts.map +1 -1
  235. package/dist/src/switch/SwitchElement.d.ts +4 -3
  236. package/dist/src/switch/SwitchElement.d.ts.map +1 -1
  237. package/dist/src/tabs/TabElement.d.ts +4 -3
  238. package/dist/src/tabs/TabElement.d.ts.map +1 -1
  239. package/dist/src/tabs/TabsElement.d.ts +3 -1
  240. package/dist/src/tabs/TabsElement.d.ts.map +1 -1
  241. package/dist/src/toc/TocItemElement.d.ts +1 -1
  242. package/dist/src/toolbar/ToolbarElement.d.ts.map +1 -1
  243. package/dist/src/tree/TreeElement.d.ts +1 -1
  244. package/dist/src/tree/TreeItemElement.d.ts +5 -5
  245. package/dist/stepper.js +32 -23
  246. package/dist/stepper.js.map +1 -1
  247. package/dist/stepper.min.js +1 -1
  248. package/dist/stepper.min.js.map +1 -1
  249. package/dist/switch.js +9 -8
  250. package/dist/switch.js.map +1 -1
  251. package/dist/switch.min.js +1 -1
  252. package/dist/switch.min.js.map +1 -1
  253. package/dist/tabs.js +17 -14
  254. package/dist/tabs.js.map +1 -1
  255. package/dist/tabs.min.js +1 -1
  256. package/dist/tabs.min.js.map +1 -1
  257. package/dist/toc.js +8 -8
  258. package/dist/toc.js.map +1 -1
  259. package/dist/toc.min.js +1 -1
  260. package/dist/toc.min.js.map +1 -1
  261. package/dist/toolbar.js +2 -1
  262. package/dist/toolbar.js.map +1 -1
  263. package/dist/toolbar.min.js +1 -1
  264. package/dist/toolbar.min.js.map +1 -1
  265. package/dist/tooltip.js +3 -3
  266. package/dist/tooltip.js.map +1 -1
  267. package/dist/tooltip.min.js +1 -1
  268. package/dist/tooltip.min.js.map +1 -1
  269. package/dist/tree.js +13 -13
  270. package/dist/tree.js.map +1 -1
  271. package/dist/tree.min.js +1 -1
  272. package/dist/tree.min.js.map +1 -1
  273. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.min.js","sources":["../../src/tooltip/RichTooltipActionElement.ts","../../src/tooltip/TooltipElementBase.ts","../../src/tooltip/RichTooltipElement.ts","../../src/tooltip/TooltipElement.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\r\n\r\nimport { ActionElementBase, customElement } from \"@m3e/web/core\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to dismiss a parenting rich tooltip.\r\n * @tag m3e-rich-tooltip-action\r\n *\r\n * @slot - Renders the content of the action.\r\n *\r\n * @attr disable-restore-focus - Whether to focus should not be restored to the trigger when activated.\r\n */\r\n@customElement(\"m3e-rich-tooltip-action\")\r\nexport class M3eRichTooltipActionElement extends ActionElementBase {\r\n /** Whether to focus should not be restored to the trigger when activated. */\r\n @property({ attribute: \"disable-restore-focus\", type: Boolean }) disableRestoreFocus = false;\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n this.closest(\"m3e-rich-tooltip\")?.hide(!this.disableRestoreFocus);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-rich-tooltip-action\": M3eRichTooltipActionElement;\r\n }\r\n}\r\n","import { LitElement, PropertyValues } from \"lit\";\r\nimport { property, query } from \"lit/decorators.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n HoverController,\r\n HtmlFor,\r\n isDisabledMixin,\r\n LongPressController,\r\n ReconnectedCallback,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { M3ePlatform } from \"@m3e/web/core/platform\";\r\nimport { AnchorPosition, positionAnchor } from \"@m3e/web/core/anchoring\";\r\n\r\nimport { TooltipTouchGestures } from \"./TooltipTouchGestures\";\r\n\r\n/** The space, in pixels, between the tooltip and anchor. */\r\nconst TOOLTIP_OFFSET = 4;\r\n\r\n/** The default time, in milliseconds, before hiding a tooltip. */\r\nconst TOOLTIP_HIDE_DELAY = 200;\r\n\r\n/** Provides a base implementation for a tooltip. This class must be inherited. */\r\nexport abstract class TooltipElementBase extends HtmlFor(ReconnectedCallback(AttachInternals(LitElement))) {\r\n /** @private */ private static __openTooltips = new Array<TooltipElementBase>();\r\n\r\n /** @internal */ @query(\".base\") protected readonly _base!: HTMLElement;\r\n /** @private */ #for: HTMLElement | null = null;\r\n /** @private */ #anchorCleanup?: () => void;\r\n /** @private */ #tooltipHovering = false;\r\n\r\n /** @private */ readonly #controlClickHandler = () => this.#handleControlClick();\r\n\r\n /** @private */\r\n readonly #hoverController = new HoverController(this, {\r\n target: null,\r\n endDelay: TOOLTIP_HIDE_DELAY,\r\n callback: (hovering, target) => {\r\n if (this._isInteractive) return;\r\n if (hovering) {\r\n if (target === this._base) {\r\n this.#tooltipHovering = true;\r\n return;\r\n }\r\n this.show();\r\n } else if (!this.#tooltipHovering || target === this._base) {\r\n this.#tooltipHovering = false;\r\n this.hide();\r\n }\r\n },\r\n });\r\n\r\n /** @private */\r\n readonly #longPressController = new LongPressController(this, {\r\n target: null,\r\n callback: (pressed) => {\r\n if (this._isInteractive) return;\r\n if (pressed) {\r\n this.show();\r\n } else {\r\n this.hide();\r\n }\r\n },\r\n });\r\n\r\n /**\r\n * Whether the element is disabled.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) disabled = false;\r\n\r\n /**\r\n * The amount of time, in milliseconds, before showing the tooltip.\r\n * @default 0\r\n */\r\n @property({ attribute: \"show-delay\", type: Number }) get showDelay(): number {\r\n return this.#hoverController.startDelay;\r\n }\r\n set showDelay(value: number) {\r\n this.#hoverController.startDelay = value;\r\n }\r\n\r\n /**\r\n * The amount of time, in milliseconds, before hiding the tooltip.\r\n * @default 200\r\n */\r\n @property({ attribute: \"hide-delay\", type: Number }) get hideDelay(): number {\r\n return this.#hoverController.endDelay;\r\n }\r\n set hideDelay(value: number) {\r\n this.#hoverController.endDelay = value;\r\n }\r\n\r\n /**\r\n * The mode in which to handle touch gestures.\r\n * @default \"auto\"\r\n */\r\n @property({ attribute: \"touch-gestures\" }) touchGestures: TooltipTouchGestures = \"auto\";\r\n\r\n /** Whether the tooltip is currently open. */\r\n get isOpen(): boolean {\r\n return TooltipElementBase.__openTooltips.includes(this);\r\n }\r\n\r\n /**\r\n * Whether the tooltip is interactive.\r\n * @internal\r\n */\r\n protected get _isInteractive() {\r\n return false;\r\n }\r\n\r\n /**\r\n * The position in which to anchor the tooltip relative to its trigger.\r\n * @internal\r\n */\r\n protected abstract get _anchorPosition(): AnchorPosition;\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n super.attach(control);\r\n\r\n if (M3ePlatform.iOS || M3ePlatform.Android) {\r\n this.#longPressController.observe(control);\r\n this.#disableNativeGesturesIfNecessary();\r\n } else {\r\n this.#hoverController.observe(control);\r\n }\r\n\r\n control.addEventListener(\"click\", this.#controlClickHandler);\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control) {\r\n this.#hoverController.unobserve(this.control);\r\n this.#longPressController.unobserve(this.control);\r\n this.control.removeEventListener(\"click\", this.#controlClickHandler);\r\n this.hide();\r\n }\r\n super.detach();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"disabled\") && this.disabled) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n this.#initialize();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override firstUpdated(_changedProperties: PropertyValues<this>): void {\r\n super.firstUpdated(_changedProperties);\r\n this.#initialize();\r\n }\r\n\r\n /** @private */\r\n #initialize(): void {\r\n if (this._base) {\r\n this.#hoverController.observe(this._base);\r\n }\r\n }\r\n\r\n /**\r\n * Manually shows the tooltip.\r\n * @returns {Promise<void>} A `Promise` that resolves when the tooltip is shown.\r\n */\r\n async show(): Promise<void> {\r\n if (!this.control || this.disabled || (isDisabledMixin(this.control) && this.control.disabled)) return;\r\n\r\n TooltipElementBase.__openTooltips.filter((x) => x !== this).forEach((x) => x.hide());\r\n\r\n this._base.showPopover();\r\n\r\n this.#anchorCleanup = await positionAnchor(\r\n this._base,\r\n this.control,\r\n {\r\n position: this._anchorPosition,\r\n inline: true,\r\n flip: true,\r\n shift: \"main\",\r\n offset: TOOLTIP_OFFSET,\r\n },\r\n (x, y) => this._updatePosition(this._base, x, y),\r\n );\r\n\r\n if (!TooltipElementBase.__openTooltips.includes(this)) {\r\n TooltipElementBase.__openTooltips.push(this);\r\n }\r\n }\r\n\r\n /** Manually hides the tooltip. */\r\n hide(): void {\r\n this._base.hidePopover();\r\n this.#anchorCleanup?.();\r\n this.#anchorCleanup = undefined;\r\n this.#hoverController.clearDelays();\r\n\r\n if (TooltipElementBase.__openTooltips.includes(this)) {\r\n TooltipElementBase.__openTooltips = TooltipElementBase.__openTooltips.filter((x) => x !== this);\r\n }\r\n }\r\n\r\n /**\r\n * Updates the position of the tooltip.\r\n * @internal\r\n * @param {HTMLElement} base The internal element of the tooltip to position.\r\n * @param {number} x The x-coordinate, in pixels, to which to position `base`.\r\n * @param {number} y The y-coordinate, in pixels, to which to position `base`.\r\n */\r\n protected abstract _updatePosition(base: HTMLElement, x: number, y: number): void;\r\n\r\n /** @private */\r\n #handleControlClick(): void {\r\n if (this._isInteractive) {\r\n if (TooltipElementBase.__openTooltips.includes(this)) {\r\n this.hide();\r\n } else {\r\n this.show();\r\n }\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #disableNativeGesturesIfNecessary() {\r\n if (this.touchGestures !== \"off\" && this.#for) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const style: any = this.#for.style;\r\n\r\n // If gestures are set to `auto`, we don't disable text selection on inputs and\r\n // textareas, because it prevents the user from typing into them on iOS Safari.\r\n\r\n if (this.touchGestures === \"on\" || (this.#for.nodeName !== \"INPUT\" && this.#for.nodeName !== \"TEXTAREA\")) {\r\n style.userSelect = style.msUserSelect = style.webkitUserSelect = style.MozUserSelect = \"none\";\r\n }\r\n\r\n // If we have `auto` gestures and the element uses native HTML dragging,\r\n // we don't set `-webkit-user-drag` because it prevents the native behavior.\r\n\r\n if (this.touchGestures === \"on\" || !this.#for.draggable) {\r\n style.webkitUserDrag = \"none\";\r\n }\r\n\r\n style.touchAction = \"none\";\r\n style.webkitTapHighlightColor = \"transparent\";\r\n }\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, PropertyValues, unsafeCSS } from \"lit\";\r\nimport { property, state } from \"lit/decorators.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, DesignToken, getTextContent, hasAssignedNodes } from \"@m3e/web/core\";\r\nimport { M3eAriaDescriber, M3eInteractivityChecker } from \"@m3e/web/core/a11y\";\r\nimport { AnchorPosition } from \"@m3e/web/core/anchoring\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { RichTooltipPosition } from \"./RichTooltipPosition\";\r\nimport { TooltipElementBase } from \"./TooltipElementBase\";\r\n\r\n/**\r\n * Provides contextual details for a control, such as explaining the value or purpose of a feature.\r\n *\r\n * @description\r\n * The `m3e-rich-tooltip` component provides contextual guidance for a control. It supports an optional\r\n * subhead, multi-line supporting text, and optional action elements. When non‑interactive, it behaves\r\n * as a standard tooltip and contributes an `aria-describedby` message to its control. When interactive,\r\n * it becomes a lightweight anchored dialog with manual popover behavior, keyboard dismissal, and\r\n * click‑outside light‑dismiss.\r\n *\r\n * @example\r\n * The following example illustrates connecting an interactive rich tooltip to a button using the `for` attribute.\r\n * ```html\r\n * <m3e-icon-button id=\"btnSettings\">\r\n * <m3e-icon name=\"settings\"></m3e-icon>\r\n * </m3e-icon-button>\r\n * <m3e-rich-tooltip for=\"btnSettings\">\r\n * <span slot=\"subhead\">New settings available</span>\r\n * Now you can adjust the uploaded image quality, and upgrade your available storage space.\r\n * <div slot=\"actions\">\r\n * <m3e-button>\r\n * <m3e-rich-tooltip-action>Learn more</m3e-rich-tooltip-action>\r\n * </m3e-button>\r\n * </div>\r\n * </m3e-rich-tooltip>\r\n * ```\r\n *\r\n * @tag m3e-rich-tooltip\r\n *\r\n * @slot - The main supporting text of the tooltip.\r\n * @slot subhead - Optional subhead text displayed above the supporting content.\r\n * @slot actions - Optional action elements displayed at the bottom of the tooltip.\r\n *\r\n * @attr disabled - Whether the element is disabled.\r\n * @attr for - The identifier of the interactive control to which this element is attached.\r\n * @attr hide-delay - The amount of time, in milliseconds, before hiding the tooltip.\r\n * @attr position - The position of the tooltip.\r\n * @attr show-delay - The amount of time, in milliseconds, before showing the tooltip.\r\n *\r\n * @fires beforetoggle - Dispatched before the toggle state changes.\r\n * @fires toggle - Dispatched after the toggle state has changed.\r\n *\r\n * @cssprop --m3e-rich-tooltip-padding-top - Top padding of the tooltip container.\r\n * @cssprop --m3e-rich-tooltip-padding-bottom - Bottom padding of the tooltip container (when no actions are present).\r\n * @cssprop --m3e-rich-tooltip-padding-inline - Horizontal padding of the tooltip container.\r\n * @cssprop --m3e-rich-tooltip-max-width - Maximum width of the tooltip surface.\r\n * @cssprop --m3e-rich-tooltip-shape - Border‑radius of the tooltip container.\r\n * @cssprop --m3e-rich-tooltip-container-color - Background color of the tooltip surface.\r\n * @cssprop --m3e-rich-tooltip-subhead-color - Color of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-font-size - Font size of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-font-weight - Font weight of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-line-height - Line height of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-tracking - Letter‑spacing of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-bottom-space - Space below the subhead before the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-color - Color of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-font-size - Font size of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-font-weight - Font weight of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-line-height - Line height of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-tracking - Letter‑spacing of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-actions-padding-inline - Horizontal padding applied to the actions slot area.\r\n * @cssprop --m3e-rich-tooltip-actions-top-space - Space above the actions slot.\r\n * @cssprop --m3e-rich-tooltip-actions-bottom-space - Space below the actions slot.\r\n */\r\n@customElement(\"m3e-rich-tooltip\")\r\nexport class M3eRichTooltipElement extends TooltipElementBase {\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 .base {\r\n flex-direction: column;\r\n position: absolute;\r\n padding: unset;\r\n margin: unset;\r\n border: unset;\r\n padding-block-start: var(--m3e-rich-tooltip-padding-top, 0.75rem);\r\n padding-inline: var(--m3e-rich-tooltip-padding-inline, 1rem);\r\n max-width: var(--m3e-rich-tooltip-max-width, 20rem);\r\n box-sizing: border-box;\r\n overflow: visible;\r\n border-radius: var(--m3e-rich-tooltip-shape, ${DesignToken.shape.corner.medium});\r\n background-color: var(--m3e-rich-tooltip-container-color, ${DesignToken.color.surfaceContainer});\r\n display: none;\r\n opacity: 0;\r\n transform: scale(0.8);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n display ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .base:not(.has-actions) {\r\n padding-block-end: var(--m3e-rich-tooltip-padding-bottom, 0.75rem);\r\n }\r\n .base::backdrop {\r\n background-color: transparent;\r\n }\r\n .base:popover-open {\r\n display: flex;\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n .base:not(.has-subhead) .subhead,\r\n .base:not(.has-actions) .actions {\r\n display: none;\r\n }\r\n .subhead {\r\n color: var(--m3e-rich-tooltip-subhead-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(--m3e-rich-tooltip-subhead-font-size, ${DesignToken.typescale.standard.title.small.fontSize});\r\n font-weight: var(\r\n --m3e-rich-tooltip-subhead-font-weight,\r\n ${DesignToken.typescale.standard.title.small.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-rich-tooltip-subhead-line-height,\r\n ${DesignToken.typescale.standard.title.small.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-rich-tooltip-subhead-tracking, ${DesignToken.typescale.standard.title.small.tracking});\r\n padding-block-end: var(--m3e-rich-tooltip-subhead-bottom-space, 0.25rem);\r\n }\r\n .content {\r\n color: var(--m3e-rich-tooltip-supporting-text-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(\r\n --m3e-rich-tooltip-supporting-text-font-size,\r\n ${DesignToken.typescale.standard.body.medium.fontSize}\r\n );\r\n font-weight: var(\r\n --m3e-rich-tooltip-supporting-text-font-weight,\r\n ${DesignToken.typescale.standard.body.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-rich-tooltip-supporting-text-line-height,\r\n ${DesignToken.typescale.standard.body.medium.lineHeight}\r\n );\r\n letter-spacing: var(\r\n --m3e-rich-tooltip-supporting-text-tracking,\r\n ${DesignToken.typescale.standard.body.medium.tracking}\r\n );\r\n }\r\n .actions {\r\n margin-inline: calc(\r\n 0px - calc(\r\n var(--m3e-rich-tooltip-padding-inline, 1rem) - var(--m3e-rich-tooltip-actions-padding-inline, 0.25rem)\r\n )\r\n );\r\n padding-block-start: var(--m3e-rich-tooltip-actions-top-space, 0.75rem);\r\n padding-block-end: var(--m3e-rich-tooltip-actions-bottom-space, 0.5rem);\r\n }\r\n ::slotted([slot=\"actions\"]) {\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n min-height: 1.5rem;\r\n column-gap: 0.5rem;\r\n }\r\n ::slotted([slot=\"actions\"][end]) {\r\n justify-content: flex-end;\r\n }\r\n @starting-style {\r\n .base:popover-open {\r\n opacity: 0;\r\n transform: scale(0.8);\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n .base {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n .base {\r\n background-color: Canvas;\r\n color: CanvasText;\r\n box-sizing: border-box;\r\n border: 1px solid CanvasText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __nextId = 0;\r\n /** @private */ #id = M3eRichTooltipElement.__nextId++;\r\n /** @private */ #subheadText = \"\";\r\n /** @private */ #contentText = \"\";\r\n /** @private */ #message = \"\";\r\n /** @private */ #messageRegistered = false;\r\n\r\n /** @private */ @state() private _hasSubhead = false;\r\n /** @private */ @state() private _interactive = false;\r\n\r\n /** @private */ readonly #documentClickHandler = (e: MouseEvent) => this.#handleDocumentClick(e);\r\n\r\n /**\r\n * The position of the tooltip.\r\n * @default \"below-after\"\r\n */\r\n @property() position: RichTooltipPosition = \"below-after\";\r\n\r\n /** @inheritdoc */\r\n protected override get _isInteractive() {\r\n return this._interactive;\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override get _anchorPosition(): AnchorPosition {\r\n switch (this.position) {\r\n case \"above\":\r\n return \"top\";\r\n case \"above-after\":\r\n return M3eDirectionality.current === \"rtl\" ? \"top-start\" : \"top-end\";\r\n case \"above-before\":\r\n return M3eDirectionality.current === \"rtl\" ? \"top-end\" : \"top-start\";\r\n case \"after\":\r\n return M3eDirectionality.current === \"rtl\" ? \"left\" : \"right\";\r\n case \"before\":\r\n return M3eDirectionality.current === \"rtl\" ? \"right\" : \"left\";\r\n case \"below\":\r\n return \"bottom\";\r\n case \"below-after\":\r\n return M3eDirectionality.current === \"rtl\" ? \"bottom-start\" : \"bottom-end\";\r\n case \"below-before\":\r\n return M3eDirectionality.current === \"rtl\" ? \"bottom-end\" : \"bottom-start\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const subheadId = this._interactive && this._hasSubhead ? `m3e-rich-tooltip-${this.#id}-subhead` : undefined;\r\n return html`<div\r\n class=\"base\"\r\n popover=\"manual\"\r\n role=\"${ifDefined(this._interactive ? \"dialog\" : undefined)}\"\r\n aria-labelledby=\"${ifDefined(subheadId)}\"\r\n @keydown=\"${this.#handleKeyDown}\"\r\n @beforetoggle=\"${this.#handleBeforeToggle}\"\r\n @toggle=\"${this.#handleToggle}\"\r\n >\r\n <m3e-elevation level=\"3\"></m3e-elevation>\r\n <div class=\"subhead\" id=\"${ifDefined(subheadId)}\">\r\n <slot name=\"subhead\" @slotchange=\"${this.#handleSubheadSlotChange}\"></slot>\r\n </div>\r\n <div class=\"content\"><slot @slotchange=\"${this.#handleContentSlotChange}\"></slot></div>\r\n <div class=\"actions\">\r\n <slot name=\"actions\" @slotchange=\"${this.#handleActionsSlotChange}\"></slot>\r\n </div>\r\n </div>`;\r\n }\r\n\r\n /** @inheritdoc */\r\n override show(): Promise<void> {\r\n if (this._interactive) {\r\n document.addEventListener(\"click\", this.#documentClickHandler);\r\n }\r\n\r\n return super.show();\r\n }\r\n\r\n /**\r\n * Manually hides the tooltip.\r\n * @param [restoreFocus=true] Whether to restore focus to the element that triggered the interactive tooltip.\r\n */\r\n override hide(restoreFocus = true): void {\r\n if (this._interactive) {\r\n document.removeEventListener(\"click\", this.#documentClickHandler);\r\n }\r\n\r\n super.hide();\r\n\r\n if (restoreFocus && this._interactive && this.control && M3eInteractivityChecker.isFocusable(this.control)) {\r\n this.control.focus();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n super.attach(control);\r\n\r\n this.#updateMessage();\r\n\r\n if (this._interactive) {\r\n control.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"_interactive\")) {\r\n this.ariaHidden = this._interactive ? null : \"true\";\r\n this.#updateMessage();\r\n\r\n if (this.control && this._interactive) {\r\n this.control.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override _updatePosition(base: HTMLElement, x: number, y: number): void {\r\n if (this.position.includes(\"before\") && this.position !== \"before\") {\r\n if (M3eDirectionality.current === \"rtl\") {\r\n x += this.control?.clientWidth ?? 0;\r\n } else {\r\n x -= this.control?.clientWidth ?? 0;\r\n }\r\n }\r\n if (this.position.includes(\"after\") && this.position !== \"after\") {\r\n if (M3eDirectionality.current === \"rtl\") {\r\n x -= this.control?.clientWidth ?? 0;\r\n } else {\r\n x += this.control?.clientWidth ?? 0;\r\n }\r\n }\r\n\r\n if (M3eDirectionality.current === \"rtl\") {\r\n base.style.right = `${window.innerWidth - x - base.clientWidth}px`;\r\n base.style.left = \"\";\r\n } else {\r\n base.style.left = `${x}px`;\r\n base.style.right = \"\";\r\n }\r\n\r\n base.style.top = `${y}px`;\r\n }\r\n\r\n /** @private */\r\n #handleBeforeToggle(e: ToggleEvent): void {\r\n const forwarded = new ToggleEvent(\"beforetoggle\", {\r\n oldState: e.oldState,\r\n newState: e.newState,\r\n bubbles: true,\r\n composed: true,\r\n cancelable: e.cancelable,\r\n });\r\n\r\n if (!this.dispatchEvent(forwarded)) {\r\n e.preventDefault();\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleToggle(e: ToggleEvent): void {\r\n const forwarded = new ToggleEvent(\"toggle\", {\r\n oldState: e.oldState,\r\n newState: e.newState,\r\n bubbles: true,\r\n composed: true,\r\n });\r\n this.dispatchEvent(forwarded);\r\n }\r\n\r\n /** @private */\r\n #handleDocumentClick(e: MouseEvent): void {\r\n if (!e.composedPath().some((x) => x instanceof M3eRichTooltipElement || x === this.control)) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleKeyDown(e: KeyboardEvent): void {\r\n if (e.key === \"Escape\" && !e.shiftKey && !e.ctrlKey) {\r\n e.preventDefault();\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleSubheadSlotChange(e: Event): void {\r\n this._hasSubhead = hasAssignedNodes(e.target as HTMLSlotElement);\r\n this.shadowRoot?.querySelector(\".base\")?.classList.toggle(\"has-subhead\", this._hasSubhead);\r\n this.#subheadText = this._hasSubhead ? getTextContent(e.target as HTMLSlotElement, true) : \"\";\r\n this.#updateMessage();\r\n }\r\n\r\n /** @private */\r\n #handleContentSlotChange(e: Event): void {\r\n this._interactive = M3eInteractivityChecker.findInteractiveElements(this, true).length > 0;\r\n this.#contentText = getTextContent(e.target as HTMLSlotElement, true);\r\n this.#updateMessage();\r\n }\r\n\r\n /** @private */\r\n #handleActionsSlotChange(e: Event): void {\r\n this.shadowRoot\r\n ?.querySelector(\".base\")\r\n ?.classList.toggle(\"has-actions\", hasAssignedNodes(e.target as HTMLSlotElement));\r\n\r\n this._interactive = M3eInteractivityChecker.findInteractiveElements(this, true).length > 0;\r\n this.#updateMessage();\r\n }\r\n\r\n /** @private */\r\n #updateMessage() {\r\n const message = this.#subheadText ? `${this.#subheadText}/n${this.#contentText}` : this.#contentText;\r\n if (this.isConnected && this.control) {\r\n if (this.#message && this.#messageRegistered) {\r\n M3eAriaDescriber.removeDescription(this.control, this.#message);\r\n this.#messageRegistered = false;\r\n }\r\n\r\n this.#message = message;\r\n\r\n if (this.#message && !this._interactive) {\r\n M3eAriaDescriber.describe(this.control, this.#message);\r\n this.#messageRegistered = true;\r\n }\r\n }\r\n }\r\n}\r\n\r\ninterface M3eRichTooltipElementEventMap extends HTMLElementEventMap {\r\n beforetoggle: ToggleEvent;\r\n toggle: ToggleEvent;\r\n}\r\n\r\nexport interface M3eRichTooltipElement {\r\n addEventListener<K extends keyof M3eRichTooltipElementEventMap>(\r\n type: K,\r\n listener: (this: M3eRichTooltipElement, ev: M3eRichTooltipElementEventMap[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 M3eRichTooltipElementEventMap>(\r\n type: K,\r\n listener: (this: M3eRichTooltipElement, ev: M3eRichTooltipElementEventMap[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-rich-tooltip\": M3eRichTooltipElement;\r\n }\r\n}\r\n","import { css, CSSResultGroup, html, unsafeCSS } from \"lit\";\r\nimport { property } from \"lit/decorators.js\";\r\n\r\nimport { customElement, DesignToken, getTextContent, setCustomState } from \"@m3e/web/core\";\r\nimport { M3eAriaDescriber } from \"@m3e/web/core/a11y\";\r\nimport { AnchorPosition } from \"@m3e/web/core/anchoring\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { TooltipPosition } from \"./TooltipPosition\";\r\nimport { TooltipElementBase } from \"./TooltipElementBase\";\r\n\r\n/**\r\n * Adds additional context to a button or other UI element.\r\n *\r\n * @description\r\n * The `m3e-tooltip` component provides contextual information in response to user interaction, enhancing comprehension\r\n * and reducing ambiguity. Tooltips are positioned relative to a target element and support configurable delays for\r\n * show and hide behavior. The component is designed to reinforce accessibility and usability, especially in dense or\r\n * icon-driven interfaces. Use the `for` attribute to designate the element for which to provide a tooltip.\r\n *\r\n * @example\r\n * The following example illustrates connecting a tooltip to a button using the `for` attribute.\r\n * ```html\r\n * <m3e-icon-button id=\"button\" aria-label=\"Back\">\r\n * <m3e-icon name=\"arrow_back\"></m3e-icon>\r\n * </m3e-icon-button>\r\n * <m3e-tooltip for=\"button\">Go Back</m3e-tooltip>\r\n * ```\r\n *\r\n * @tag m3e-tooltip\r\n *\r\n * @slot - Renders the content of the tooltip.\r\n *\r\n * @attr disabled - Whether the element is disabled.\r\n * @attr for - The identifier of the interactive control to which this element is attached.\r\n * @attr hide-delay - The amount of time, in milliseconds, before hiding the tooltip.\r\n * @attr position - The position of the tooltip.\r\n * @attr show-delay - The amount of time, in milliseconds, before showing the tooltip.\r\n *\r\n * @cssprop --m3e-tooltip-padding - Internal spacing of the tooltip container.\r\n * @cssprop --m3e-tooltip-min-width - Minimum width of the tooltip.\r\n * @cssprop --m3e-tooltip-max-width - Maximum width of the tooltip.\r\n * @cssprop --m3e-tooltip-min-height - Minimum height of the tooltip container.\r\n * @cssprop --m3e-tooltip-max-height - Maximum height of the tooltip.\r\n * @cssprop --m3e-tooltip-shape - Border radius of the tooltip container.\r\n * @cssprop --m3e-tooltip-container-color - Background color of the tooltip.\r\n * @cssprop --m3e-tooltip-supporting-text-color - Text color of supporting text.\r\n * @cssprop --m3e-tooltip-supporting-text-font-size - Font size of supporting text.\r\n * @cssprop --m3e-tooltip-supporting-text-font-weight - Font weight of supporting text.\r\n * @cssprop --m3e-tooltip-supporting-text-line-height - Line height of supporting text.\r\n * @cssprop --m3e-tooltip-supporting-text-tracking - Letter spacing of supporting text.\r\n */\r\n@customElement(\"m3e-tooltip\")\r\nexport class M3eTooltipElement extends TooltipElementBase {\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 .base {\r\n position: absolute;\r\n pointer-events: none;\r\n margin: unset;\r\n border: unset;\r\n word-break: normal;\r\n overflow-wrap: anywhere;\r\n padding: var(--m3e-tooltip-padding, 0.25rem 0.5rem);\r\n min-width: var(--m3e-tooltip-min-width, 2.5rem);\r\n max-width: var(--m3e-tooltip-max-width, 12.5rem);\r\n min-height: var(--m3e-tooltip-min-height, 1.5rem);\r\n max-height: var(--m3e-tooltip-max-height, 40vh);\r\n box-sizing: border-box;\r\n overflow: hidden;\r\n text-align: center;\r\n border-radius: var(--m3e-tooltip-shape, ${DesignToken.shape.corner.extraSmall});\r\n background-color: var(--m3e-tooltip-container-color, ${DesignToken.color.inverseSurface});\r\n color: var(--m3e-tooltip-supporting-text-color, ${DesignToken.color.inverseOnSurface});\r\n font-size: var(--m3e-tooltip-supporting-text-font-size, ${DesignToken.typescale.standard.body.small.fontSize});\r\n font-weight: var(\r\n --m3e-tooltip-supporting-text-font-weight,\r\n ${DesignToken.typescale.standard.body.small.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-tooltip-supporting-text-line-height,\r\n ${DesignToken.typescale.standard.body.small.lineHeight}\r\n );\r\n letter-spacing: var(\r\n --m3e-tooltip-supporting-text-tracking,\r\n ${DesignToken.typescale.standard.body.small.tracking}\r\n );\r\n display: none;\r\n opacity: 0;\r\n transform: scale(0.8);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n display ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host(:state(-multiline)) .base {\r\n text-align: start;\r\n }\r\n .base::backdrop {\r\n background-color: transparent;\r\n }\r\n .base:popover-open {\r\n display: block;\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n @starting-style {\r\n .base:popover-open {\r\n opacity: 0;\r\n transform: scale(0.8);\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n .base {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n .base {\r\n background-color: Canvas;\r\n color: CanvasText;\r\n box-sizing: border-box;\r\n border: 1px solid CanvasText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ #message?: string | null;\r\n\r\n /**\r\n * The position of the tooltip.\r\n * @default \"below\"\r\n */\r\n @property() position: TooltipPosition = \"below\";\r\n\r\n /** @inheritdoc */\r\n protected get _anchorPosition(): AnchorPosition {\r\n return this.position === \"above\"\r\n ? \"top\"\r\n : this.position === \"below\"\r\n ? \"bottom\"\r\n : this.position === \"before\"\r\n ? M3eDirectionality.current === \"ltr\"\r\n ? \"left\"\r\n : \"right\"\r\n : M3eDirectionality.current === \"ltr\"\r\n ? \"right\"\r\n : \"left\";\r\n }\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n super.attach(control);\r\n\r\n if (this.#message) {\r\n M3eAriaDescriber.describe(control, this.#message);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control && this.#message) {\r\n M3eAriaDescriber.removeDescription(this.control, this.#message);\r\n }\r\n super.detach();\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.ariaHidden = \"true\";\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"base\" popover=\"manual\" @toggle=\"${this.#handleToggle}\">\r\n <slot @slotchange=\"${this.#handleSlotChange}\"></slot>\r\n </div>`;\r\n }\r\n\r\n /** @inheritdoc */\r\n protected _updatePosition(base: HTMLElement, x: number, y: number): void {\r\n if (M3eDirectionality.current === \"rtl\") {\r\n base.style.right = `${window.innerWidth - x - base.clientWidth}px`;\r\n base.style.left = \"\";\r\n } else {\r\n base.style.left = `${x}px`;\r\n base.style.right = \"\";\r\n }\r\n base.style.top = `${y}px`;\r\n }\r\n\r\n /** @private */\r\n #handleSlotChange(e: Event): void {\r\n const message = getTextContent(e.target as HTMLSlotElement, true);\r\n if (this.isConnected && this.control) {\r\n if (this.#message) {\r\n M3eAriaDescriber.removeDescription(this.control, this.#message);\r\n }\r\n\r\n this.#message = message;\r\n\r\n if (this.#message) {\r\n M3eAriaDescriber.describe(this.control, this.#message);\r\n }\r\n } else {\r\n this.#message = message;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleToggle(e: ToggleEvent): void {\r\n if (e.newState === \"open\") {\r\n const multiline = this._base.getBoundingClientRect().height > parseFloat(getComputedStyle(this._base).minHeight);\r\n setCustomState(this, \"-multiline\", multiline);\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-tooltip\": M3eTooltipElement;\r\n }\r\n}\r\n"],"names":["M3eRichTooltipActionElement","ActionElementBase","constructor","this","disableRestoreFocus","_onClick","closest","hide","__decorate","property","attribute","type","Boolean","prototype","customElement","TooltipElementBase","HtmlFor","ReconnectedCallback","AttachInternals","LitElement","_TooltipElementBase_for","set","_TooltipElementBase_anchorCleanup","_TooltipElementBase_tooltipHovering","_TooltipElementBase_controlClickHandler","__classPrivateFieldGet","_TooltipElementBase_instances","_TooltipElementBase_handleControlClick","call","_TooltipElementBase_hoverController","HoverController","target","endDelay","callback","hovering","_isInteractive","_base","__classPrivateFieldSet","show","_TooltipElementBase_longPressController","LongPressController","pressed","disabled","touchGestures","showDelay","startDelay","value","hideDelay","isOpen","_a","__openTooltips","includes","attach","control","super","M3ePlatform","iOS","Android","observe","_TooltipElementBase_disableNativeGesturesIfNecessary","addEventListener","detach","unobserve","removeEventListener","update","changedProperties","has","reconnectedCallback","_TooltipElementBase_initialize","firstUpdated","_changedProperties","isDisabledMixin","filter","x","forEach","showPopover","positionAnchor","position","_anchorPosition","inline","flip","shift","offset","y","_updatePosition","push","hidePopover","undefined","clearDelays","style","nodeName","userSelect","msUserSelect","webkitUserSelect","MozUserSelect","draggable","webkitUserDrag","touchAction","webkitTapHighlightColor","Array","query","reflect","Number","M3eRichTooltipElement","M3eRichTooltipElement_1","_M3eRichTooltipElement_id","__nextId","_M3eRichTooltipElement_subheadText","_M3eRichTooltipElement_contentText","_M3eRichTooltipElement_message","_M3eRichTooltipElement_messageRegistered","_hasSubhead","_interactive","_M3eRichTooltipElement_documentClickHandler","e","M3eDirectionality","current","render","subheadId","html","ifDefined","_M3eRichTooltipElement_instances","_M3eRichTooltipElement_handleKeyDown","_M3eRichTooltipElement_handleBeforeToggle","_M3eRichTooltipElement_handleToggle","_M3eRichTooltipElement_handleSubheadSlotChange","_M3eRichTooltipElement_handleContentSlotChange","_M3eRichTooltipElement_handleActionsSlotChange","document","restoreFocus","M3eInteractivityChecker","isFocusable","focus","_M3eRichTooltipElement_updateMessage","ariaHasPopup","ariaHidden","base","clientWidth","right","window","innerWidth","left","top","forwarded","ToggleEvent","oldState","newState","bubbles","composed","cancelable","dispatchEvent","preventDefault","composedPath","some","key","shiftKey","ctrlKey","hasAssignedNodes","shadowRoot","querySelector","classList","toggle","getTextContent","findInteractiveElements","length","message","isConnected","M3eAriaDescriber","removeDescription","describe","styles","css","DesignToken","shape","corner","medium","color","surfaceContainer","unsafeCSS","motion","duration","short3","easing","standard","onSurfaceVariant","typescale","title","small","fontSize","fontWeight","lineHeight","tracking","body","state","M3eTooltipElement","_M3eTooltipElement_message","connectedCallback","_M3eTooltipElement_instances","_M3eTooltipElement_handleToggle","_M3eTooltipElement_handleSlotChange","multiline","getBoundingClientRect","height","parseFloat","getComputedStyle","minHeight","setCustomState","extraSmall","inverseSurface","inverseOnSurface"],"mappings":";;;;;oyBAaO,IAAMA,EAAN,cAA0CC,EAA1CC,WAAAA,uBAE4DC,KAAAC,qBAAsB,CAMzF,CAHqBC,QAAAA,GACjBF,KAAKG,QAAQ,qBAAqBC,MAAMJ,KAAKC,oBAC/C,6BALiEI,EAAA,CAAhEC,EAAS,CAAEC,UAAW,wBAAyBC,KAAMC,WAAuCZ,EAAAa,UAAA,2BAAA,GAFlFb,EAA2BQ,EAAA,CADvCM,EAAc,4BACFd,GCWP,MAAgBe,UAA2BC,EAAQC,EAAoBC,EAAgBC,MAA7FjB,WAAAA,mCAIkBkB,EAAAC,IAAAlB,KAA2B,MAC3BmB,EAAAD,IAAAlB,aACAoB,EAAAF,IAAAlB,MAAmB,GAEVqB,EAAA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UT,EAAYO,OAAOG,OAAOC,gfAyCpE/K,EAAA,CAAXC,KAA+CyL,GAAArL,UAAA,mBArFrCqL,GAAiB1L,EAAA,CAD7BM,EAAc,gBACFoL"}
1
+ {"version":3,"file":"tooltip.min.js","sources":["../../src/tooltip/RichTooltipActionElement.ts","../../src/tooltip/TooltipElementBase.ts","../../src/tooltip/RichTooltipElement.ts","../../src/tooltip/TooltipElement.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\r\n\r\nimport { ActionElementBase, customElement } from \"@m3e/web/core\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to dismiss a parenting rich tooltip.\r\n * @tag m3e-rich-tooltip-action\r\n *\r\n * @slot - Renders the content of the action.\r\n *\r\n * @attr disable-restore-focus - Whether to focus should not be restored to the trigger when activated.\r\n */\r\n@customElement(\"m3e-rich-tooltip-action\")\r\nexport class M3eRichTooltipActionElement extends ActionElementBase {\r\n /** Whether to focus should not be restored to the trigger when activated. */\r\n @property({ attribute: \"disable-restore-focus\", type: Boolean }) disableRestoreFocus = false;\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n this.closest(\"m3e-rich-tooltip\")?.hide(!this.disableRestoreFocus);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-rich-tooltip-action\": M3eRichTooltipActionElement;\r\n }\r\n}\r\n","import { LitElement, PropertyValues } from \"lit\";\r\nimport { property, query } from \"lit/decorators.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n HoverController,\r\n HtmlFor,\r\n isDisabledMixin,\r\n LongPressController,\r\n ReconnectedCallback,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { M3ePlatform } from \"@m3e/web/core/platform\";\r\nimport { AnchorPosition, positionAnchor } from \"@m3e/web/core/anchoring\";\r\n\r\nimport { TooltipTouchGestures } from \"./TooltipTouchGestures\";\r\n\r\n/** The space, in pixels, between the tooltip and anchor. */\r\nconst TOOLTIP_OFFSET = 4;\r\n\r\n/** The default time, in milliseconds, before hiding a tooltip. */\r\nconst TOOLTIP_HIDE_DELAY = 200;\r\n\r\n/** Provides a base implementation for a tooltip. This class must be inherited. */\r\nexport abstract class TooltipElementBase extends HtmlFor(ReconnectedCallback(AttachInternals(LitElement))) {\r\n /** @private */ private static __openTooltips = new Array<TooltipElementBase>();\r\n\r\n /** @internal */ @query(\".base\") protected readonly _base!: HTMLElement;\r\n /** @private */ #for: HTMLElement | null = null;\r\n /** @private */ #anchorCleanup?: () => void;\r\n /** @private */ #tooltipHovering = false;\r\n\r\n /** @private */ readonly #controlClickHandler = () => this.#handleControlClick();\r\n\r\n /** @private */\r\n readonly #hoverController = new HoverController(this, {\r\n target: null,\r\n endDelay: TOOLTIP_HIDE_DELAY,\r\n callback: (hovering, target) => {\r\n if (this._isInteractive) return;\r\n if (hovering) {\r\n if (target === this._base) {\r\n this.#tooltipHovering = true;\r\n return;\r\n }\r\n this.show();\r\n } else if (!this.#tooltipHovering || target === this._base) {\r\n this.#tooltipHovering = false;\r\n this.hide();\r\n }\r\n },\r\n });\r\n\r\n /** @private */\r\n readonly #longPressController = new LongPressController(this, {\r\n target: null,\r\n callback: (pressed) => {\r\n if (this._isInteractive) return;\r\n if (pressed) {\r\n this.show();\r\n } else {\r\n this.hide();\r\n }\r\n },\r\n });\r\n\r\n /**\r\n * Whether the element is disabled.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) disabled = false;\r\n\r\n /**\r\n * The amount of time, in milliseconds, before showing the tooltip.\r\n * @default 0\r\n */\r\n @property({ attribute: \"show-delay\", type: Number }) get showDelay(): number {\r\n return this.#hoverController.startDelay;\r\n }\r\n set showDelay(value: number) {\r\n this.#hoverController.startDelay = value;\r\n }\r\n\r\n /**\r\n * The amount of time, in milliseconds, before hiding the tooltip.\r\n * @default 200\r\n */\r\n @property({ attribute: \"hide-delay\", type: Number }) get hideDelay(): number {\r\n return this.#hoverController.endDelay;\r\n }\r\n set hideDelay(value: number) {\r\n this.#hoverController.endDelay = value;\r\n }\r\n\r\n /**\r\n * The mode in which to handle touch gestures.\r\n * @default \"auto\"\r\n */\r\n @property({ attribute: \"touch-gestures\" }) touchGestures: TooltipTouchGestures = \"auto\";\r\n\r\n /** Whether the tooltip is currently open. */\r\n get isOpen(): boolean {\r\n return TooltipElementBase.__openTooltips.includes(this);\r\n }\r\n\r\n /**\r\n * Whether the tooltip is interactive.\r\n * @internal\r\n */\r\n protected get _isInteractive() {\r\n return false;\r\n }\r\n\r\n /**\r\n * The position in which to anchor the tooltip relative to its trigger.\r\n * @internal\r\n */\r\n protected abstract get _anchorPosition(): AnchorPosition;\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n super.attach(control);\r\n\r\n if (M3ePlatform.iOS || M3ePlatform.Android) {\r\n this.#longPressController.observe(control);\r\n this.#disableNativeGesturesIfNecessary();\r\n } else {\r\n this.#hoverController.observe(control);\r\n }\r\n\r\n control.addEventListener(\"click\", this.#controlClickHandler);\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control) {\r\n this.#hoverController.unobserve(this.control);\r\n this.#longPressController.unobserve(this.control);\r\n this.control.removeEventListener(\"click\", this.#controlClickHandler);\r\n this.hide();\r\n }\r\n super.detach();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"disabled\") && this.disabled) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n this.#initialize();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override firstUpdated(_changedProperties: PropertyValues<this>): void {\r\n super.firstUpdated(_changedProperties);\r\n this.#initialize();\r\n }\r\n\r\n /** @private */\r\n #initialize(): void {\r\n if (this._base) {\r\n this.#hoverController.observe(this._base);\r\n }\r\n }\r\n\r\n /**\r\n * Manually shows the tooltip.\r\n * @returns {Promise<void>} A `Promise` that resolves when the tooltip is shown.\r\n */\r\n async show(): Promise<void> {\r\n if (!this.control || this.disabled || (isDisabledMixin(this.control) && this.control.disabled)) return;\r\n\r\n TooltipElementBase.__openTooltips.filter((x) => x !== this).forEach((x) => x.hide());\r\n\r\n this._base.showPopover();\r\n\r\n this.#anchorCleanup = await positionAnchor(\r\n this._base,\r\n this.control,\r\n {\r\n position: this._anchorPosition,\r\n inline: true,\r\n flip: true,\r\n shift: \"main\",\r\n offset: TOOLTIP_OFFSET,\r\n },\r\n (x, y) => this._updatePosition(this._base, x, y),\r\n );\r\n\r\n if (!TooltipElementBase.__openTooltips.includes(this)) {\r\n TooltipElementBase.__openTooltips.push(this);\r\n }\r\n }\r\n\r\n /** Manually hides the tooltip. */\r\n hide(): void {\r\n this._base.hidePopover();\r\n this.#anchorCleanup?.();\r\n this.#anchorCleanup = undefined;\r\n this.#hoverController.clearDelays();\r\n\r\n if (TooltipElementBase.__openTooltips.includes(this)) {\r\n TooltipElementBase.__openTooltips = TooltipElementBase.__openTooltips.filter((x) => x !== this);\r\n }\r\n }\r\n\r\n /**\r\n * Updates the position of the tooltip.\r\n * @internal\r\n * @param {HTMLElement} base The internal element of the tooltip to position.\r\n * @param {number} x The x-coordinate, in pixels, to which to position `base`.\r\n * @param {number} y The y-coordinate, in pixels, to which to position `base`.\r\n */\r\n protected abstract _updatePosition(base: HTMLElement, x: number, y: number): void;\r\n\r\n /** @private */\r\n #handleControlClick(): void {\r\n if (this._isInteractive) {\r\n if (TooltipElementBase.__openTooltips.includes(this)) {\r\n this.hide();\r\n } else {\r\n this.show();\r\n }\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #disableNativeGesturesIfNecessary() {\r\n if (this.touchGestures !== \"off\" && this.#for) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const style: any = this.#for.style;\r\n\r\n // If gestures are set to `auto`, we don't disable text selection on inputs and\r\n // textareas, because it prevents the user from typing into them on iOS Safari.\r\n\r\n if (this.touchGestures === \"on\" || (this.#for.nodeName !== \"INPUT\" && this.#for.nodeName !== \"TEXTAREA\")) {\r\n style.userSelect = style.msUserSelect = style.webkitUserSelect = style.MozUserSelect = \"none\";\r\n }\r\n\r\n // If we have `auto` gestures and the element uses native HTML dragging,\r\n // we don't set `-webkit-user-drag` because it prevents the native behavior.\r\n\r\n if (this.touchGestures === \"on\" || !this.#for.draggable) {\r\n style.webkitUserDrag = \"none\";\r\n }\r\n\r\n style.touchAction = \"none\";\r\n style.webkitTapHighlightColor = \"transparent\";\r\n }\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, PropertyValues, unsafeCSS } from \"lit\";\r\nimport { property, state } from \"lit/decorators.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, DesignToken, getTextContent, hasAssignedNodes } from \"@m3e/web/core\";\r\nimport { M3eAriaDescriber, M3eInteractivityChecker } from \"@m3e/web/core/a11y\";\r\nimport { AnchorPosition } from \"@m3e/web/core/anchoring\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { RichTooltipPosition } from \"./RichTooltipPosition\";\r\nimport { TooltipElementBase } from \"./TooltipElementBase\";\r\n\r\n/**\r\n * Provides contextual details for a control, such as explaining the value or purpose of a feature.\r\n *\r\n * @description\r\n * The `m3e-rich-tooltip` component provides contextual guidance for a control. It supports an optional\r\n * subhead, multi-line supporting text, and optional action elements. When non‑interactive, it behaves\r\n * as a standard tooltip and contributes an `aria-describedby` message to its control. When interactive,\r\n * it becomes a lightweight anchored dialog with manual popover behavior, keyboard dismissal, and\r\n * click‑outside light‑dismiss.\r\n *\r\n * @example\r\n * The following example illustrates connecting an interactive rich tooltip to a button using the `for` attribute.\r\n * ```html\r\n * <m3e-icon-button id=\"btnSettings\">\r\n * <m3e-icon name=\"settings\"></m3e-icon>\r\n * </m3e-icon-button>\r\n * <m3e-rich-tooltip for=\"btnSettings\">\r\n * <span slot=\"subhead\">New settings available</span>\r\n * Now you can adjust the uploaded image quality, and upgrade your available storage space.\r\n * <div slot=\"actions\">\r\n * <m3e-button>\r\n * <m3e-rich-tooltip-action>Learn more</m3e-rich-tooltip-action>\r\n * </m3e-button>\r\n * </div>\r\n * </m3e-rich-tooltip>\r\n * ```\r\n *\r\n * @tag m3e-rich-tooltip\r\n *\r\n * @slot - The main supporting text of the tooltip.\r\n * @slot subhead - Optional subhead text displayed above the supporting content.\r\n * @slot actions - Optional action elements displayed at the bottom of the tooltip.\r\n *\r\n * @attr disabled - Whether the element is disabled.\r\n * @attr for - The identifier of the interactive control to which this element is attached.\r\n * @attr hide-delay - The amount of time, in milliseconds, before hiding the tooltip.\r\n * @attr position - The position of the tooltip.\r\n * @attr show-delay - The amount of time, in milliseconds, before showing the tooltip.\r\n *\r\n * @fires beforetoggle - Dispatched before the toggle state changes.\r\n * @fires toggle - Dispatched after the toggle state has changed.\r\n *\r\n * @cssprop --m3e-rich-tooltip-padding-top - Top padding of the tooltip container.\r\n * @cssprop --m3e-rich-tooltip-padding-bottom - Bottom padding of the tooltip container (when no actions are present).\r\n * @cssprop --m3e-rich-tooltip-padding-inline - Horizontal padding of the tooltip container.\r\n * @cssprop --m3e-rich-tooltip-max-width - Maximum width of the tooltip surface.\r\n * @cssprop --m3e-rich-tooltip-shape - Border‑radius of the tooltip container.\r\n * @cssprop --m3e-rich-tooltip-container-color - Background color of the tooltip surface.\r\n * @cssprop --m3e-rich-tooltip-subhead-color - Color of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-font-size - Font size of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-font-weight - Font weight of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-line-height - Line height of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-tracking - Letter‑spacing of the subhead text.\r\n * @cssprop --m3e-rich-tooltip-subhead-bottom-space - Space below the subhead before the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-color - Color of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-font-size - Font size of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-font-weight - Font weight of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-line-height - Line height of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-supporting-text-tracking - Letter‑spacing of the supporting text.\r\n * @cssprop --m3e-rich-tooltip-actions-padding-inline - Horizontal padding applied to the actions slot area.\r\n * @cssprop --m3e-rich-tooltip-actions-top-space - Space above the actions slot.\r\n * @cssprop --m3e-rich-tooltip-actions-bottom-space - Space below the actions slot.\r\n */\r\n@customElement(\"m3e-rich-tooltip\")\r\nexport class M3eRichTooltipElement extends TooltipElementBase {\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 .base {\r\n flex-direction: column;\r\n position: absolute;\r\n padding: unset;\r\n margin: unset;\r\n border: unset;\r\n padding-block-start: var(--m3e-rich-tooltip-padding-top, 0.75rem);\r\n padding-inline: var(--m3e-rich-tooltip-padding-inline, 1rem);\r\n max-width: var(--m3e-rich-tooltip-max-width, 20rem);\r\n box-sizing: border-box;\r\n overflow: visible;\r\n border-radius: var(--m3e-rich-tooltip-shape, ${DesignToken.shape.corner.medium});\r\n background-color: var(--m3e-rich-tooltip-container-color, ${DesignToken.color.surfaceContainer});\r\n display: none;\r\n opacity: 0;\r\n transform: scale(0.8);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n display ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .base:not(.has-actions) {\r\n padding-block-end: var(--m3e-rich-tooltip-padding-bottom, 0.75rem);\r\n }\r\n .base::backdrop {\r\n background-color: transparent;\r\n }\r\n .base:popover-open {\r\n display: flex;\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n .base:not(.has-subhead) .subhead,\r\n .base:not(.has-actions) .actions {\r\n display: none;\r\n }\r\n .subhead {\r\n color: var(--m3e-rich-tooltip-subhead-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(--m3e-rich-tooltip-subhead-font-size, ${DesignToken.typescale.standard.title.small.fontSize});\r\n font-weight: var(\r\n --m3e-rich-tooltip-subhead-font-weight,\r\n ${DesignToken.typescale.standard.title.small.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-rich-tooltip-subhead-line-height,\r\n ${DesignToken.typescale.standard.title.small.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-rich-tooltip-subhead-tracking, ${DesignToken.typescale.standard.title.small.tracking});\r\n padding-block-end: var(--m3e-rich-tooltip-subhead-bottom-space, 0.25rem);\r\n }\r\n .content {\r\n color: var(--m3e-rich-tooltip-supporting-text-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(\r\n --m3e-rich-tooltip-supporting-text-font-size,\r\n ${DesignToken.typescale.standard.body.medium.fontSize}\r\n );\r\n font-weight: var(\r\n --m3e-rich-tooltip-supporting-text-font-weight,\r\n ${DesignToken.typescale.standard.body.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-rich-tooltip-supporting-text-line-height,\r\n ${DesignToken.typescale.standard.body.medium.lineHeight}\r\n );\r\n letter-spacing: var(\r\n --m3e-rich-tooltip-supporting-text-tracking,\r\n ${DesignToken.typescale.standard.body.medium.tracking}\r\n );\r\n }\r\n .actions {\r\n margin-inline: calc(\r\n 0px - calc(\r\n var(--m3e-rich-tooltip-padding-inline, 1rem) - var(--m3e-rich-tooltip-actions-padding-inline, 0.25rem)\r\n )\r\n );\r\n padding-block-start: var(--m3e-rich-tooltip-actions-top-space, 0.75rem);\r\n padding-block-end: var(--m3e-rich-tooltip-actions-bottom-space, 0.5rem);\r\n }\r\n ::slotted([slot=\"actions\"]) {\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n min-height: 1.5rem;\r\n column-gap: 0.5rem;\r\n }\r\n ::slotted([slot=\"actions\"][end]) {\r\n justify-content: flex-end;\r\n }\r\n @starting-style {\r\n .base:popover-open {\r\n opacity: 0;\r\n transform: scale(0.8);\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n .base {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n .base {\r\n background-color: Canvas;\r\n color: CanvasText;\r\n box-sizing: border-box;\r\n border: 1px solid CanvasText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __nextId = 0;\r\n /** @private */ #id = M3eRichTooltipElement.__nextId++;\r\n /** @private */ #subheadText = \"\";\r\n /** @private */ #contentText = \"\";\r\n /** @private */ #message = \"\";\r\n /** @private */ #messageRegistered = false;\r\n\r\n /** @private */ @state() private _hasSubhead = false;\r\n /** @private */ @state() private _interactive = false;\r\n\r\n /** @private */ readonly #documentClickHandler = (e: MouseEvent) => this.#handleDocumentClick(e);\r\n\r\n /**\r\n * The position of the tooltip.\r\n * @default \"below-after\"\r\n */\r\n @property() position: RichTooltipPosition = \"below-after\";\r\n\r\n /** @inheritdoc */\r\n protected override get _isInteractive() {\r\n return this._interactive;\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override get _anchorPosition(): AnchorPosition {\r\n switch (this.position) {\r\n case \"above\":\r\n return \"top\";\r\n case \"above-after\":\r\n return M3eDirectionality.current === \"rtl\" ? \"top-start\" : \"top-end\";\r\n case \"above-before\":\r\n return M3eDirectionality.current === \"rtl\" ? \"top-end\" : \"top-start\";\r\n case \"after\":\r\n return M3eDirectionality.current === \"rtl\" ? \"left\" : \"right\";\r\n case \"before\":\r\n return M3eDirectionality.current === \"rtl\" ? \"right\" : \"left\";\r\n case \"below\":\r\n return \"bottom\";\r\n case \"below-after\":\r\n return M3eDirectionality.current === \"rtl\" ? \"bottom-start\" : \"bottom-end\";\r\n case \"below-before\":\r\n return M3eDirectionality.current === \"rtl\" ? \"bottom-end\" : \"bottom-start\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const subheadId = this._interactive && this._hasSubhead ? `m3e-rich-tooltip-${this.#id}-subhead` : undefined;\r\n return html`<div\r\n class=\"base\"\r\n popover=\"manual\"\r\n role=\"${ifDefined(this._interactive ? \"dialog\" : undefined)}\"\r\n aria-labelledby=\"${ifDefined(subheadId)}\"\r\n @keydown=\"${this.#handleKeyDown}\"\r\n @beforetoggle=\"${this.#handleBeforeToggle}\"\r\n @toggle=\"${this.#handleToggle}\"\r\n >\r\n <m3e-elevation level=\"3\"></m3e-elevation>\r\n <div class=\"subhead\" id=\"${ifDefined(subheadId)}\">\r\n <slot name=\"subhead\" @slotchange=\"${this.#handleSubheadSlotChange}\"></slot>\r\n </div>\r\n <div class=\"content\"><slot @slotchange=\"${this.#handleContentSlotChange}\"></slot></div>\r\n <div class=\"actions\">\r\n <slot name=\"actions\" @slotchange=\"${this.#handleActionsSlotChange}\"></slot>\r\n </div>\r\n </div>`;\r\n }\r\n\r\n /** @inheritdoc */\r\n override show(): Promise<void> {\r\n if (this._interactive) {\r\n document.addEventListener(\"click\", this.#documentClickHandler);\r\n }\r\n\r\n return super.show();\r\n }\r\n\r\n /**\r\n * Manually hides the tooltip.\r\n * @param [restoreFocus=true] Whether to restore focus to the element that triggered the interactive tooltip.\r\n */\r\n override hide(restoreFocus = true): void {\r\n if (this._interactive) {\r\n document.removeEventListener(\"click\", this.#documentClickHandler);\r\n }\r\n\r\n super.hide();\r\n\r\n if (restoreFocus && this._interactive && this.control && M3eInteractivityChecker.isFocusable(this.control)) {\r\n this.control.focus();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n super.attach(control);\r\n\r\n this.#updateMessage();\r\n\r\n if (this._interactive) {\r\n control.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"_interactive\")) {\r\n this.ariaHidden = this._interactive ? null : \"true\";\r\n this.#updateMessage();\r\n\r\n if (this.control && this._interactive) {\r\n this.control.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override _updatePosition(base: HTMLElement, x: number, y: number): void {\r\n if (this.position.includes(\"before\") && this.position !== \"before\") {\r\n if (M3eDirectionality.current === \"rtl\") {\r\n x += this.control?.clientWidth ?? 0;\r\n } else {\r\n x -= this.control?.clientWidth ?? 0;\r\n }\r\n }\r\n if (this.position.includes(\"after\") && this.position !== \"after\") {\r\n if (M3eDirectionality.current === \"rtl\") {\r\n x -= this.control?.clientWidth ?? 0;\r\n } else {\r\n x += this.control?.clientWidth ?? 0;\r\n }\r\n }\r\n\r\n if (M3eDirectionality.current === \"rtl\") {\r\n base.style.right = `${window.innerWidth - x - base.clientWidth}px`;\r\n base.style.left = \"\";\r\n } else {\r\n base.style.left = `${x}px`;\r\n base.style.right = \"\";\r\n }\r\n\r\n base.style.top = `${y}px`;\r\n }\r\n\r\n /** @private */\r\n #handleBeforeToggle(e: ToggleEvent): void {\r\n const forwarded = new ToggleEvent(\"beforetoggle\", {\r\n oldState: e.oldState,\r\n newState: e.newState,\r\n bubbles: true,\r\n composed: true,\r\n cancelable: e.cancelable,\r\n });\r\n\r\n if (!this.dispatchEvent(forwarded)) {\r\n e.preventDefault();\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleToggle(e: ToggleEvent): void {\r\n const forwarded = new ToggleEvent(\"toggle\", {\r\n oldState: e.oldState,\r\n newState: e.newState,\r\n bubbles: true,\r\n composed: true,\r\n });\r\n this.dispatchEvent(forwarded);\r\n }\r\n\r\n /** @private */\r\n #handleDocumentClick(e: MouseEvent): void {\r\n if (!e.composedPath().some((x) => x instanceof M3eRichTooltipElement || x === this.control)) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleKeyDown(e: KeyboardEvent): void {\r\n if (e.key === \"Escape\" && !e.shiftKey && !e.ctrlKey) {\r\n e.preventDefault();\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleSubheadSlotChange(e: Event): void {\r\n this._hasSubhead = hasAssignedNodes(e.target as HTMLSlotElement);\r\n this.shadowRoot?.querySelector(\".base\")?.classList.toggle(\"has-subhead\", this._hasSubhead);\r\n this.#subheadText = this._hasSubhead ? getTextContent(e.target as HTMLSlotElement, true) : \"\";\r\n this.#updateMessage();\r\n }\r\n\r\n /** @private */\r\n #handleContentSlotChange(e: Event): void {\r\n this._interactive = M3eInteractivityChecker.findInteractiveElements(this, true).length > 0;\r\n this.#contentText = getTextContent(e.target as HTMLSlotElement, true);\r\n this.#updateMessage();\r\n }\r\n\r\n /** @private */\r\n #handleActionsSlotChange(e: Event): void {\r\n this.shadowRoot\r\n ?.querySelector(\".base\")\r\n ?.classList.toggle(\"has-actions\", hasAssignedNodes(e.target as HTMLSlotElement));\r\n\r\n this._interactive = M3eInteractivityChecker.findInteractiveElements(this, true).length > 0;\r\n this.#updateMessage();\r\n }\r\n\r\n /** @private */\r\n #updateMessage() {\r\n const message = this.#subheadText ? `${this.#subheadText}/n${this.#contentText}` : this.#contentText;\r\n if (this.isConnected && this.control) {\r\n if (this.#message && this.#messageRegistered) {\r\n M3eAriaDescriber.removeDescription(this.control, this.#message);\r\n this.#messageRegistered = false;\r\n }\r\n\r\n this.#message = message;\r\n\r\n if (this.#message && !this._interactive) {\r\n M3eAriaDescriber.describe(this.control, this.#message);\r\n this.#messageRegistered = true;\r\n }\r\n }\r\n }\r\n}\r\n\r\ninterface M3eRichTooltipElementEventMap extends HTMLElementEventMap {\r\n beforetoggle: ToggleEvent;\r\n toggle: ToggleEvent;\r\n}\r\n\r\nexport interface M3eRichTooltipElement {\r\n addEventListener<K extends keyof M3eRichTooltipElementEventMap>(\r\n type: K,\r\n listener: (this: M3eRichTooltipElement, ev: M3eRichTooltipElementEventMap[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 M3eRichTooltipElementEventMap>(\r\n type: K,\r\n listener: (this: M3eRichTooltipElement, ev: M3eRichTooltipElementEventMap[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-rich-tooltip\": M3eRichTooltipElement;\r\n }\r\n}\r\n","import { css, CSSResultGroup, html, unsafeCSS } from \"lit\";\r\nimport { property } from \"lit/decorators.js\";\r\n\r\nimport { customElement, DesignToken, getTextContent, setCustomState } from \"@m3e/web/core\";\r\nimport { M3eAriaDescriber } from \"@m3e/web/core/a11y\";\r\nimport { AnchorPosition } from \"@m3e/web/core/anchoring\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { TooltipPosition } from \"./TooltipPosition\";\r\nimport { TooltipElementBase } from \"./TooltipElementBase\";\r\n\r\n/**\r\n * Adds additional context to a button or other UI element.\r\n *\r\n * @description\r\n * The `m3e-tooltip` component provides contextual information in response to user interaction, enhancing comprehension\r\n * and reducing ambiguity. Tooltips are positioned relative to a target element and support configurable delays for\r\n * show and hide behavior. The component is designed to reinforce accessibility and usability, especially in dense or\r\n * icon-driven interfaces. Use the `for` attribute to designate the element for which to provide a tooltip.\r\n *\r\n * @example\r\n * The following example illustrates connecting a tooltip to a button using the `for` attribute.\r\n * ```html\r\n * <m3e-icon-button id=\"button\" aria-label=\"Back\">\r\n * <m3e-icon name=\"arrow_back\"></m3e-icon>\r\n * </m3e-icon-button>\r\n * <m3e-tooltip for=\"button\">Go Back</m3e-tooltip>\r\n * ```\r\n *\r\n * @tag m3e-tooltip\r\n *\r\n * @slot - Renders the content of the tooltip.\r\n *\r\n * @attr disabled - Whether the element is disabled.\r\n * @attr for - The identifier of the interactive control to which this element is attached.\r\n * @attr hide-delay - The amount of time, in milliseconds, before hiding the tooltip.\r\n * @attr position - The position of the tooltip.\r\n * @attr show-delay - The amount of time, in milliseconds, before showing the tooltip.\r\n *\r\n * @cssprop --m3e-tooltip-padding - Internal spacing of the tooltip container.\r\n * @cssprop --m3e-tooltip-min-width - Minimum width of the tooltip.\r\n * @cssprop --m3e-tooltip-max-width - Maximum width of the tooltip.\r\n * @cssprop --m3e-tooltip-min-height - Minimum height of the tooltip container.\r\n * @cssprop --m3e-tooltip-max-height - Maximum height of the tooltip.\r\n * @cssprop --m3e-tooltip-shape - Border radius of the tooltip container.\r\n * @cssprop --m3e-tooltip-container-color - Background color of the tooltip.\r\n * @cssprop --m3e-tooltip-supporting-text-color - Text color of supporting text.\r\n * @cssprop --m3e-tooltip-supporting-text-font-size - Font size of supporting text.\r\n * @cssprop --m3e-tooltip-supporting-text-font-weight - Font weight of supporting text.\r\n * @cssprop --m3e-tooltip-supporting-text-line-height - Line height of supporting text.\r\n * @cssprop --m3e-tooltip-supporting-text-tracking - Letter spacing of supporting text.\r\n */\r\n@customElement(\"m3e-tooltip\")\r\nexport class M3eTooltipElement extends TooltipElementBase {\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 .base {\r\n position: absolute;\r\n pointer-events: none;\r\n margin: unset;\r\n border: unset;\r\n word-break: normal;\r\n overflow-wrap: break-word;\r\n padding: var(--m3e-tooltip-padding, 0.25rem 0.5rem);\r\n min-width: var(--m3e-tooltip-min-width, 2.5rem);\r\n max-width: var(--m3e-tooltip-max-width, 12.5rem);\r\n min-height: var(--m3e-tooltip-min-height, 1.5rem);\r\n max-height: var(--m3e-tooltip-max-height, 40vh);\r\n box-sizing: border-box;\r\n overflow: hidden;\r\n text-align: center;\r\n border-radius: var(--m3e-tooltip-shape, ${DesignToken.shape.corner.extraSmall});\r\n background-color: var(--m3e-tooltip-container-color, ${DesignToken.color.inverseSurface});\r\n color: var(--m3e-tooltip-supporting-text-color, ${DesignToken.color.inverseOnSurface});\r\n font-size: var(--m3e-tooltip-supporting-text-font-size, ${DesignToken.typescale.standard.body.small.fontSize});\r\n font-weight: var(\r\n --m3e-tooltip-supporting-text-font-weight,\r\n ${DesignToken.typescale.standard.body.small.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-tooltip-supporting-text-line-height,\r\n ${DesignToken.typescale.standard.body.small.lineHeight}\r\n );\r\n letter-spacing: var(\r\n --m3e-tooltip-supporting-text-tracking,\r\n ${DesignToken.typescale.standard.body.small.tracking}\r\n );\r\n display: none;\r\n opacity: 0;\r\n transform: scale(0.8);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n display ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host(:is(:state(--multiline), :--multiline)) .base {\r\n text-align: start;\r\n }\r\n .base::backdrop {\r\n background-color: transparent;\r\n }\r\n .base:popover-open {\r\n display: block;\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n @starting-style {\r\n .base:popover-open {\r\n opacity: 0;\r\n transform: scale(0.8);\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n .base {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n .base {\r\n background-color: Canvas;\r\n color: CanvasText;\r\n box-sizing: border-box;\r\n border: 1px solid CanvasText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ #message?: string | null;\r\n\r\n /**\r\n * The position of the tooltip.\r\n * @default \"below\"\r\n */\r\n @property() position: TooltipPosition = \"below\";\r\n\r\n /** @inheritdoc */\r\n protected get _anchorPosition(): AnchorPosition {\r\n return this.position === \"above\"\r\n ? \"top\"\r\n : this.position === \"below\"\r\n ? \"bottom\"\r\n : this.position === \"before\"\r\n ? M3eDirectionality.current === \"ltr\"\r\n ? \"left\"\r\n : \"right\"\r\n : M3eDirectionality.current === \"ltr\"\r\n ? \"right\"\r\n : \"left\";\r\n }\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n super.attach(control);\r\n\r\n if (this.#message) {\r\n M3eAriaDescriber.describe(control, this.#message);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control && this.#message) {\r\n M3eAriaDescriber.removeDescription(this.control, this.#message);\r\n }\r\n super.detach();\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.ariaHidden = \"true\";\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"base\" popover=\"manual\" @toggle=\"${this.#handleToggle}\">\r\n <slot @slotchange=\"${this.#handleSlotChange}\"></slot>\r\n </div>`;\r\n }\r\n\r\n /** @inheritdoc */\r\n protected _updatePosition(base: HTMLElement, x: number, y: number): void {\r\n if (M3eDirectionality.current === \"rtl\") {\r\n base.style.right = `${window.innerWidth - x - base.clientWidth}px`;\r\n base.style.left = \"\";\r\n } else {\r\n base.style.left = `${x}px`;\r\n base.style.right = \"\";\r\n }\r\n base.style.top = `${y}px`;\r\n }\r\n\r\n /** @private */\r\n #handleSlotChange(e: Event): void {\r\n const message = getTextContent(e.target as HTMLSlotElement, true);\r\n if (this.isConnected && this.control) {\r\n if (this.#message) {\r\n M3eAriaDescriber.removeDescription(this.control, this.#message);\r\n }\r\n\r\n this.#message = message;\r\n\r\n if (this.#message) {\r\n M3eAriaDescriber.describe(this.control, this.#message);\r\n }\r\n } else {\r\n this.#message = message;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleToggle(e: ToggleEvent): void {\r\n if (e.newState === \"open\") {\r\n const multiline = this._base.getBoundingClientRect().height > parseFloat(getComputedStyle(this._base).minHeight);\r\n setCustomState(this, \"--multiline\", multiline);\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-tooltip\": M3eTooltipElement;\r\n }\r\n}\r\n"],"names":["M3eRichTooltipActionElement","ActionElementBase","constructor","this","disableRestoreFocus","_onClick","closest","hide","__decorate","property","attribute","type","Boolean","prototype","customElement","TooltipElementBase","HtmlFor","ReconnectedCallback","AttachInternals","LitElement","_TooltipElementBase_for","set","_TooltipElementBase_anchorCleanup","_TooltipElementBase_tooltipHovering","_TooltipElementBase_controlClickHandler","__classPrivateFieldGet","_TooltipElementBase_instances","_TooltipElementBase_handleControlClick","call","_TooltipElementBase_hoverController","HoverController","target","endDelay","callback","hovering","_isInteractive","_base","__classPrivateFieldSet","show","_TooltipElementBase_longPressController","LongPressController","pressed","disabled","touchGestures","showDelay","startDelay","value","hideDelay","isOpen","_a","__openTooltips","includes","attach","control","super","M3ePlatform","iOS","Android","observe","_TooltipElementBase_disableNativeGesturesIfNecessary","addEventListener","detach","unobserve","removeEventListener","update","changedProperties","has","reconnectedCallback","_TooltipElementBase_initialize","firstUpdated","_changedProperties","isDisabledMixin","filter","x","forEach","showPopover","positionAnchor","position","_anchorPosition","inline","flip","shift","offset","y","_updatePosition","push","hidePopover","undefined","clearDelays","style","nodeName","userSelect","msUserSelect","webkitUserSelect","MozUserSelect","draggable","webkitUserDrag","touchAction","webkitTapHighlightColor","Array","query","reflect","Number","M3eRichTooltipElement","M3eRichTooltipElement_1","_M3eRichTooltipElement_id","__nextId","_M3eRichTooltipElement_subheadText","_M3eRichTooltipElement_contentText","_M3eRichTooltipElement_message","_M3eRichTooltipElement_messageRegistered","_hasSubhead","_interactive","_M3eRichTooltipElement_documentClickHandler","e","M3eDirectionality","current","render","subheadId","html","ifDefined","_M3eRichTooltipElement_instances","_M3eRichTooltipElement_handleKeyDown","_M3eRichTooltipElement_handleBeforeToggle","_M3eRichTooltipElement_handleToggle","_M3eRichTooltipElement_handleSubheadSlotChange","_M3eRichTooltipElement_handleContentSlotChange","_M3eRichTooltipElement_handleActionsSlotChange","document","restoreFocus","M3eInteractivityChecker","isFocusable","focus","_M3eRichTooltipElement_updateMessage","ariaHasPopup","ariaHidden","base","clientWidth","right","window","innerWidth","left","top","forwarded","ToggleEvent","oldState","newState","bubbles","composed","cancelable","dispatchEvent","preventDefault","composedPath","some","key","shiftKey","ctrlKey","hasAssignedNodes","shadowRoot","querySelector","classList","toggle","getTextContent","findInteractiveElements","length","message","isConnected","M3eAriaDescriber","removeDescription","describe","styles","css","DesignToken","shape","corner","medium","color","surfaceContainer","unsafeCSS","motion","duration","short3","easing","standard","onSurfaceVariant","typescale","title","small","fontSize","fontWeight","lineHeight","tracking","body","state","M3eTooltipElement","_M3eTooltipElement_message","connectedCallback","_M3eTooltipElement_instances","_M3eTooltipElement_handleToggle","_M3eTooltipElement_handleSlotChange","multiline","getBoundingClientRect","height","parseFloat","getComputedStyle","minHeight","setCustomState","extraSmall","inverseSurface","inverseOnSurface"],"mappings":";;;;;oyBAaO,IAAMA,EAAN,cAA0CC,EAA1CC,WAAAA,uBAE4DC,KAAAC,qBAAsB,CAMzF,CAHqBC,QAAAA,GACjBF,KAAKG,QAAQ,qBAAqBC,MAAMJ,KAAKC,oBAC/C,6BALiEI,EAAA,CAAhEC,EAAS,CAAEC,UAAW,wBAAyBC,KAAMC,WAAuCZ,EAAAa,UAAA,2BAAA,GAFlFb,EAA2BQ,EAAA,CADvCM,EAAc,4BACFd,GCWP,MAAgBe,UAA2BC,EAAQC,EAAoBC,EAAgBC,MAA7FjB,WAAAA,mCAIkBkB,EAAAC,IAAAlB,KAA2B,MAC3BmB,EAAAD,IAAAlB,aACAoB,EAAAF,IAAAlB,MAAmB,GAEVqB,EAAAH,IAAAlB,KAAu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G,OAAOC,ogBAyCpE/K,EAAA,CAAXC,KAA+CyL,GAAArL,UAAA,mBArFrCqL,GAAiB1L,EAAA,CAD7BM,EAAc,gBACFoL"}
package/dist/tree.js CHANGED
@@ -36,11 +36,11 @@ var M3eTreeItemElement_1;
36
36
  * @attr open - Whether the item is expanded.
37
37
  * @attr selected - Whether the item is selected.
38
38
  *
39
- * @fires opening - Emitted when the item begins to open.
40
- * @fires opened - Emitted when the item has opened.
41
- * @fires closing - Emitted when the item begins to close.
42
- * @fires closed - Emitted when the item has closed.
43
- * @fires click - Emitted when the element is clicked.
39
+ * @fires opening - Dispatched when the item begins to open.
40
+ * @fires opened - Dispatched when the item has opened.
41
+ * @fires closing - Dispatched when the item begins to close.
42
+ * @fires closed - Dispatched when the item has closed.
43
+ * @fires click - Dispatched when the element is clicked.
44
44
  *
45
45
  * @cssprop --m3e-tree-item-font-size - Font size for the item label.
46
46
  * @cssprop --m3e-tree-item-font-weight - Font weight for the item label.
@@ -231,10 +231,10 @@ _M3eTreeItemElement_renderIcon = function _M3eTreeItemElement_renderIcon() {
231
231
  return this.selected && !this.hasChildItems ? html`<slot name="selected-icon" @slotchange="${__classPrivateFieldGet(this, _M3eTreeItemElement_instances, "m", _M3eTreeItemElement_handleIconSlotChange)}">${icon}</slot>` : icon;
232
232
  };
233
233
  _M3eTreeItemElement_handleOpenToggleIconSlotChange = function _M3eTreeItemElement_handleOpenToggleIconSlotChange(e) {
234
- setCustomState(this, "-with-open-toggle-icon", hasAssignedNodes(e.target));
234
+ setCustomState(this, "--with-open-toggle-icon", hasAssignedNodes(e.target));
235
235
  };
236
236
  _M3eTreeItemElement_handleIconSlotChange = function _M3eTreeItemElement_handleIconSlotChange(e) {
237
- setCustomState(this, "-with-icon", hasAssignedNodes(e.target));
237
+ setCustomState(this, "--with-icon", hasAssignedNodes(e.target));
238
238
  };
239
239
  _M3eTreeItemElement_handleSlotChange = function _M3eTreeItemElement_handleSlotChange(e) {
240
240
  __classPrivateFieldSet(this, _M3eTreeItemElement_link, e.target.assignedElements({
@@ -248,7 +248,7 @@ _M3eTreeItemElement_handleItemSlotChange = function _M3eTreeItemElement_handleIt
248
248
  }).filter(x => x instanceof M3eTreeItemElement_1), "f");
249
249
  const hadChildItems = this._hasChildItems;
250
250
  this._hasChildItems = __classPrivateFieldGet(this, _M3eTreeItemElement_items, "f").length > 0;
251
- setCustomState(this, "-with-items", this._hasChildItems);
251
+ setCustomState(this, "--with-items", this._hasChildItems);
252
252
  if (hadChildItems || this._hasChildItems) {
253
253
  if (this._multi && __classPrivateFieldGet(this, _M3eTreeItemElement_tree, "f")?.cascade) {
254
254
  let anySelected = false,
@@ -272,7 +272,7 @@ _M3eTreeItemElement_handleItemSlotChange = function _M3eTreeItemElement_handleIt
272
272
  };
273
273
  _M3eTreeItemElement_handleTreeChange = function _M3eTreeItemElement_handleTreeChange() {
274
274
  this._multi = __classPrivateFieldGet(this, _M3eTreeItemElement_tree, "f")?.multi === true;
275
- setCustomState(this, "-multi", this._multi);
275
+ setCustomState(this, "--multi", this._multi);
276
276
  };
277
277
  _M3eTreeItemElement_handleClick = function _M3eTreeItemElement_handleClick() {
278
278
  if (this.disabled) return;
@@ -311,8 +311,8 @@ _M3eTreeItemElement_handleCollapsibleEvent = function _M3eTreeItemElement_handle
311
311
  };
312
312
  /** The styles of the element. */
313
313
  M3eTreeItemElement.styles = css`:host { display: block; flex: none; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .base { display: flex; align-items: center; position: relative; height: calc(var(--m3e-tree-item-height, 3rem) + ${DesignToken.density.calc(-3)}); padding-inline: var(--m3e-tree-item-padding, 1rem); font-size: var(--m3e-tree-item-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-tree-item-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-tree-item-line-height, ${DesignToken.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-tree-item-tracking, ${DesignToken.typescale.standard.label.large.tracking}); transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard},
314
- background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } .base, .focus-ring { border-radius: var(--m3e-tree-item-shape, ${DesignToken.shape.corner.none}); } .label { flex: 1 1 auto; display: flex; align-items: center; position: relative; overflow: hidden; vertical-align: middle; } .checkbox { flex: none; margin-inline-end: 0.5rem; } .icon, .toggle { flex: none; align-items: center; justify-content: center; position: relative; vertical-align: middle; margin-inline-end: 0.5rem; } .toggle { display: var(--_tree-item-toggle-display, none); } :host(:not(:state(-with-icon))) .icon { display: none; } .inset { margin-inline-start: calc(var(--m3e-tree-item-inset, 2rem) * var(--_tree-item-level, 0)); } :host([open]) .toggle-icon { transform: rotate(90deg); } :host(:not(:state(-with-items))) .toggle { visibility: hidden; } :host(:not(:state(-with-items))) .group { display: none; } ::slotted([slot="selected-icon"]), ::slotted([slot="icon"]), ::slotted([slot="toggle-icon"]), ::slotted([slot="open-toggle-icon"]), .toggle-icon { vertical-align: middle; width: 1em; height: 1em; font-size: var(--m3e-tree-item-icon-size, 1.5rem); } .toggle-icon { transition: ${unsafeCSS(`transform var(--m3e-collapsible-animation-duration, ${DesignToken.motion.duration.medium1})
315
- ${DesignToken.motion.easing.standard}`)}; } :host(:state(-with-open-toggle-icon)[open]) slot[name="toggle-icon"], :host(:state(-with-open-toggle-icon):not([open])) slot[name="open-toggle-icon"] { display: none; } :host(:not(:disabled)) .base { cursor: pointer; } :host(:not(:disabled)) .base { color: var(--m3e-tree-item-label-color, ${DesignToken.color.onSurfaceVariant}); } :host(:disabled) .base { color: color-mix( in srgb, var(--m3e-tree-item-disabled-color, ${DesignToken.color.onSurface}) var(--m3e-tree-item-disabled-color-opacity, 38%), transparent ); } :host([selected]:not(:disabled)) .base { color: var(--m3e-tree-item-selected-label-color, ${DesignToken.color.onSecondaryContainer}); background-color: var(--m3e-tree-item-selected-container-color, ${DesignToken.color.secondaryContainer}); --m3e-state-layer-focus-color: var( --m3e-tree-item-selected-container-focus-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-hover-color: var( --m3e-tree-item-selected-container-hover-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-ripple-color: var(--m3e-tree-item-selected-ripple-color, ${DesignToken.color.onSecondaryContainer}); } :host(:not([selected]):not(:disabled)) .base { --m3e-state-layer-focus-color: var( --m3e-tree-item-unselected-container-focus-color, ${DesignToken.color.onSurface} ); --m3e-state-layer-hover-color: var( --m3e-tree-item-unselected-container-hover-color, ${DesignToken.color.onSurface} ); --m3e-ripple-color: var(--m3e-tree-item-unselected-ripple-color, ${DesignToken.color.onSurface}); } .state-layer { margin-inline: auto; } ::slotted(a[slot="label"]) { all: unset; } @media (prefers-reduced-motion) { .base, .toggle, .state-layer { transition: none !important; } } @media (forced-colors: active) { .base, .state-layer { transition: none !important; } :host(:disabled) .base { color: GrayText; } :host(:not(:disabled)) .base { color: CanvasText; background-color: Canvas; } :host([selected]:not(:state(-multi)):not(:disabled)) slot[name="icon"], :host([selected]:not(:state(-multi)):not(:disabled)) slot[name="label"] { color: Highlight; } }`;
314
+ background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } .base, .focus-ring { border-radius: var(--m3e-tree-item-shape, ${DesignToken.shape.corner.none}); } .label { flex: 1 1 auto; display: flex; align-items: center; position: relative; overflow: hidden; vertical-align: middle; } .checkbox { flex: none; margin-inline-end: 0.5rem; } .icon, .toggle { flex: none; align-items: center; justify-content: center; position: relative; vertical-align: middle; margin-inline-end: 0.5rem; } .toggle { display: var(--_tree-item-toggle-display, none); } :host(:not(:is(:state(--with-icon), :--with-icon))) .icon { display: none; } .inset { margin-inline-start: calc(var(--m3e-tree-item-inset, 2rem) * var(--_tree-item-level, 0)); } :host([open]) .toggle-icon { transform: rotate(90deg); } :host(:not(:is(:state(--with-items), :--with-items))) .toggle { visibility: hidden; } :host(:not(:is(:state(--with-items), :--with-items))) .group { display: none; } ::slotted([slot="selected-icon"]), ::slotted([slot="icon"]), ::slotted([slot="toggle-icon"]), ::slotted([slot="open-toggle-icon"]), .toggle-icon { vertical-align: middle; width: 1em; height: 1em; font-size: var(--m3e-tree-item-icon-size, 1.5rem); } .toggle-icon { transition: ${unsafeCSS(`transform var(--m3e-collapsible-animation-duration, ${DesignToken.motion.duration.medium1})
315
+ ${DesignToken.motion.easing.standard}`)}; } :host(:is(:state(--with-open-toggle-icon), :--with-open-toggle-icon)[open]) slot[name="toggle-icon"], :host(:is(:state(--with-open-toggle-icon), :--with-open-toggle-icon):not([open])) slot[name="open-toggle-icon"] { display: none; } :host(:not(:disabled)) .base { cursor: pointer; } :host(:not(:disabled)) .base { color: var(--m3e-tree-item-label-color, ${DesignToken.color.onSurfaceVariant}); } :host(:disabled) .base { color: color-mix( in srgb, var(--m3e-tree-item-disabled-color, ${DesignToken.color.onSurface}) var(--m3e-tree-item-disabled-color-opacity, 38%), transparent ); } :host([selected]:not(:disabled)) .base { color: var(--m3e-tree-item-selected-label-color, ${DesignToken.color.onSecondaryContainer}); background-color: var(--m3e-tree-item-selected-container-color, ${DesignToken.color.secondaryContainer}); --m3e-state-layer-focus-color: var( --m3e-tree-item-selected-container-focus-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-hover-color: var( --m3e-tree-item-selected-container-hover-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-ripple-color: var(--m3e-tree-item-selected-ripple-color, ${DesignToken.color.onSecondaryContainer}); } :host(:not([selected]):not(:disabled)) .base { --m3e-state-layer-focus-color: var( --m3e-tree-item-unselected-container-focus-color, ${DesignToken.color.onSurface} ); --m3e-state-layer-hover-color: var( --m3e-tree-item-unselected-container-hover-color, ${DesignToken.color.onSurface} ); --m3e-ripple-color: var(--m3e-tree-item-unselected-ripple-color, ${DesignToken.color.onSurface}); } .state-layer { margin-inline: auto; } ::slotted(a[slot="label"]) { all: unset; } @media (prefers-reduced-motion) { .base, .toggle, .state-layer { transition: none !important; } } @media (forced-colors: active) { .base, .state-layer { transition: none !important; } :host(:disabled) .base { color: GrayText; } :host(:not(:disabled)) .base { color: CanvasText; background-color: Canvas; } :host([selected]:not(:is(:state(--multi), :--multi)):not(:disabled)) slot[name="icon"], :host([selected]:not(:is(:state(--multi), :--multi)):not(:disabled)) slot[name="label"] { color: Highlight; } }`;
316
316
  __decorate([query(".state-layer")], M3eTreeItemElement.prototype, "stateLayer", void 0);
317
317
  __decorate([query(".focus-ring")], M3eTreeItemElement.prototype, "focusRing", void 0);
318
318
  __decorate([query(".ripple")], M3eTreeItemElement.prototype, "ripple", void 0);
@@ -401,7 +401,7 @@ var M3eTreeElement_1;
401
401
  * @attr multi - Whether multiple items can be selected.
402
402
  * @attr cascade -Whether multiple item selection cascades to child items.
403
403
  *
404
- * @fires change - Emitted when the selected state changes.
404
+ * @fires change - Dispatched when the selected state changes.
405
405
  *
406
406
  * @cssprop --m3e-tree-scrollbar-width - Width of the tree scrollbar.
407
407
  * @cssprop --m3e-tree-scrollbar-color - Color of the tree scrollbar.
@@ -715,7 +715,7 @@ _M3eTreeElement_cascadeAncestorSelected = function _M3eTreeElement_cascadeAncest
715
715
  };
716
716
  (() => {
717
717
  // NOTE: unsafeCSS used here due to linting error with use of '>'.
718
- registerStyleSheet(css`${unsafeCSS(`m3e-tree:has(> m3e-tree-item:state(-with-items)) {
718
+ registerStyleSheet(css`${unsafeCSS(`m3e-tree:has(> m3e-tree-item:is(:state(--with-items), :--with-items)) {
719
719
  --_tree-item-toggle-display: flex;
720
720
  }`)}`);
721
721
  })();