@m3e/web 2.5.3 → 2.5.4

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 (68) hide show
  1. package/dist/all.js +14 -37
  2. package/dist/all.js.map +1 -1
  3. package/dist/all.min.js +52 -52
  4. package/dist/all.min.js.map +1 -1
  5. package/dist/autocomplete.js +2 -2
  6. package/dist/autocomplete.js.map +1 -1
  7. package/dist/autocomplete.min.js +1 -1
  8. package/dist/autocomplete.min.js.map +1 -1
  9. package/dist/bottom-sheet.js +2 -2
  10. package/dist/bottom-sheet.js.map +1 -1
  11. package/dist/bottom-sheet.min.js +1 -1
  12. package/dist/bottom-sheet.min.js.map +1 -1
  13. package/dist/chips.js +2 -2
  14. package/dist/chips.js.map +1 -1
  15. package/dist/chips.min.js +1 -1
  16. package/dist/chips.min.js.map +1 -1
  17. package/dist/core.js +2 -25
  18. package/dist/core.js.map +1 -1
  19. package/dist/core.min.js +1 -1
  20. package/dist/core.min.js.map +1 -1
  21. package/dist/css-custom-data.json +145 -145
  22. package/dist/custom-elements.json +2174 -2263
  23. package/dist/dialog.js +2 -2
  24. package/dist/dialog.js.map +1 -1
  25. package/dist/dialog.min.js +1 -1
  26. package/dist/dialog.min.js.map +1 -1
  27. package/dist/expansion-panel.js +2 -2
  28. package/dist/expansion-panel.js.map +1 -1
  29. package/dist/expansion-panel.min.js +1 -1
  30. package/dist/expansion-panel.min.js.map +1 -1
  31. package/dist/html-custom-data.json +83 -83
  32. package/dist/icon.js +1 -1
  33. package/dist/icon.js.map +1 -1
  34. package/dist/icon.min.js +1 -1
  35. package/dist/icon.min.js.map +1 -1
  36. package/dist/nav-menu.js +2 -2
  37. package/dist/nav-menu.js.map +1 -1
  38. package/dist/nav-menu.min.js +1 -1
  39. package/dist/nav-menu.min.js.map +1 -1
  40. package/dist/paginator.js +2 -2
  41. package/dist/paginator.js.map +1 -1
  42. package/dist/paginator.min.js +2 -2
  43. package/dist/paginator.min.js.map +1 -1
  44. package/dist/search.js +3 -3
  45. package/dist/search.js.map +1 -1
  46. package/dist/search.min.js +1 -1
  47. package/dist/search.min.js.map +1 -1
  48. package/dist/src/autocomplete/AutocompleteElement.d.ts.map +1 -1
  49. package/dist/src/bottom-sheet/BottomSheetElement.d.ts.map +1 -1
  50. package/dist/src/chips/InputChipElement.d.ts.map +1 -1
  51. package/dist/src/core/shared/mixins/index.d.ts +0 -1
  52. package/dist/src/core/shared/mixins/index.d.ts.map +1 -1
  53. package/dist/src/core/shared/primitives/CollapsibleElement.d.ts.map +1 -1
  54. package/dist/src/dialog/DialogElement.d.ts.map +1 -1
  55. package/dist/src/expansion-panel/ExpansionPanelElement.d.ts.map +1 -1
  56. package/dist/src/icon/IconElement.d.ts.map +1 -1
  57. package/dist/src/nav-menu/NavMenuItemElement.d.ts.map +1 -1
  58. package/dist/src/paginator/PaginatorElement.d.ts.map +1 -1
  59. package/dist/src/search/SearchBarElement.d.ts.map +1 -1
  60. package/dist/src/search/SearchViewElement.d.ts.map +1 -1
  61. package/dist/src/tree/TreeItemElement.d.ts.map +1 -1
  62. package/dist/tree.js +2 -2
  63. package/dist/tree.js.map +1 -1
  64. package/dist/tree.min.js +1 -1
  65. package/dist/tree.min.js.map +1 -1
  66. package/package.json +1 -1
  67. package/dist/src/core/shared/mixins/EventAttribute.d.ts +0 -11
  68. package/dist/src/core/shared/mixins/EventAttribute.d.ts.map +0 -1
package/dist/dialog.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { __decorate, __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
7
7
  import { property, state, query } from 'lit/decorators.js';
8
- import { customElement, ActionElementBase, EventAttribute, AttachInternals, ScrollLockController, focusWhenReady, setCustomState, DesignToken, HtmlFor } from '@m3e/web/core';
8
+ import { customElement, ActionElementBase, AttachInternals, ScrollLockController, focusWhenReady, setCustomState, DesignToken, HtmlFor } from '@m3e/web/core';
9
9
  import { LitElement, html, nothing, unsafeCSS, css } from 'lit';
10
10
  import { ifDefined } from 'lit/directives/if-defined.js';
11
11
  import '@m3e/web/core/a11y';
@@ -101,7 +101,7 @@ var M3eDialogElement_1;
101
101
  * @cssprop --m3e-dialog-content-line-height - Line height for the dialog content.
102
102
  * @cssprop --m3e-dialog-content-tracking - Letter spacing for the dialog content.
103
103
  */
104
- let M3eDialogElement = M3eDialogElement_1 = class M3eDialogElement extends EventAttribute(AttachInternals(LitElement), "opening", "opened", "cancel", "closing", "closed") {
104
+ let M3eDialogElement = M3eDialogElement_1 = class M3eDialogElement extends AttachInternals(LitElement) {
105
105
  constructor() {
106
106
  super(...arguments);
107
107
  _M3eDialogElement_instances.add(this);
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sources":["../../src/dialog/DialogActionElement.ts","../../src/dialog/DialogElement.ts","../../src/dialog/DialogTriggerElement.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 close a parenting dialog.\r\n * @tag m3e-dialog-action\r\n *\r\n * @slot - Renders the content of the action.\r\n *\r\n * @attr return-value - The value to return from the dialog.\r\n */\r\n@customElement(\"m3e-dialog-action\")\r\nexport class M3eDialogActionElement extends ActionElementBase {\r\n /**\r\n * The value to return from the dialog.\r\n * @default \"\"\r\n */\r\n @property({ attribute: \"return-value\" }) returnValue = \"\";\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n this.closest(\"m3e-dialog\")?.hide(this.returnValue);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-dialog-action\": M3eDialogActionElement;\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, nothing, unsafeCSS } from \"lit\";\r\nimport { property, query, state } from \"lit/decorators.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n DesignToken,\r\n EventAttribute,\r\n focusWhenReady,\r\n ScrollLockController,\r\n setCustomState,\r\n} from \"@m3e/web/core\";\r\n\r\nimport \"@m3e/web/core/a11y\";\r\nimport \"@m3e/web/icon-button\";\r\n\r\n/**\r\n * A dialog that provides important prompts in a user flow.\r\n *\r\n * @description\r\n * The `m3e-dialog` component presents important prompts, alerts, and actions in user flows.\r\n * Designed according to Material 3 principles, it supports custom header, content, and\r\n * close icon slots, ARIA accessibility, focus management, and theming via CSS custom properties.\r\n *\r\n * @example\r\n * ```html\r\n * <m3e-button variant=\"filled\">\r\n * <m3e-dialog-trigger for=\"dlg\">Open Dialog</m3e-dialog-trigger>\r\n * </m3e-button>\r\n * <m3e-dialog id=\"dlg\" dismissible onclosed=\"console.log(this.returnValue)\">\r\n * <span slot=\"header\">Dialog Title</span>\r\n * Dialog content goes here.\r\n * <div slot=\"actions\" end>\r\n * <m3e-button autofocus><m3e-dialog-action return-value=\"ok\">Close</m3e-dialog-action></m3e-button>\r\n * </div>\r\n * </m3e-dialog>\r\n * ```\r\n *\r\n * @tag m3e-dialog\r\n *\r\n * @slot - Renders the content of the dialog.\r\n * @slot header - Renders the header of the dialog.\r\n * @slot actions - Renders the actions of the dialog.\r\n * @slot close-icon - Renders the icon of the button used to close the dialog.\r\n *\r\n * @attr alert - Whether the dialog is an alert.\r\n * @attr close-label - The accessible label given to the button used to dismiss the dialog.\r\n * @attr disable-close -Whether users cannot click the backdrop or press escape to dismiss the dialog.\r\n * @attr dismissible - Whether a button is presented that can be used to close the dialog.\r\n * @attr no-focus-trap - Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.\r\n * @attr open - Whether the dialog is open.\r\n *\r\n * @fires opening - Emitted when the dialog begins to open.\r\n * @fires opened - Emitted when the dialog has opened.\r\n * @fires cancel - Emitted when the dialog is cancelled.\r\n * @fires closing - Emitted when the dialog begins to close.\r\n * @fires closed - Emitted when the dialog has closed.\r\n *\r\n * @cssprop --m3e-dialog-shape - Border radius of the dialog container.\r\n * @cssprop --m3e-dialog-min-width - Minimum width of the dialog.\r\n * @cssprop --m3e-dialog-max-width - Maximum width of the dialog.\r\n * @cssprop --m3e-dialog-color - Foreground color of the dialog.\r\n * @cssprop --m3e-dialog-container-color - Background color of the dialog container.\r\n * @cssprop --m3e-dialog-scrim-color - Color of the scrim (backdrop overlay).\r\n * @cssprop --m3e-dialog-scrim-opacity - Opacity of the scrim when open.\r\n * @cssprop --m3e-dialog-header-container-color - Background color of the dialog header.\r\n * @cssprop --m3e-dialog-header-color - Foreground color of the dialog header.\r\n * @cssprop --m3e-dialog-header-font-size - Font size for the dialog header.\r\n * @cssprop --m3e-dialog-header-font-weight - Font weight for the dialog header.\r\n * @cssprop --m3e-dialog-header-line-height - Line height for the dialog header.\r\n * @cssprop --m3e-dialog-header-tracking - Letter spacing for the dialog header.\r\n * @cssprop --m3e-dialog-content-color - Foreground color of the dialog content.\r\n * @cssprop --m3e-dialog-content-font-size - Font size for the dialog content.\r\n * @cssprop --m3e-dialog-content-font-weight - Font weight for the dialog content.\r\n * @cssprop --m3e-dialog-content-line-height - Line height for the dialog content.\r\n * @cssprop --m3e-dialog-content-tracking - Letter spacing for the dialog content.\r\n */\r\n@customElement(\"m3e-dialog\")\r\nexport class M3eDialogElement extends EventAttribute(\r\n AttachInternals(LitElement),\r\n \"opening\",\r\n \"opened\",\r\n \"cancel\",\r\n \"closing\",\r\n \"closed\",\r\n) {\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 font: inherit;\r\n border: unset;\r\n outline: unset;\r\n padding: unset;\r\n display: flex;\r\n flex-direction: column;\r\n position: fixed;\r\n overflow: visible;\r\n border-radius: var(--m3e-dialog-shape, ${DesignToken.shape.corner.extraLarge});\r\n min-width: var(--m3e-dialog-min-width, 17.5rem);\r\n max-width: var(--m3e-dialog-max-width, 35rem);\r\n color: var(--m3e-dialog-color, ${DesignToken.color.onSurface});\r\n background-color: var(--m3e-dialog-container-color, ${DesignToken.color.surfaceContainerHigh});\r\n visibility: hidden;\r\n opacity: 0;\r\n transform-origin: top;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n }\r\n .base::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n margin-inline-end: -20px;\r\n }\r\n .base:not([open]) {\r\n visibility: hidden;\r\n opacity: 0;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized}, \r\n transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized},\r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized} allow-discrete`,\r\n )};\r\n }\r\n .base[open] {\r\n visibility: visible;\r\n opacity: 1;\r\n transform: translateY(0) scaleY(1);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized}, \r\n transform ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized},\r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized} allow-discrete`,\r\n )};\r\n }\r\n .base:not([open])::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .base[open]::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%),\r\n transparent\r\n );\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n @starting-style {\r\n .base[open] {\r\n opacity: 0;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n }\r\n .base[open]::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n }\r\n }\r\n .header {\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n padding: 1.5rem 1.5rem 1rem 1.5rem;\r\n background-color: var(--m3e-dialog-header-container-color, transparent);\r\n }\r\n ::slotted([slot=\"header\"]) {\r\n margin: unset;\r\n flex: 1 1 auto;\r\n color: var(--m3e-dialog-header-color, inherit);\r\n font-size: var(--m3e-dialog-header-font-size, ${DesignToken.typescale.standard.headline.small.fontSize});\r\n font-weight: var(--m3e-dialog-header-font-weight, ${DesignToken.typescale.standard.headline.small.fontWeight});\r\n line-height: var(--m3e-dialog-header-line-height, ${DesignToken.typescale.standard.headline.small.lineHeight});\r\n letter-spacing: var(--m3e-dialog-header-tracking, ${DesignToken.typescale.standard.headline.small.tracking});\r\n }\r\n .content {\r\n padding-inline: 1.5rem;\r\n color: var(--m3e-dialog-content-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(--m3e-dialog-content-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-dialog-content-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-dialog-content-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-dialog-content-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n .actions {\r\n padding: 1.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 :host(:not(:state(-with-actions))) .content {\r\n margin-bottom: 1.5rem;\r\n }\r\n :host(:not(:state(-with-actions))) .actions {\r\n display: none;\r\n }\r\n .close {\r\n margin-inline-start: 0.5rem;\r\n }\r\n ::slotted([slot=\"close-icon\"]),\r\n .close-icon {\r\n width: 1em;\r\n font-size: var(--m3e-icon-button-icon-size, 1.5rem) !important;\r\n }\r\n @media (forced-colors: active) {\r\n .base:not([open])::backdrop,\r\n .base[open]::backdrop {\r\n transition: none;\r\n }\r\n .base {\r\n border-style: solid;\r\n border-width: 1px;\r\n border-color: CanvasText;\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n .base:not([open]),\r\n .base[open],\r\n .base:not([open])::backdrop,\r\n .base[open]::backdrop {\r\n transition: none;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __nextId = 0;\r\n /** @private */ #id = M3eDialogElement.__nextId++;\r\n\r\n /** @private */ #open = false;\r\n /** @private */ #escapePressedWithoutCancel = false;\r\n /** @private */ @state() private _withActions = false;\r\n /** @private */ @query(\".base\") private readonly _base!: HTMLDialogElement;\r\n /** @private */ @query(\".content\") private readonly _content!: HTMLDialogElement;\r\n\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n\r\n /**\r\n * Whether the dialog is an alert.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) alert = false;\r\n\r\n /**\r\n * Whether the dialog is open.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) get open() {\r\n return this.#open;\r\n }\r\n set open(value: boolean) {\r\n if (value === this.#open) return;\r\n this.#open = value;\r\n if (this.#open) {\r\n this.show();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /**\r\n * Whether a button is presented that can be used to close the dialog.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) dismissible = false;\r\n\r\n /**\r\n * Whether users cannot click the backdrop or press ESC to dismiss the dialog.\r\n * @default false\r\n */\r\n @property({ attribute: \"disable-close\", type: Boolean }) disableClose = false;\r\n\r\n /**\r\n * Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.\r\n * @default false\r\n */\r\n @property({ attribute: \"no-focus-trap\", type: Boolean }) noFocusTrap = false;\r\n\r\n /**\r\n * The accessible label given to the button used to dismiss the dialog.\r\n * @default \"Close\"\r\n */\r\n @property({ attribute: \"close-label\" }) closeLabel = \"Close\";\r\n\r\n /**\r\n * The return value of the dialog.\r\n * @default \"\"\r\n */\r\n returnValue = \"\";\r\n\r\n /**\r\n * Asynchronously opens the dialog.\r\n * @returns {Promise<void>} A `Promise` that resolves when the dialog is open.\r\n */\r\n async show(): Promise<void> {\r\n await this.updateComplete;\r\n\r\n if (this._base.open) {\r\n return;\r\n }\r\n\r\n if (!this.dispatchEvent(new Event(\"opening\", { cancelable: true }))) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n this.#scrollLockController.lock();\r\n this._base.showModal();\r\n this._content.scrollTop = 0;\r\n const focusable = this.querySelector<HTMLElement>(\"[autofocus]\");\r\n\r\n if (focusable) {\r\n focusWhenReady(focusable);\r\n }\r\n\r\n this.dispatchEvent(new Event(\"opened\"));\r\n }\r\n\r\n /**\r\n * Asynchronously closes the dialog.\r\n * @param {string} returnValue The value to return.\r\n * @returns {Promise<void>} A `Promise` that resolves when the dialog is closed.\r\n */\r\n async hide(returnValue: string = this.returnValue): Promise<void> {\r\n if (!this.isConnected) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n await this.updateComplete;\r\n\r\n this.#scrollLockController.unlock();\r\n\r\n if (!this._base.open) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n const prevReturnValue = this.returnValue;\r\n this.returnValue = returnValue;\r\n\r\n if (!this.dispatchEvent(new Event(\"closing\", { cancelable: true }))) {\r\n this.returnValue = prevReturnValue;\r\n return;\r\n }\r\n\r\n this.open = false;\r\n this._base.close(returnValue);\r\n this.dispatchEvent(new Event(\"closed\"));\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<dialog\r\n class=\"base\"\r\n role=\"${ifDefined(this.alert ? \"alertdialog\" : undefined)}\"\r\n aria-labelledby=\"m3e-dialog-${this.#id}-header\"\r\n .returnValue=\"${this.returnValue}\"\r\n @close=\"${this.#handleClose}\"\r\n @cancel=\"${this.#handleCancel}\"\r\n @click=\"${this.#handleClick}\"\r\n @keydown=\"${this.#handleKeyDown}\"\r\n >\r\n <m3e-elevation level=\"3\"></m3e-elevation>\r\n <m3e-focus-trap ?disabled=\"${this.noFocusTrap}\">\r\n <div class=\"header\">\r\n <slot name=\"header\" id=\"m3e-dialog-${this.#id}-header\"></slot>\r\n ${this.#renderCloseButton()}\r\n </div>\r\n <m3e-scroll-container class=\"content\" dividers=\"${this._withActions ? \"above-below\" : \"above\"}\">\r\n <slot></slot>\r\n </m3e-scroll-container>\r\n <div class=\"actions\">\r\n <slot name=\"actions\" @slotchange=\"${this.#handleActionsSlotChange}\"></slot>\r\n </div>\r\n </m3e-focus-trap>\r\n </dialog>`;\r\n }\r\n\r\n /** @private */\r\n #renderCloseButton(): unknown {\r\n return !this.dismissible\r\n ? nothing\r\n : html`<m3e-icon-button aria-label=\"${this.closeLabel}\" class=\"close\" @click=\"${this.hide}\">\r\n <slot name=\"close-icon\">\r\n <svg class=\"close-icon\" viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path\r\n d=\"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z\"\r\n />\r\n </svg>\r\n </slot>\r\n </m3e-icon-button>`;\r\n }\r\n\r\n /** @private */\r\n #handleClose(): void {\r\n if (!this.#escapePressedWithoutCancel) {\r\n return;\r\n }\r\n this.#escapePressedWithoutCancel = true;\r\n this._base?.dispatchEvent(new Event(\"cancel\", { cancelable: true }));\r\n }\r\n\r\n /** @private */\r\n #handleCancel(e: Event): void {\r\n if (e.target !== this._base) return;\r\n this.#escapePressedWithoutCancel = false;\r\n e.preventDefault();\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleClick(e: Event): void {\r\n if (!this.disableClose && e.target === this._base) {\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 if (!this.disableClose) {\r\n this.hide();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleActionsSlotChange(e: Event): void {\r\n this._withActions = (<HTMLSlotElement>e.target).assignedNodes({ flatten: true }).length > 0;\r\n setCustomState(this, \"-with-actions\", this._withActions);\r\n }\r\n}\r\n\r\ninterface M3eDialogElementEventMap extends HTMLElementEventMap {\r\n opening: Event;\r\n opened: Event;\r\n closing: Event;\r\n closed: Event;\r\n cancel: Event;\r\n}\r\n\r\nexport interface M3eDialogElement {\r\n addEventListener<K extends keyof M3eDialogElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[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 M3eDialogElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[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-dialog\": M3eDialogElement;\r\n }\r\n}\r\n","import { ActionElementBase, customElement, HtmlFor } from \"@m3e/web/core\";\r\n\r\nimport { M3eDialogElement } from \"./DialogElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to open a dialog.\r\n * @tag m3e-dialog-trigger\r\n */\r\n@customElement(\"m3e-dialog-trigger\")\r\nexport class M3eDialogTriggerElement extends HtmlFor(ActionElementBase) {\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override _onClick(): void {\r\n if (this.control instanceof M3eDialogElement) {\r\n this.control.show();\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-dialog-trigger\": M3eDialogTriggerElement;\r\n }\r\n}\r\n"],"names":["M3eDialogActionElement","ActionElementBase","constructor","returnValue","_onClick","closest","hide","__decorate","property","attribute","prototype","customElement","M3eDialogElement","EventAttribute","AttachInternals","LitElement","_M3eDialogElement_id","set","M3eDialogElement_1","__nextId","_M3eDialogElement_open","_M3eDialogElement_escapePressedWithoutCancel","_withActions","_M3eDialogElement_scrollLockController","ScrollLockController","alert","dismissible","disableClose","noFocusTrap","closeLabel","open","__classPrivateFieldGet","value","__classPrivateFieldSet","show","updateComplete","_base","dispatchEvent","Event","cancelable","lock","showModal","_content","scrollTop","focusable","querySelector","focusWhenReady","isConnected","unlock","prevReturnValue","close","render","html","ifDefined","undefined","_M3eDialogElement_instances","_M3eDialogElement_handleClose","_M3eDialogElement_handleCancel","_M3eDialogElement_handleClick","_M3eDialogElement_handleKeyDown","_M3eDialogElement_renderCloseButton","call","_M3eDialogElement_handleActionsSlotChange","nothing","e","target","preventDefault","key","shiftKey","ctrlKey","assignedNodes","flatten","length","setCustomState","styles","css","DesignToken","shape","corner","extraLarge","color","onSurface","surfaceContainerHigh","scrim","unsafeCSS","motion","duration","short3","easing","emphasized","long2","standard","typescale","headline","small","fontSize","fontWeight","lineHeight","tracking","onSurfaceVariant","body","medium","state","query","type","Boolean","reflect","M3eDialogTriggerElement","HtmlFor","connectedCallback","parentElement","ariaHasPopup","disconnectedCallback","control"],"mappings":";;;;;;;;;;;;;AAIA;;;;;;;AAOG;AAEI,IAAMA,sBAAsB,GAA5B,MAAMA,sBAAuB,SAAQC,iBAAiB,CAAA;AAAtDC,EAAAA,WAAAA,GAAA;;AACL;;;AAGG;IACsC,IAAA,CAAAC,WAAW,GAAG,EAAE;AAM3D,EAAA;AAJE;AACmBC,EAAAA,QAAQA,GAAA;IACzB,IAAI,CAACC,OAAO,CAAC,YAAY,CAAC,EAAEC,IAAI,CAAC,IAAI,CAACH,WAAW,CAAC;AACpD,EAAA;;AALyCI,UAAA,CAAA,CAAxCC,QAAQ,CAAC;AAAEC,EAAAA,SAAS,EAAE;CAAgB,CAAC,CAAkB,EAAAT,sBAAA,CAAAU,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAL/CV,sBAAsB,GAAAO,UAAA,CAAA,CADlCI,aAAa,CAAC,mBAAmB,CAAC,CACtB,EAAAX,sBAAsB,CAWlC;;;;ACND;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DG;AAEI,IAAMY,gBAAgB,wBAAtB,MAAMA,gBAAiB,SAAQC,cAAc,CAClDC,eAAe,CAACC,UAAU,CAAC,EAC3B,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,CACT,CAAA;AAPMb,EAAAA,WAAAA,GAAA;;;AA+JL;IAAgBc,oBAAA,CAAAC,GAAA,CAAA,IAAA,EAAMC,kBAAgB,CAACC,QAAQ,EAAE,CAAA;AAEjD;AAAgBC,IAAAA,sBAAA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A,EAAA,YAAA,EAAA,MAAA,CAAA;AAtNlDE,gBAAgB,GAAAM,kBAAA,GAAAX,UAAA,CAAA,CAD5BI,aAAa,CAAC,YAAY,CAAC,CACf,EAAAC,gBAAgB,CA+W5B;;AC3bD;;;AAGG;AAEI,IAAM+F,uBAAuB,GAA7B,MAAMA,uBAAwB,SAAQC,OAAO,CAAC3G,iBAAiB,CAAC,CAAA;AACrE;AACS4G,EAAAA,iBAAiBA,GAAA;IACxB,KAAK,CAACA,iBAAiB,EAAE;IAEzB,IAAI,IAAI,CAACC,aAAa,EAAE;AACtB,MAAA,IAAI,CAACA,aAAa,CAACC,YAAY,GAAG,QAAQ;AAC5C,IAAA;AACF,EAAA;AAEA;AACSC,EAAAA,oBAAoBA,GAAA;IAC3B,KAAK,CAACA,oBAAoB,EAAE;IAE5B,IAAI,IAAI,CAACF,aAAa,EAAE;AACtB,MAAA,IAAI,CAACA,aAAa,CAACC,YAAY,GAAG,IAAI;AACxC,IAAA;AACF,EAAA;AAEA;AACS3G,EAAAA,QAAQA,GAAA;AACf,IAAA,IAAI,IAAI,CAAC6G,OAAO,YAAYrG,gBAAgB,EAAE;AAC5C,MAAA,IAAI,CAACqG,OAAO,CAAC/E,IAAI,EAAE;AACrB,IAAA;AACF,EAAA;;AAxBWyE,uBAAuB,GAAApG,UAAA,CAAA,CADnCI,aAAa,CAAC,oBAAoB,CAAC,CACvB,EAAAgG,uBAAuB,CAyBnC;;;;"}
1
+ {"version":3,"file":"dialog.js","sources":["../../src/dialog/DialogActionElement.ts","../../src/dialog/DialogElement.ts","../../src/dialog/DialogTriggerElement.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 close a parenting dialog.\r\n * @tag m3e-dialog-action\r\n *\r\n * @slot - Renders the content of the action.\r\n *\r\n * @attr return-value - The value to return from the dialog.\r\n */\r\n@customElement(\"m3e-dialog-action\")\r\nexport class M3eDialogActionElement extends ActionElementBase {\r\n /**\r\n * The value to return from the dialog.\r\n * @default \"\"\r\n */\r\n @property({ attribute: \"return-value\" }) returnValue = \"\";\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n this.closest(\"m3e-dialog\")?.hide(this.returnValue);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-dialog-action\": M3eDialogActionElement;\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, nothing, unsafeCSS } from \"lit\";\r\nimport { property, query, state } from \"lit/decorators.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n DesignToken,\r\n focusWhenReady,\r\n ScrollLockController,\r\n setCustomState,\r\n} from \"@m3e/web/core\";\r\n\r\nimport \"@m3e/web/core/a11y\";\r\nimport \"@m3e/web/icon-button\";\r\n\r\n/**\r\n * A dialog that provides important prompts in a user flow.\r\n *\r\n * @description\r\n * The `m3e-dialog` component presents important prompts, alerts, and actions in user flows.\r\n * Designed according to Material 3 principles, it supports custom header, content, and\r\n * close icon slots, ARIA accessibility, focus management, and theming via CSS custom properties.\r\n *\r\n * @example\r\n * ```html\r\n * <m3e-button variant=\"filled\">\r\n * <m3e-dialog-trigger for=\"dlg\">Open Dialog</m3e-dialog-trigger>\r\n * </m3e-button>\r\n * <m3e-dialog id=\"dlg\" dismissible onclosed=\"console.log(this.returnValue)\">\r\n * <span slot=\"header\">Dialog Title</span>\r\n * Dialog content goes here.\r\n * <div slot=\"actions\" end>\r\n * <m3e-button autofocus><m3e-dialog-action return-value=\"ok\">Close</m3e-dialog-action></m3e-button>\r\n * </div>\r\n * </m3e-dialog>\r\n * ```\r\n *\r\n * @tag m3e-dialog\r\n *\r\n * @slot - Renders the content of the dialog.\r\n * @slot header - Renders the header of the dialog.\r\n * @slot actions - Renders the actions of the dialog.\r\n * @slot close-icon - Renders the icon of the button used to close the dialog.\r\n *\r\n * @attr alert - Whether the dialog is an alert.\r\n * @attr close-label - The accessible label given to the button used to dismiss the dialog.\r\n * @attr disable-close -Whether users cannot click the backdrop or press escape to dismiss the dialog.\r\n * @attr dismissible - Whether a button is presented that can be used to close the dialog.\r\n * @attr no-focus-trap - Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.\r\n * @attr open - Whether the dialog is open.\r\n *\r\n * @fires opening - Emitted when the dialog begins to open.\r\n * @fires opened - Emitted when the dialog has opened.\r\n * @fires cancel - Emitted when the dialog is cancelled.\r\n * @fires closing - Emitted when the dialog begins to close.\r\n * @fires closed - Emitted when the dialog has closed.\r\n *\r\n * @cssprop --m3e-dialog-shape - Border radius of the dialog container.\r\n * @cssprop --m3e-dialog-min-width - Minimum width of the dialog.\r\n * @cssprop --m3e-dialog-max-width - Maximum width of the dialog.\r\n * @cssprop --m3e-dialog-color - Foreground color of the dialog.\r\n * @cssprop --m3e-dialog-container-color - Background color of the dialog container.\r\n * @cssprop --m3e-dialog-scrim-color - Color of the scrim (backdrop overlay).\r\n * @cssprop --m3e-dialog-scrim-opacity - Opacity of the scrim when open.\r\n * @cssprop --m3e-dialog-header-container-color - Background color of the dialog header.\r\n * @cssprop --m3e-dialog-header-color - Foreground color of the dialog header.\r\n * @cssprop --m3e-dialog-header-font-size - Font size for the dialog header.\r\n * @cssprop --m3e-dialog-header-font-weight - Font weight for the dialog header.\r\n * @cssprop --m3e-dialog-header-line-height - Line height for the dialog header.\r\n * @cssprop --m3e-dialog-header-tracking - Letter spacing for the dialog header.\r\n * @cssprop --m3e-dialog-content-color - Foreground color of the dialog content.\r\n * @cssprop --m3e-dialog-content-font-size - Font size for the dialog content.\r\n * @cssprop --m3e-dialog-content-font-weight - Font weight for the dialog content.\r\n * @cssprop --m3e-dialog-content-line-height - Line height for the dialog content.\r\n * @cssprop --m3e-dialog-content-tracking - Letter spacing for the dialog content.\r\n */\r\n@customElement(\"m3e-dialog\")\r\nexport class M3eDialogElement extends AttachInternals(LitElement) {\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 font: inherit;\r\n border: unset;\r\n outline: unset;\r\n padding: unset;\r\n display: flex;\r\n flex-direction: column;\r\n position: fixed;\r\n overflow: visible;\r\n border-radius: var(--m3e-dialog-shape, ${DesignToken.shape.corner.extraLarge});\r\n min-width: var(--m3e-dialog-min-width, 17.5rem);\r\n max-width: var(--m3e-dialog-max-width, 35rem);\r\n color: var(--m3e-dialog-color, ${DesignToken.color.onSurface});\r\n background-color: var(--m3e-dialog-container-color, ${DesignToken.color.surfaceContainerHigh});\r\n visibility: hidden;\r\n opacity: 0;\r\n transform-origin: top;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n }\r\n .base::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n margin-inline-end: -20px;\r\n }\r\n .base:not([open]) {\r\n visibility: hidden;\r\n opacity: 0;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized}, \r\n transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized},\r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized} allow-discrete`,\r\n )};\r\n }\r\n .base[open] {\r\n visibility: visible;\r\n opacity: 1;\r\n transform: translateY(0) scaleY(1);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized}, \r\n transform ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized},\r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized} allow-discrete`,\r\n )};\r\n }\r\n .base:not([open])::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .base[open]::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%),\r\n transparent\r\n );\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n @starting-style {\r\n .base[open] {\r\n opacity: 0;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n }\r\n .base[open]::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n }\r\n }\r\n .header {\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n padding: 1.5rem 1.5rem 1rem 1.5rem;\r\n background-color: var(--m3e-dialog-header-container-color, transparent);\r\n }\r\n ::slotted([slot=\"header\"]) {\r\n margin: unset;\r\n flex: 1 1 auto;\r\n color: var(--m3e-dialog-header-color, inherit);\r\n font-size: var(--m3e-dialog-header-font-size, ${DesignToken.typescale.standard.headline.small.fontSize});\r\n font-weight: var(--m3e-dialog-header-font-weight, ${DesignToken.typescale.standard.headline.small.fontWeight});\r\n line-height: var(--m3e-dialog-header-line-height, ${DesignToken.typescale.standard.headline.small.lineHeight});\r\n letter-spacing: var(--m3e-dialog-header-tracking, ${DesignToken.typescale.standard.headline.small.tracking});\r\n }\r\n .content {\r\n padding-inline: 1.5rem;\r\n color: var(--m3e-dialog-content-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(--m3e-dialog-content-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-dialog-content-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-dialog-content-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-dialog-content-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n .actions {\r\n padding: 1.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 :host(:not(:state(-with-actions))) .content {\r\n margin-bottom: 1.5rem;\r\n }\r\n :host(:not(:state(-with-actions))) .actions {\r\n display: none;\r\n }\r\n .close {\r\n margin-inline-start: 0.5rem;\r\n }\r\n ::slotted([slot=\"close-icon\"]),\r\n .close-icon {\r\n width: 1em;\r\n font-size: var(--m3e-icon-button-icon-size, 1.5rem) !important;\r\n }\r\n @media (forced-colors: active) {\r\n .base:not([open])::backdrop,\r\n .base[open]::backdrop {\r\n transition: none;\r\n }\r\n .base {\r\n border-style: solid;\r\n border-width: 1px;\r\n border-color: CanvasText;\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n .base:not([open]),\r\n .base[open],\r\n .base:not([open])::backdrop,\r\n .base[open]::backdrop {\r\n transition: none;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __nextId = 0;\r\n /** @private */ #id = M3eDialogElement.__nextId++;\r\n\r\n /** @private */ #open = false;\r\n /** @private */ #escapePressedWithoutCancel = false;\r\n /** @private */ @state() private _withActions = false;\r\n /** @private */ @query(\".base\") private readonly _base!: HTMLDialogElement;\r\n /** @private */ @query(\".content\") private readonly _content!: HTMLDialogElement;\r\n\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n\r\n /**\r\n * Whether the dialog is an alert.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) alert = false;\r\n\r\n /**\r\n * Whether the dialog is open.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) get open() {\r\n return this.#open;\r\n }\r\n set open(value: boolean) {\r\n if (value === this.#open) return;\r\n this.#open = value;\r\n if (this.#open) {\r\n this.show();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /**\r\n * Whether a button is presented that can be used to close the dialog.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) dismissible = false;\r\n\r\n /**\r\n * Whether users cannot click the backdrop or press ESC to dismiss the dialog.\r\n * @default false\r\n */\r\n @property({ attribute: \"disable-close\", type: Boolean }) disableClose = false;\r\n\r\n /**\r\n * Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.\r\n * @default false\r\n */\r\n @property({ attribute: \"no-focus-trap\", type: Boolean }) noFocusTrap = false;\r\n\r\n /**\r\n * The accessible label given to the button used to dismiss the dialog.\r\n * @default \"Close\"\r\n */\r\n @property({ attribute: \"close-label\" }) closeLabel = \"Close\";\r\n\r\n /**\r\n * The return value of the dialog.\r\n * @default \"\"\r\n */\r\n returnValue = \"\";\r\n\r\n /**\r\n * Asynchronously opens the dialog.\r\n * @returns {Promise<void>} A `Promise` that resolves when the dialog is open.\r\n */\r\n async show(): Promise<void> {\r\n await this.updateComplete;\r\n\r\n if (this._base.open) {\r\n return;\r\n }\r\n\r\n if (!this.dispatchEvent(new Event(\"opening\", { cancelable: true }))) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n this.#scrollLockController.lock();\r\n this._base.showModal();\r\n this._content.scrollTop = 0;\r\n const focusable = this.querySelector<HTMLElement>(\"[autofocus]\");\r\n\r\n if (focusable) {\r\n focusWhenReady(focusable);\r\n }\r\n\r\n this.dispatchEvent(new Event(\"opened\"));\r\n }\r\n\r\n /**\r\n * Asynchronously closes the dialog.\r\n * @param {string} returnValue The value to return.\r\n * @returns {Promise<void>} A `Promise` that resolves when the dialog is closed.\r\n */\r\n async hide(returnValue: string = this.returnValue): Promise<void> {\r\n if (!this.isConnected) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n await this.updateComplete;\r\n\r\n this.#scrollLockController.unlock();\r\n\r\n if (!this._base.open) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n const prevReturnValue = this.returnValue;\r\n this.returnValue = returnValue;\r\n\r\n if (!this.dispatchEvent(new Event(\"closing\", { cancelable: true }))) {\r\n this.returnValue = prevReturnValue;\r\n return;\r\n }\r\n\r\n this.open = false;\r\n this._base.close(returnValue);\r\n this.dispatchEvent(new Event(\"closed\"));\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<dialog\r\n class=\"base\"\r\n role=\"${ifDefined(this.alert ? \"alertdialog\" : undefined)}\"\r\n aria-labelledby=\"m3e-dialog-${this.#id}-header\"\r\n .returnValue=\"${this.returnValue}\"\r\n @close=\"${this.#handleClose}\"\r\n @cancel=\"${this.#handleCancel}\"\r\n @click=\"${this.#handleClick}\"\r\n @keydown=\"${this.#handleKeyDown}\"\r\n >\r\n <m3e-elevation level=\"3\"></m3e-elevation>\r\n <m3e-focus-trap ?disabled=\"${this.noFocusTrap}\">\r\n <div class=\"header\">\r\n <slot name=\"header\" id=\"m3e-dialog-${this.#id}-header\"></slot>\r\n ${this.#renderCloseButton()}\r\n </div>\r\n <m3e-scroll-container class=\"content\" dividers=\"${this._withActions ? \"above-below\" : \"above\"}\">\r\n <slot></slot>\r\n </m3e-scroll-container>\r\n <div class=\"actions\">\r\n <slot name=\"actions\" @slotchange=\"${this.#handleActionsSlotChange}\"></slot>\r\n </div>\r\n </m3e-focus-trap>\r\n </dialog>`;\r\n }\r\n\r\n /** @private */\r\n #renderCloseButton(): unknown {\r\n return !this.dismissible\r\n ? nothing\r\n : html`<m3e-icon-button aria-label=\"${this.closeLabel}\" class=\"close\" @click=\"${this.hide}\">\r\n <slot name=\"close-icon\">\r\n <svg class=\"close-icon\" viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path\r\n d=\"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z\"\r\n />\r\n </svg>\r\n </slot>\r\n </m3e-icon-button>`;\r\n }\r\n\r\n /** @private */\r\n #handleClose(): void {\r\n if (!this.#escapePressedWithoutCancel) {\r\n return;\r\n }\r\n this.#escapePressedWithoutCancel = true;\r\n this._base?.dispatchEvent(new Event(\"cancel\", { cancelable: true }));\r\n }\r\n\r\n /** @private */\r\n #handleCancel(e: Event): void {\r\n if (e.target !== this._base) return;\r\n this.#escapePressedWithoutCancel = false;\r\n e.preventDefault();\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleClick(e: Event): void {\r\n if (!this.disableClose && e.target === this._base) {\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 if (!this.disableClose) {\r\n this.hide();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleActionsSlotChange(e: Event): void {\r\n this._withActions = (<HTMLSlotElement>e.target).assignedNodes({ flatten: true }).length > 0;\r\n setCustomState(this, \"-with-actions\", this._withActions);\r\n }\r\n}\r\n\r\ninterface M3eDialogElementEventMap extends HTMLElementEventMap {\r\n opening: Event;\r\n opened: Event;\r\n closing: Event;\r\n closed: Event;\r\n cancel: Event;\r\n}\r\n\r\nexport interface M3eDialogElement {\r\n addEventListener<K extends keyof M3eDialogElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[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 M3eDialogElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[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-dialog\": M3eDialogElement;\r\n }\r\n}\r\n","import { ActionElementBase, customElement, HtmlFor } from \"@m3e/web/core\";\r\n\r\nimport { M3eDialogElement } from \"./DialogElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to open a dialog.\r\n * @tag m3e-dialog-trigger\r\n */\r\n@customElement(\"m3e-dialog-trigger\")\r\nexport class M3eDialogTriggerElement extends HtmlFor(ActionElementBase) {\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override _onClick(): void {\r\n if (this.control instanceof M3eDialogElement) {\r\n this.control.show();\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-dialog-trigger\": M3eDialogTriggerElement;\r\n }\r\n}\r\n"],"names":["M3eDialogActionElement","ActionElementBase","constructor","returnValue","_onClick","closest","hide","__decorate","property","attribute","prototype","customElement","M3eDialogElement","AttachInternals","LitElement","_M3eDialogElement_id","set","M3eDialogElement_1","__nextId","_M3eDialogElement_open","_M3eDialogElement_escapePressedWithoutCancel","_withActions","_M3eDialogElement_scrollLockController","ScrollLockController","alert","dismissible","disableClose","noFocusTrap","closeLabel","open","__classPrivateFieldGet","value","__classPrivateFieldSet","show","updateComplete","_base","dispatchEvent","Event","cancelable","lock","showModal","_content","scrollTop","focusable","querySelector","focusWhenReady","isConnected","unlock","prevReturnValue","close","render","html","ifDefined","undefined","_M3eDialogElement_instances","_M3eDialogElement_handleClose","_M3eDialogElement_handleCancel","_M3eDialogElement_handleClick","_M3eDialogElement_handleKeyDown","_M3eDialogElement_renderCloseButton","call","_M3eDialogElement_handleActionsSlotChange","nothing","e","target","preventDefault","key","shiftKey","ctrlKey","assignedNodes","flatten","length","setCustomState","styles","css","DesignToken","shape","corner","extraLarge","color","onSurface","surfaceContainerHigh","scrim","unsafeCSS","motion","duration","short3","easing","emphasized","long2","standard","typescale","headline","small","fontSize","fontWeight","lineHeight","tracking","onSurfaceVariant","body","medium","state","query","type","Boolean","reflect","M3eDialogTriggerElement","HtmlFor","connectedCallback","parentElement","ariaHasPopup","disconnectedCallback","control"],"mappings":";;;;;;;;;;;;;AAIA;;;;;;;AAOG;AAEI,IAAMA,sBAAsB,GAA5B,MAAMA,sBAAuB,SAAQC,iBAAiB,CAAA;AAAtDC,EAAAA,WAAAA,GAAA;;AACL;;;AAGG;IACsC,IAAA,CAAAC,WAAW,GAAG,EAAE;AAM3D,EAAA;AAJE;AACmBC,EAAAA,QAAQA,GAAA;IACzB,IAAI,CAACC,OAAO,CAAC,YAAY,CAAC,EAAEC,IAAI,CAAC,IAAI,CAACH,WAAW,CAAC;AACpD,EAAA;;AALyCI,UAAA,CAAA,CAAxCC,QAAQ,CAAC;AAAEC,EAAAA,SAAS,EAAE;CAAgB,CAAC,CAAkB,EAAAT,sBAAA,CAAAU,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAL/CV,sBAAsB,GAAAO,UAAA,CAAA,CADlCI,aAAa,CAAC,mBAAmB,CAAC,CACtB,EAAAX,sBAAsB,CAWlC;;;;ACPD;;;;;;;;;;;;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 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
- import{__decorate as e,__classPrivateFieldGet as t,__classPrivateFieldSet as o}from"tslib";import{property as i,state as n,query as a}from"lit/decorators.js";import{customElement as s,ActionElementBase as r,EventAttribute as l,AttachInternals as c,ScrollLockController as d,focusWhenReady as h,setCustomState as m,DesignToken as p,HtmlFor as g}from"@m3e/web/core";import{LitElement as u,html as b,nothing as v,unsafeCSS as f,css as y}from"lit";import{ifDefined as $}from"lit/directives/if-defined.js";import"@m3e/web/core/a11y";import"@m3e/web/icon-button";let w=class extends r{constructor(){super(...arguments),this.returnValue=""}_onClick(){this.closest("m3e-dialog")?.hide(this.returnValue)}};var k,x,_,C,E,z,V,Y,W,B,S,A;e([i({attribute:"return-value"})],w.prototype,"returnValue",void 0),w=e([s("m3e-dialog-action")],w);let H=A=class extends(l(c(u),"opening","opened","cancel","closing","closed")){constructor(){super(...arguments),k.add(this),x.set(this,A.__nextId++),_.set(this,!1),C.set(this,!1),this._withActions=!1,E.set(this,new d(this)),this.alert=!1,this.dismissible=!1,this.disableClose=!1,this.noFocusTrap=!1,this.closeLabel="Close",this.returnValue=""}get open(){return t(this,_,"f")}set open(e){e!==t(this,_,"f")&&(o(this,_,e,"f"),t(this,_,"f")?this.show():this.hide())}async show(){if(await this.updateComplete,this._base.open)return;if(!this.dispatchEvent(new Event("opening",{cancelable:!0})))return void(this.open=!1);t(this,E,"f").lock(),this._base.showModal(),this._content.scrollTop=0;const e=this.querySelector("[autofocus]");e&&h(e),this.dispatchEvent(new Event("opened"))}async hide(e=this.returnValue){if(!this.isConnected)return void(this.open=!1);if(await this.updateComplete,t(this,E,"f").unlock(),!this._base.open)return void(this.open=!1);const o=this.returnValue;this.returnValue=e,this.dispatchEvent(new Event("closing",{cancelable:!0}))?(this.open=!1,this._base.close(e),this.dispatchEvent(new Event("closed"))):this.returnValue=o}render(){return b`<dialog class="base" role="${$(this.alert?"alertdialog":void 0)}" aria-labelledby="m3e-dialog-${t(this,x,"f")}-header" .returnvalue="${this.returnValue}" @close="${t(this,k,"m",V)}" @cancel="${t(this,k,"m",Y)}" @click="${t(this,k,"m",W)}" @keydown="${t(this,k,"m",B)}"><m3e-elevation level="3"></m3e-elevation><m3e-focus-trap ?disabled="${this.noFocusTrap}"><div class="header"><slot name="header" id="m3e-dialog-${t(this,x,"f")}-header"></slot>${t(this,k,"m",z).call(this)}</div><m3e-scroll-container class="content" dividers="${this._withActions?"above-below":"above"}"><slot></slot></m3e-scroll-container><div class="actions"><slot name="actions" @slotchange="${t(this,k,"m",S)}"></slot></div></m3e-focus-trap></dialog>`}};x=new WeakMap,_=new WeakMap,C=new WeakMap,E=new WeakMap,k=new WeakSet,z=function(){return this.dismissible?b`<m3e-icon-button aria-label="${this.closeLabel}" class="close" @click="${this.hide}"><slot name="close-icon"><svg class="close-icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg></slot></m3e-icon-button>`:v},V=function(){t(this,C,"f")&&(o(this,C,!0,"f"),this._base?.dispatchEvent(new Event("cancel",{cancelable:!0})))},Y=function(e){e.target===this._base&&(o(this,C,!1,"f"),e.preventDefault(),this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide())},W=function(e){this.disableClose||e.target!==this._base||this.hide()},B=function(e){"Escape"!==e.key||e.shiftKey||e.ctrlKey||(e.preventDefault(),this.disableClose||this.hide())},S=function(e){this._withActions=e.target.assignedNodes({flatten:!0}).length>0,m(this,"-with-actions",this._withActions)},H.styles=y`:host { display: contents; } .base { font: inherit; border: unset; outline: unset; padding: unset; display: flex; flex-direction: column; position: fixed; overflow: visible; border-radius: var(--m3e-dialog-shape, ${p.shape.corner.extraLarge}); min-width: var(--m3e-dialog-min-width, 17.5rem); max-width: var(--m3e-dialog-max-width, 35rem); color: var(--m3e-dialog-color, ${p.color.onSurface}); background-color: var(--m3e-dialog-container-color, ${p.color.surfaceContainerHigh}); visibility: hidden; opacity: 0; transform-origin: top; transform: translateY(-3.125rem) scaleY(0.8); } .base::backdrop { background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${p.color.scrim}) 0%, transparent); margin-inline-end: -20px; } .base:not([open]) { visibility: hidden; opacity: 0; transform: translateY(-3.125rem) scaleY(0.8); transition: ${f(`opacity ${p.motion.duration.short3} ${p.motion.easing.emphasized}, \n transform ${p.motion.duration.short3} ${p.motion.easing.emphasized},\n overlay ${p.motion.duration.short3} ${p.motion.easing.emphasized} allow-discrete,\n visibility ${p.motion.duration.short3} ${p.motion.easing.emphasized} allow-discrete`)}; } .base[open] { visibility: visible; opacity: 1; transform: translateY(0) scaleY(1); transition: ${f(`opacity ${p.motion.duration.long2} ${p.motion.easing.emphasized}, \n transform ${p.motion.duration.long2} ${p.motion.easing.emphasized},\n overlay ${p.motion.duration.long2} ${p.motion.easing.emphasized} allow-discrete,\n visibility ${p.motion.duration.long2} ${p.motion.easing.emphasized} allow-discrete`)}; } .base:not([open])::backdrop { transition: ${f(`background-color ${p.motion.duration.short3} ${p.motion.easing.standard}, \n overlay ${p.motion.duration.short3} ${p.motion.easing.standard} allow-discrete,\n visibility ${p.motion.duration.short3} ${p.motion.easing.standard} allow-discrete`)}; } .base[open]::backdrop { background-color: color-mix( in srgb, var(--m3e-dialog-scrim-color, ${p.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%), transparent ); transition: ${f(`background-color ${p.motion.duration.long2} ${p.motion.easing.standard}, \n overlay ${p.motion.duration.long2} ${p.motion.easing.standard} allow-discrete,\n visibility ${p.motion.duration.long2} ${p.motion.easing.standard} allow-discrete`)}; } @starting-style { .base[open] { opacity: 0; transform: translateY(-3.125rem) scaleY(0.8); } .base[open]::backdrop { background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${p.color.scrim}) 0%, transparent); } } .header { flex: none; display: flex; align-items: center; padding: 1.5rem 1.5rem 1rem 1.5rem; background-color: var(--m3e-dialog-header-container-color, transparent); } ::slotted([slot="header"]) { margin: unset; flex: 1 1 auto; color: var(--m3e-dialog-header-color, inherit); font-size: var(--m3e-dialog-header-font-size, ${p.typescale.standard.headline.small.fontSize}); font-weight: var(--m3e-dialog-header-font-weight, ${p.typescale.standard.headline.small.fontWeight}); line-height: var(--m3e-dialog-header-line-height, ${p.typescale.standard.headline.small.lineHeight}); letter-spacing: var(--m3e-dialog-header-tracking, ${p.typescale.standard.headline.small.tracking}); } .content { padding-inline: 1.5rem; color: var(--m3e-dialog-content-color, ${p.color.onSurfaceVariant}); font-size: var(--m3e-dialog-content-font-size, ${p.typescale.standard.body.medium.fontSize}); font-weight: var(--m3e-dialog-content-font-weight, ${p.typescale.standard.body.medium.fontWeight}); line-height: var(--m3e-dialog-content-line-height, ${p.typescale.standard.body.medium.lineHeight}); letter-spacing: var(--m3e-dialog-content-tracking, ${p.typescale.standard.body.medium.tracking}); } .actions { padding: 1.5rem; } ::slotted([slot="actions"]) { flex: none; display: flex; align-items: center; min-height: 1.5rem; column-gap: 0.5rem; } ::slotted([slot="actions"][end]) { justify-content: flex-end; } :host(:not(:state(-with-actions))) .content { margin-bottom: 1.5rem; } :host(:not(:state(-with-actions))) .actions { display: none; } .close { margin-inline-start: 0.5rem; } ::slotted([slot="close-icon"]), .close-icon { width: 1em; font-size: var(--m3e-icon-button-icon-size, 1.5rem) !important; } @media (forced-colors: active) { .base:not([open])::backdrop, .base[open]::backdrop { transition: none; } .base { border-style: solid; border-width: 1px; border-color: CanvasText; } } @media (prefers-reduced-motion) { .base:not([open]), .base[open], .base:not([open])::backdrop, .base[open]::backdrop { transition: none; } }`,H.__nextId=0,e([n()],H.prototype,"_withActions",void 0),e([a(".base")],H.prototype,"_base",void 0),e([a(".content")],H.prototype,"_content",void 0),e([i({type:Boolean})],H.prototype,"alert",void 0),e([i({type:Boolean,reflect:!0})],H.prototype,"open",null),e([i({type:Boolean})],H.prototype,"dismissible",void 0),e([i({attribute:"disable-close",type:Boolean})],H.prototype,"disableClose",void 0),e([i({attribute:"no-focus-trap",type:Boolean})],H.prototype,"noFocusTrap",void 0),e([i({attribute:"close-label"})],H.prototype,"closeLabel",void 0),H=A=e([s("m3e-dialog")],H);let M=class extends(g(r)){connectedCallback(){super.connectedCallback(),this.parentElement&&(this.parentElement.ariaHasPopup="dialog")}disconnectedCallback(){super.disconnectedCallback(),this.parentElement&&(this.parentElement.ariaHasPopup=null)}_onClick(){this.control instanceof H&&this.control.show()}};M=e([s("m3e-dialog-trigger")],M);export{w as M3eDialogActionElement,H as M3eDialogElement,M as M3eDialogTriggerElement};
6
+ import{__decorate as e,__classPrivateFieldGet as t,__classPrivateFieldSet as o}from"tslib";import{property as i,state as n,query as a}from"lit/decorators.js";import{customElement as s,ActionElementBase as r,AttachInternals as l,ScrollLockController as d,focusWhenReady as c,setCustomState as h,DesignToken as m,HtmlFor as p}from"@m3e/web/core";import{LitElement as g,html as u,nothing as b,unsafeCSS as v,css as f}from"lit";import{ifDefined as y}from"lit/directives/if-defined.js";import"@m3e/web/core/a11y";import"@m3e/web/icon-button";let $=class extends r{constructor(){super(...arguments),this.returnValue=""}_onClick(){this.closest("m3e-dialog")?.hide(this.returnValue)}};var w,k,x,_,C,E,z,V,Y,W,B,S;e([i({attribute:"return-value"})],$.prototype,"returnValue",void 0),$=e([s("m3e-dialog-action")],$);let A=S=class extends(l(g)){constructor(){super(...arguments),w.add(this),k.set(this,S.__nextId++),x.set(this,!1),_.set(this,!1),this._withActions=!1,C.set(this,new d(this)),this.alert=!1,this.dismissible=!1,this.disableClose=!1,this.noFocusTrap=!1,this.closeLabel="Close",this.returnValue=""}get open(){return t(this,x,"f")}set open(e){e!==t(this,x,"f")&&(o(this,x,e,"f"),t(this,x,"f")?this.show():this.hide())}async show(){if(await this.updateComplete,this._base.open)return;if(!this.dispatchEvent(new Event("opening",{cancelable:!0})))return void(this.open=!1);t(this,C,"f").lock(),this._base.showModal(),this._content.scrollTop=0;const e=this.querySelector("[autofocus]");e&&c(e),this.dispatchEvent(new Event("opened"))}async hide(e=this.returnValue){if(!this.isConnected)return void(this.open=!1);if(await this.updateComplete,t(this,C,"f").unlock(),!this._base.open)return void(this.open=!1);const o=this.returnValue;this.returnValue=e,this.dispatchEvent(new Event("closing",{cancelable:!0}))?(this.open=!1,this._base.close(e),this.dispatchEvent(new Event("closed"))):this.returnValue=o}render(){return u`<dialog class="base" role="${y(this.alert?"alertdialog":void 0)}" aria-labelledby="m3e-dialog-${t(this,k,"f")}-header" .returnvalue="${this.returnValue}" @close="${t(this,w,"m",z)}" @cancel="${t(this,w,"m",V)}" @click="${t(this,w,"m",Y)}" @keydown="${t(this,w,"m",W)}"><m3e-elevation level="3"></m3e-elevation><m3e-focus-trap ?disabled="${this.noFocusTrap}"><div class="header"><slot name="header" id="m3e-dialog-${t(this,k,"f")}-header"></slot>${t(this,w,"m",E).call(this)}</div><m3e-scroll-container class="content" dividers="${this._withActions?"above-below":"above"}"><slot></slot></m3e-scroll-container><div class="actions"><slot name="actions" @slotchange="${t(this,w,"m",B)}"></slot></div></m3e-focus-trap></dialog>`}};k=new WeakMap,x=new WeakMap,_=new WeakMap,C=new WeakMap,w=new WeakSet,E=function(){return this.dismissible?u`<m3e-icon-button aria-label="${this.closeLabel}" class="close" @click="${this.hide}"><slot name="close-icon"><svg class="close-icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg></slot></m3e-icon-button>`:b},z=function(){t(this,_,"f")&&(o(this,_,!0,"f"),this._base?.dispatchEvent(new Event("cancel",{cancelable:!0})))},V=function(e){e.target===this._base&&(o(this,_,!1,"f"),e.preventDefault(),this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide())},Y=function(e){this.disableClose||e.target!==this._base||this.hide()},W=function(e){"Escape"!==e.key||e.shiftKey||e.ctrlKey||(e.preventDefault(),this.disableClose||this.hide())},B=function(e){this._withActions=e.target.assignedNodes({flatten:!0}).length>0,h(this,"-with-actions",this._withActions)},A.styles=f`:host { display: contents; } .base { font: inherit; border: unset; outline: unset; padding: unset; display: flex; flex-direction: column; position: fixed; overflow: visible; border-radius: var(--m3e-dialog-shape, ${m.shape.corner.extraLarge}); min-width: var(--m3e-dialog-min-width, 17.5rem); max-width: var(--m3e-dialog-max-width, 35rem); color: var(--m3e-dialog-color, ${m.color.onSurface}); background-color: var(--m3e-dialog-container-color, ${m.color.surfaceContainerHigh}); visibility: hidden; opacity: 0; transform-origin: top; transform: translateY(-3.125rem) scaleY(0.8); } .base::backdrop { background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${m.color.scrim}) 0%, transparent); margin-inline-end: -20px; } .base:not([open]) { visibility: hidden; opacity: 0; transform: translateY(-3.125rem) scaleY(0.8); transition: ${v(`opacity ${m.motion.duration.short3} ${m.motion.easing.emphasized}, \n transform ${m.motion.duration.short3} ${m.motion.easing.emphasized},\n overlay ${m.motion.duration.short3} ${m.motion.easing.emphasized} allow-discrete,\n visibility ${m.motion.duration.short3} ${m.motion.easing.emphasized} allow-discrete`)}; } .base[open] { visibility: visible; opacity: 1; transform: translateY(0) scaleY(1); transition: ${v(`opacity ${m.motion.duration.long2} ${m.motion.easing.emphasized}, \n transform ${m.motion.duration.long2} ${m.motion.easing.emphasized},\n overlay ${m.motion.duration.long2} ${m.motion.easing.emphasized} allow-discrete,\n visibility ${m.motion.duration.long2} ${m.motion.easing.emphasized} allow-discrete`)}; } .base:not([open])::backdrop { transition: ${v(`background-color ${m.motion.duration.short3} ${m.motion.easing.standard}, \n overlay ${m.motion.duration.short3} ${m.motion.easing.standard} allow-discrete,\n visibility ${m.motion.duration.short3} ${m.motion.easing.standard} allow-discrete`)}; } .base[open]::backdrop { background-color: color-mix( in srgb, var(--m3e-dialog-scrim-color, ${m.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%), transparent ); transition: ${v(`background-color ${m.motion.duration.long2} ${m.motion.easing.standard}, \n overlay ${m.motion.duration.long2} ${m.motion.easing.standard} allow-discrete,\n visibility ${m.motion.duration.long2} ${m.motion.easing.standard} allow-discrete`)}; } @starting-style { .base[open] { opacity: 0; transform: translateY(-3.125rem) scaleY(0.8); } .base[open]::backdrop { background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${m.color.scrim}) 0%, transparent); } } .header { flex: none; display: flex; align-items: center; padding: 1.5rem 1.5rem 1rem 1.5rem; background-color: var(--m3e-dialog-header-container-color, transparent); } ::slotted([slot="header"]) { margin: unset; flex: 1 1 auto; color: var(--m3e-dialog-header-color, inherit); font-size: var(--m3e-dialog-header-font-size, ${m.typescale.standard.headline.small.fontSize}); font-weight: var(--m3e-dialog-header-font-weight, ${m.typescale.standard.headline.small.fontWeight}); line-height: var(--m3e-dialog-header-line-height, ${m.typescale.standard.headline.small.lineHeight}); letter-spacing: var(--m3e-dialog-header-tracking, ${m.typescale.standard.headline.small.tracking}); } .content { padding-inline: 1.5rem; color: var(--m3e-dialog-content-color, ${m.color.onSurfaceVariant}); font-size: var(--m3e-dialog-content-font-size, ${m.typescale.standard.body.medium.fontSize}); font-weight: var(--m3e-dialog-content-font-weight, ${m.typescale.standard.body.medium.fontWeight}); line-height: var(--m3e-dialog-content-line-height, ${m.typescale.standard.body.medium.lineHeight}); letter-spacing: var(--m3e-dialog-content-tracking, ${m.typescale.standard.body.medium.tracking}); } .actions { padding: 1.5rem; } ::slotted([slot="actions"]) { flex: none; display: flex; align-items: center; min-height: 1.5rem; column-gap: 0.5rem; } ::slotted([slot="actions"][end]) { justify-content: flex-end; } :host(:not(:state(-with-actions))) .content { margin-bottom: 1.5rem; } :host(:not(:state(-with-actions))) .actions { display: none; } .close { margin-inline-start: 0.5rem; } ::slotted([slot="close-icon"]), .close-icon { width: 1em; font-size: var(--m3e-icon-button-icon-size, 1.5rem) !important; } @media (forced-colors: active) { .base:not([open])::backdrop, .base[open]::backdrop { transition: none; } .base { border-style: solid; border-width: 1px; border-color: CanvasText; } } @media (prefers-reduced-motion) { .base:not([open]), .base[open], .base:not([open])::backdrop, .base[open]::backdrop { transition: none; } }`,A.__nextId=0,e([n()],A.prototype,"_withActions",void 0),e([a(".base")],A.prototype,"_base",void 0),e([a(".content")],A.prototype,"_content",void 0),e([i({type:Boolean})],A.prototype,"alert",void 0),e([i({type:Boolean,reflect:!0})],A.prototype,"open",null),e([i({type:Boolean})],A.prototype,"dismissible",void 0),e([i({attribute:"disable-close",type:Boolean})],A.prototype,"disableClose",void 0),e([i({attribute:"no-focus-trap",type:Boolean})],A.prototype,"noFocusTrap",void 0),e([i({attribute:"close-label"})],A.prototype,"closeLabel",void 0),A=S=e([s("m3e-dialog")],A);let H=class extends(p(r)){connectedCallback(){super.connectedCallback(),this.parentElement&&(this.parentElement.ariaHasPopup="dialog")}disconnectedCallback(){super.disconnectedCallback(),this.parentElement&&(this.parentElement.ariaHasPopup=null)}_onClick(){this.control instanceof A&&this.control.show()}};H=e([s("m3e-dialog-trigger")],H);export{$ as M3eDialogActionElement,A as M3eDialogElement,H as M3eDialogTriggerElement};
7
7
  //# sourceMappingURL=dialog.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.min.js","sources":["../../src/dialog/DialogActionElement.ts","../../src/dialog/DialogElement.ts","../../src/dialog/DialogTriggerElement.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 close a parenting dialog.\r\n * @tag m3e-dialog-action\r\n *\r\n * @slot - Renders the content of the action.\r\n *\r\n * @attr return-value - The value to return from the dialog.\r\n */\r\n@customElement(\"m3e-dialog-action\")\r\nexport class M3eDialogActionElement extends ActionElementBase {\r\n /**\r\n * The value to return from the dialog.\r\n * @default \"\"\r\n */\r\n @property({ attribute: \"return-value\" }) returnValue = \"\";\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n this.closest(\"m3e-dialog\")?.hide(this.returnValue);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-dialog-action\": M3eDialogActionElement;\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, nothing, unsafeCSS } from \"lit\";\r\nimport { property, query, state } from \"lit/decorators.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n DesignToken,\r\n EventAttribute,\r\n focusWhenReady,\r\n ScrollLockController,\r\n setCustomState,\r\n} from \"@m3e/web/core\";\r\n\r\nimport \"@m3e/web/core/a11y\";\r\nimport \"@m3e/web/icon-button\";\r\n\r\n/**\r\n * A dialog that provides important prompts in a user flow.\r\n *\r\n * @description\r\n * The `m3e-dialog` component presents important prompts, alerts, and actions in user flows.\r\n * Designed according to Material 3 principles, it supports custom header, content, and\r\n * close icon slots, ARIA accessibility, focus management, and theming via CSS custom properties.\r\n *\r\n * @example\r\n * ```html\r\n * <m3e-button variant=\"filled\">\r\n * <m3e-dialog-trigger for=\"dlg\">Open Dialog</m3e-dialog-trigger>\r\n * </m3e-button>\r\n * <m3e-dialog id=\"dlg\" dismissible onclosed=\"console.log(this.returnValue)\">\r\n * <span slot=\"header\">Dialog Title</span>\r\n * Dialog content goes here.\r\n * <div slot=\"actions\" end>\r\n * <m3e-button autofocus><m3e-dialog-action return-value=\"ok\">Close</m3e-dialog-action></m3e-button>\r\n * </div>\r\n * </m3e-dialog>\r\n * ```\r\n *\r\n * @tag m3e-dialog\r\n *\r\n * @slot - Renders the content of the dialog.\r\n * @slot header - Renders the header of the dialog.\r\n * @slot actions - Renders the actions of the dialog.\r\n * @slot close-icon - Renders the icon of the button used to close the dialog.\r\n *\r\n * @attr alert - Whether the dialog is an alert.\r\n * @attr close-label - The accessible label given to the button used to dismiss the dialog.\r\n * @attr disable-close -Whether users cannot click the backdrop or press escape to dismiss the dialog.\r\n * @attr dismissible - Whether a button is presented that can be used to close the dialog.\r\n * @attr no-focus-trap - Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.\r\n * @attr open - Whether the dialog is open.\r\n *\r\n * @fires opening - Emitted when the dialog begins to open.\r\n * @fires opened - Emitted when the dialog has opened.\r\n * @fires cancel - Emitted when the dialog is cancelled.\r\n * @fires closing - Emitted when the dialog begins to close.\r\n * @fires closed - Emitted when the dialog has closed.\r\n *\r\n * @cssprop --m3e-dialog-shape - Border radius of the dialog container.\r\n * @cssprop --m3e-dialog-min-width - Minimum width of the dialog.\r\n * @cssprop --m3e-dialog-max-width - Maximum width of the dialog.\r\n * @cssprop --m3e-dialog-color - Foreground color of the dialog.\r\n * @cssprop --m3e-dialog-container-color - Background color of the dialog container.\r\n * @cssprop --m3e-dialog-scrim-color - Color of the scrim (backdrop overlay).\r\n * @cssprop --m3e-dialog-scrim-opacity - Opacity of the scrim when open.\r\n * @cssprop --m3e-dialog-header-container-color - Background color of the dialog header.\r\n * @cssprop --m3e-dialog-header-color - Foreground color of the dialog header.\r\n * @cssprop --m3e-dialog-header-font-size - Font size for the dialog header.\r\n * @cssprop --m3e-dialog-header-font-weight - Font weight for the dialog header.\r\n * @cssprop --m3e-dialog-header-line-height - Line height for the dialog header.\r\n * @cssprop --m3e-dialog-header-tracking - Letter spacing for the dialog header.\r\n * @cssprop --m3e-dialog-content-color - Foreground color of the dialog content.\r\n * @cssprop --m3e-dialog-content-font-size - Font size for the dialog content.\r\n * @cssprop --m3e-dialog-content-font-weight - Font weight for the dialog content.\r\n * @cssprop --m3e-dialog-content-line-height - Line height for the dialog content.\r\n * @cssprop --m3e-dialog-content-tracking - Letter spacing for the dialog content.\r\n */\r\n@customElement(\"m3e-dialog\")\r\nexport class M3eDialogElement extends EventAttribute(\r\n AttachInternals(LitElement),\r\n \"opening\",\r\n \"opened\",\r\n \"cancel\",\r\n \"closing\",\r\n \"closed\",\r\n) {\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 font: inherit;\r\n border: unset;\r\n outline: unset;\r\n padding: unset;\r\n display: flex;\r\n flex-direction: column;\r\n position: fixed;\r\n overflow: visible;\r\n border-radius: var(--m3e-dialog-shape, ${DesignToken.shape.corner.extraLarge});\r\n min-width: var(--m3e-dialog-min-width, 17.5rem);\r\n max-width: var(--m3e-dialog-max-width, 35rem);\r\n color: var(--m3e-dialog-color, ${DesignToken.color.onSurface});\r\n background-color: var(--m3e-dialog-container-color, ${DesignToken.color.surfaceContainerHigh});\r\n visibility: hidden;\r\n opacity: 0;\r\n transform-origin: top;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n }\r\n .base::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n margin-inline-end: -20px;\r\n }\r\n .base:not([open]) {\r\n visibility: hidden;\r\n opacity: 0;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized}, \r\n transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized},\r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized} allow-discrete`,\r\n )};\r\n }\r\n .base[open] {\r\n visibility: visible;\r\n opacity: 1;\r\n transform: translateY(0) scaleY(1);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized}, \r\n transform ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized},\r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized} allow-discrete`,\r\n )};\r\n }\r\n .base:not([open])::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .base[open]::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%),\r\n transparent\r\n );\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n @starting-style {\r\n .base[open] {\r\n opacity: 0;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n }\r\n .base[open]::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n }\r\n }\r\n .header {\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n padding: 1.5rem 1.5rem 1rem 1.5rem;\r\n background-color: var(--m3e-dialog-header-container-color, transparent);\r\n }\r\n ::slotted([slot=\"header\"]) {\r\n margin: unset;\r\n flex: 1 1 auto;\r\n color: var(--m3e-dialog-header-color, inherit);\r\n font-size: var(--m3e-dialog-header-font-size, ${DesignToken.typescale.standard.headline.small.fontSize});\r\n font-weight: var(--m3e-dialog-header-font-weight, ${DesignToken.typescale.standard.headline.small.fontWeight});\r\n line-height: var(--m3e-dialog-header-line-height, ${DesignToken.typescale.standard.headline.small.lineHeight});\r\n letter-spacing: var(--m3e-dialog-header-tracking, ${DesignToken.typescale.standard.headline.small.tracking});\r\n }\r\n .content {\r\n padding-inline: 1.5rem;\r\n color: var(--m3e-dialog-content-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(--m3e-dialog-content-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-dialog-content-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-dialog-content-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-dialog-content-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n .actions {\r\n padding: 1.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 :host(:not(:state(-with-actions))) .content {\r\n margin-bottom: 1.5rem;\r\n }\r\n :host(:not(:state(-with-actions))) .actions {\r\n display: none;\r\n }\r\n .close {\r\n margin-inline-start: 0.5rem;\r\n }\r\n ::slotted([slot=\"close-icon\"]),\r\n .close-icon {\r\n width: 1em;\r\n font-size: var(--m3e-icon-button-icon-size, 1.5rem) !important;\r\n }\r\n @media (forced-colors: active) {\r\n .base:not([open])::backdrop,\r\n .base[open]::backdrop {\r\n transition: none;\r\n }\r\n .base {\r\n border-style: solid;\r\n border-width: 1px;\r\n border-color: CanvasText;\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n .base:not([open]),\r\n .base[open],\r\n .base:not([open])::backdrop,\r\n .base[open]::backdrop {\r\n transition: none;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __nextId = 0;\r\n /** @private */ #id = M3eDialogElement.__nextId++;\r\n\r\n /** @private */ #open = false;\r\n /** @private */ #escapePressedWithoutCancel = false;\r\n /** @private */ @state() private _withActions = false;\r\n /** @private */ @query(\".base\") private readonly _base!: HTMLDialogElement;\r\n /** @private */ @query(\".content\") private readonly _content!: HTMLDialogElement;\r\n\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n\r\n /**\r\n * Whether the dialog is an alert.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) alert = false;\r\n\r\n /**\r\n * Whether the dialog is open.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) get open() {\r\n return this.#open;\r\n }\r\n set open(value: boolean) {\r\n if (value === this.#open) return;\r\n this.#open = value;\r\n if (this.#open) {\r\n this.show();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /**\r\n * Whether a button is presented that can be used to close the dialog.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) dismissible = false;\r\n\r\n /**\r\n * Whether users cannot click the backdrop or press ESC to dismiss the dialog.\r\n * @default false\r\n */\r\n @property({ attribute: \"disable-close\", type: Boolean }) disableClose = false;\r\n\r\n /**\r\n * Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.\r\n * @default false\r\n */\r\n @property({ attribute: \"no-focus-trap\", type: Boolean }) noFocusTrap = false;\r\n\r\n /**\r\n * The accessible label given to the button used to dismiss the dialog.\r\n * @default \"Close\"\r\n */\r\n @property({ attribute: \"close-label\" }) closeLabel = \"Close\";\r\n\r\n /**\r\n * The return value of the dialog.\r\n * @default \"\"\r\n */\r\n returnValue = \"\";\r\n\r\n /**\r\n * Asynchronously opens the dialog.\r\n * @returns {Promise<void>} A `Promise` that resolves when the dialog is open.\r\n */\r\n async show(): Promise<void> {\r\n await this.updateComplete;\r\n\r\n if (this._base.open) {\r\n return;\r\n }\r\n\r\n if (!this.dispatchEvent(new Event(\"opening\", { cancelable: true }))) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n this.#scrollLockController.lock();\r\n this._base.showModal();\r\n this._content.scrollTop = 0;\r\n const focusable = this.querySelector<HTMLElement>(\"[autofocus]\");\r\n\r\n if (focusable) {\r\n focusWhenReady(focusable);\r\n }\r\n\r\n this.dispatchEvent(new Event(\"opened\"));\r\n }\r\n\r\n /**\r\n * Asynchronously closes the dialog.\r\n * @param {string} returnValue The value to return.\r\n * @returns {Promise<void>} A `Promise` that resolves when the dialog is closed.\r\n */\r\n async hide(returnValue: string = this.returnValue): Promise<void> {\r\n if (!this.isConnected) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n await this.updateComplete;\r\n\r\n this.#scrollLockController.unlock();\r\n\r\n if (!this._base.open) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n const prevReturnValue = this.returnValue;\r\n this.returnValue = returnValue;\r\n\r\n if (!this.dispatchEvent(new Event(\"closing\", { cancelable: true }))) {\r\n this.returnValue = prevReturnValue;\r\n return;\r\n }\r\n\r\n this.open = false;\r\n this._base.close(returnValue);\r\n this.dispatchEvent(new Event(\"closed\"));\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<dialog\r\n class=\"base\"\r\n role=\"${ifDefined(this.alert ? \"alertdialog\" : undefined)}\"\r\n aria-labelledby=\"m3e-dialog-${this.#id}-header\"\r\n .returnValue=\"${this.returnValue}\"\r\n @close=\"${this.#handleClose}\"\r\n @cancel=\"${this.#handleCancel}\"\r\n @click=\"${this.#handleClick}\"\r\n @keydown=\"${this.#handleKeyDown}\"\r\n >\r\n <m3e-elevation level=\"3\"></m3e-elevation>\r\n <m3e-focus-trap ?disabled=\"${this.noFocusTrap}\">\r\n <div class=\"header\">\r\n <slot name=\"header\" id=\"m3e-dialog-${this.#id}-header\"></slot>\r\n ${this.#renderCloseButton()}\r\n </div>\r\n <m3e-scroll-container class=\"content\" dividers=\"${this._withActions ? \"above-below\" : \"above\"}\">\r\n <slot></slot>\r\n </m3e-scroll-container>\r\n <div class=\"actions\">\r\n <slot name=\"actions\" @slotchange=\"${this.#handleActionsSlotChange}\"></slot>\r\n </div>\r\n </m3e-focus-trap>\r\n </dialog>`;\r\n }\r\n\r\n /** @private */\r\n #renderCloseButton(): unknown {\r\n return !this.dismissible\r\n ? nothing\r\n : html`<m3e-icon-button aria-label=\"${this.closeLabel}\" class=\"close\" @click=\"${this.hide}\">\r\n <slot name=\"close-icon\">\r\n <svg class=\"close-icon\" viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path\r\n d=\"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z\"\r\n />\r\n </svg>\r\n </slot>\r\n </m3e-icon-button>`;\r\n }\r\n\r\n /** @private */\r\n #handleClose(): void {\r\n if (!this.#escapePressedWithoutCancel) {\r\n return;\r\n }\r\n this.#escapePressedWithoutCancel = true;\r\n this._base?.dispatchEvent(new Event(\"cancel\", { cancelable: true }));\r\n }\r\n\r\n /** @private */\r\n #handleCancel(e: Event): void {\r\n if (e.target !== this._base) return;\r\n this.#escapePressedWithoutCancel = false;\r\n e.preventDefault();\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleClick(e: Event): void {\r\n if (!this.disableClose && e.target === this._base) {\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 if (!this.disableClose) {\r\n this.hide();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleActionsSlotChange(e: Event): void {\r\n this._withActions = (<HTMLSlotElement>e.target).assignedNodes({ flatten: true }).length > 0;\r\n setCustomState(this, \"-with-actions\", this._withActions);\r\n }\r\n}\r\n\r\ninterface M3eDialogElementEventMap extends HTMLElementEventMap {\r\n opening: Event;\r\n opened: Event;\r\n closing: Event;\r\n closed: Event;\r\n cancel: Event;\r\n}\r\n\r\nexport interface M3eDialogElement {\r\n addEventListener<K extends keyof M3eDialogElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[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 M3eDialogElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[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-dialog\": M3eDialogElement;\r\n }\r\n}\r\n","import { ActionElementBase, customElement, HtmlFor } from \"@m3e/web/core\";\r\n\r\nimport { M3eDialogElement } from \"./DialogElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to open a dialog.\r\n * @tag m3e-dialog-trigger\r\n */\r\n@customElement(\"m3e-dialog-trigger\")\r\nexport class M3eDialogTriggerElement extends HtmlFor(ActionElementBase) {\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override _onClick(): void {\r\n if (this.control instanceof M3eDialogElement) {\r\n this.control.show();\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-dialog-trigger\": M3eDialogTriggerElement;\r\n }\r\n}\r\n"],"names":["M3eDialogActionElement","ActionElementBase","constructor","this","returnValue","_onClick","closest","hide","__decorate","property","attribute","prototype","customElement","M3eDialogElement","EventAttribute","AttachInternals","LitElement","_M3eDialogElement_id","set","M3eDialogElement_1","__nextId","_M3eDialogElement_open","_M3eDialogElement_escapePressedWithoutCancel","_withActions","_M3eDialogElement_scrollLockController","ScrollLockController","alert","dismissible","disableClose","noFocusTrap","closeLabel","open","__classPrivateFieldGet","value","__classPrivateFieldSet","show","updateComplete","_base","dispatchEvent","Event","cancelable","lock","showModal","_content","scrollTop","focusable","querySelector","focusWhenReady","isConnected","unlock","prevReturnValue","close","render","html","ifDefined","undefined","_M3eDialogElement_instances","_M3eDialogElement_handleClose","_M3eDialogElement_handleCancel","_M3eDialogElement_handleClick","_M3eDialogElement_handleKeyDown","_M3eDialogElement_renderCloseButton","call","_M3eDialogElement_handleActionsSlotChange","nothing","e","target","preventDefault","key","shiftKey","ctrlKey","assignedNodes","flatten","length","setCustomState","styles","css","DesignToken","shape","corner","extraLarge","color","onSurface","surfaceContainerHigh","scrim","unsafeCSS","motion","duration","short3","easing","emphasized","long2","standard","typescale","headline","small","fontSize","fontWeight","lineHeight","tracking","onSurfaceVariant","body","medium","state","query","type","Boolean","reflect","M3eDialogTriggerElement","HtmlFor","connectedCallback","super","parentElement","ariaHasPopup","disconnectedCallback","control"],"mappings":";;;;;6iBAaO,IAAMA,EAAN,cAAqCC,EAArCC,WAAAA,uBAKoCC,KAAAC,YAAc,EAMzD,CAHqBC,QAAAA,GACjBF,KAAKG,QAAQ,eAAeC,KAAKJ,KAAKC,YACxC,+BALyCI,EAAA,CAAxCC,EAAS,CAAEC,UAAW,kBAAmCV,EAAAW,UAAA,mBAAA,GAL/CX,EAAsBQ,EAAA,CADlCI,EAAc,sBACFZ,GCmEN,IAAMa,IAAN,cAA+BC,EACpCC,EAAgBC,GAChB,UACA,SACA,SACA,UACA,WANKd,WAAAA,mCA+JWe,EAAAC,IAAAf,KAAMgB,EAAiBC,YAEvBC,EAAAH,IAAAf,MAAQ,GACRmB,EAAAJ,IAAAf,MAA8B,GACbA,KAAAoB,cAAe,EAIvBC,EAAAN,IAAAf,KAAwB,IAAIsB,EAAqBtB,OAM7CA,KAAAuB,OAAQ,EAuBRvB,KAAAwB,aAAc,EAMcxB,KAAAyB,cAAe,EAMfzB,KAAA0B,aAAc,EAM/B1B,KAAA2B,WAAa,QAMrD3B,KAAAC,YAAc,EAmJhB,CA5L8C,QAAI2B,GAC9C,OAAOC,EA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F,UAAA,gBACvBH,EAAA,CAAnCgG,EAAM,aAA0D3F,EAAAF,UAAA,mBAQpDH,EAAA,CAA5BC,EAAS,CAAEgG,KAAMC,WAAyB7F,EAAAF,UAAA,aAAA,GAMCH,EAAA,CAA3CC,EAAS,CAAEgG,KAAMC,QAASC,SAAS,KAEnC9F,EAAAF,UAAA,OAAA,MAe4BH,EAAA,CAA5BC,EAAS,CAAEgG,KAAMC,WAA+B7F,EAAAF,UAAA,mBAAA,GAMQH,EAAA,CAAxDC,EAAS,CAAEC,UAAW,gBAAiB+F,KAAMC,WAAgC7F,EAAAF,UAAA,oBAAA,GAMrBH,EAAA,CAAxDC,EAAS,CAAEC,UAAW,gBAAiB+F,KAAMC,WAA+B7F,EAAAF,UAAA,mBAAA,GAMrCH,EAAA,CAAvCC,EAAS,CAAEC,UAAW,iBAAsCG,EAAAF,UAAA,kBAAA,GAtNlDE,EAAgBM,EAAAX,EAAA,CAD5BI,EAAc,eACFC,GCvEN,IAAM+F,EAAN,cAAsCC,EAAQ5G,IAE1C6G,iBAAAA,GACPC,MAAMD,oBAEF3G,KAAK6G,gBACP7G,KAAK6G,cAAcC,aAAe,SAEtC,CAGSC,oBAAAA,GACPH,MAAMG,uBAEF/G,KAAK6G,gBACP7G,KAAK6G,cAAcC,aAAe,KAEtC,CAGS5G,QAAAA,GACHF,KAAKgH,mBAAmBtG,GAC1BV,KAAKgH,QAAQhF,MAEjB,GAxBWyE,EAAuBpG,EAAA,CADnCI,EAAc,uBACFgG"}
1
+ {"version":3,"file":"dialog.min.js","sources":["../../src/dialog/DialogActionElement.ts","../../src/dialog/DialogElement.ts","../../src/dialog/DialogTriggerElement.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 close a parenting dialog.\r\n * @tag m3e-dialog-action\r\n *\r\n * @slot - Renders the content of the action.\r\n *\r\n * @attr return-value - The value to return from the dialog.\r\n */\r\n@customElement(\"m3e-dialog-action\")\r\nexport class M3eDialogActionElement extends ActionElementBase {\r\n /**\r\n * The value to return from the dialog.\r\n * @default \"\"\r\n */\r\n @property({ attribute: \"return-value\" }) returnValue = \"\";\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n this.closest(\"m3e-dialog\")?.hide(this.returnValue);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-dialog-action\": M3eDialogActionElement;\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, nothing, unsafeCSS } from \"lit\";\r\nimport { property, query, state } from \"lit/decorators.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n DesignToken,\r\n focusWhenReady,\r\n ScrollLockController,\r\n setCustomState,\r\n} from \"@m3e/web/core\";\r\n\r\nimport \"@m3e/web/core/a11y\";\r\nimport \"@m3e/web/icon-button\";\r\n\r\n/**\r\n * A dialog that provides important prompts in a user flow.\r\n *\r\n * @description\r\n * The `m3e-dialog` component presents important prompts, alerts, and actions in user flows.\r\n * Designed according to Material 3 principles, it supports custom header, content, and\r\n * close icon slots, ARIA accessibility, focus management, and theming via CSS custom properties.\r\n *\r\n * @example\r\n * ```html\r\n * <m3e-button variant=\"filled\">\r\n * <m3e-dialog-trigger for=\"dlg\">Open Dialog</m3e-dialog-trigger>\r\n * </m3e-button>\r\n * <m3e-dialog id=\"dlg\" dismissible onclosed=\"console.log(this.returnValue)\">\r\n * <span slot=\"header\">Dialog Title</span>\r\n * Dialog content goes here.\r\n * <div slot=\"actions\" end>\r\n * <m3e-button autofocus><m3e-dialog-action return-value=\"ok\">Close</m3e-dialog-action></m3e-button>\r\n * </div>\r\n * </m3e-dialog>\r\n * ```\r\n *\r\n * @tag m3e-dialog\r\n *\r\n * @slot - Renders the content of the dialog.\r\n * @slot header - Renders the header of the dialog.\r\n * @slot actions - Renders the actions of the dialog.\r\n * @slot close-icon - Renders the icon of the button used to close the dialog.\r\n *\r\n * @attr alert - Whether the dialog is an alert.\r\n * @attr close-label - The accessible label given to the button used to dismiss the dialog.\r\n * @attr disable-close -Whether users cannot click the backdrop or press escape to dismiss the dialog.\r\n * @attr dismissible - Whether a button is presented that can be used to close the dialog.\r\n * @attr no-focus-trap - Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.\r\n * @attr open - Whether the dialog is open.\r\n *\r\n * @fires opening - Emitted when the dialog begins to open.\r\n * @fires opened - Emitted when the dialog has opened.\r\n * @fires cancel - Emitted when the dialog is cancelled.\r\n * @fires closing - Emitted when the dialog begins to close.\r\n * @fires closed - Emitted when the dialog has closed.\r\n *\r\n * @cssprop --m3e-dialog-shape - Border radius of the dialog container.\r\n * @cssprop --m3e-dialog-min-width - Minimum width of the dialog.\r\n * @cssprop --m3e-dialog-max-width - Maximum width of the dialog.\r\n * @cssprop --m3e-dialog-color - Foreground color of the dialog.\r\n * @cssprop --m3e-dialog-container-color - Background color of the dialog container.\r\n * @cssprop --m3e-dialog-scrim-color - Color of the scrim (backdrop overlay).\r\n * @cssprop --m3e-dialog-scrim-opacity - Opacity of the scrim when open.\r\n * @cssprop --m3e-dialog-header-container-color - Background color of the dialog header.\r\n * @cssprop --m3e-dialog-header-color - Foreground color of the dialog header.\r\n * @cssprop --m3e-dialog-header-font-size - Font size for the dialog header.\r\n * @cssprop --m3e-dialog-header-font-weight - Font weight for the dialog header.\r\n * @cssprop --m3e-dialog-header-line-height - Line height for the dialog header.\r\n * @cssprop --m3e-dialog-header-tracking - Letter spacing for the dialog header.\r\n * @cssprop --m3e-dialog-content-color - Foreground color of the dialog content.\r\n * @cssprop --m3e-dialog-content-font-size - Font size for the dialog content.\r\n * @cssprop --m3e-dialog-content-font-weight - Font weight for the dialog content.\r\n * @cssprop --m3e-dialog-content-line-height - Line height for the dialog content.\r\n * @cssprop --m3e-dialog-content-tracking - Letter spacing for the dialog content.\r\n */\r\n@customElement(\"m3e-dialog\")\r\nexport class M3eDialogElement extends AttachInternals(LitElement) {\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 font: inherit;\r\n border: unset;\r\n outline: unset;\r\n padding: unset;\r\n display: flex;\r\n flex-direction: column;\r\n position: fixed;\r\n overflow: visible;\r\n border-radius: var(--m3e-dialog-shape, ${DesignToken.shape.corner.extraLarge});\r\n min-width: var(--m3e-dialog-min-width, 17.5rem);\r\n max-width: var(--m3e-dialog-max-width, 35rem);\r\n color: var(--m3e-dialog-color, ${DesignToken.color.onSurface});\r\n background-color: var(--m3e-dialog-container-color, ${DesignToken.color.surfaceContainerHigh});\r\n visibility: hidden;\r\n opacity: 0;\r\n transform-origin: top;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n }\r\n .base::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n margin-inline-end: -20px;\r\n }\r\n .base:not([open]) {\r\n visibility: hidden;\r\n opacity: 0;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized}, \r\n transform ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized},\r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.emphasized} allow-discrete`,\r\n )};\r\n }\r\n .base[open] {\r\n visibility: visible;\r\n opacity: 1;\r\n transform: translateY(0) scaleY(1);\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized}, \r\n transform ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized},\r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.emphasized} allow-discrete`,\r\n )};\r\n }\r\n .base:not([open])::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .base[open]::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%),\r\n transparent\r\n );\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n @starting-style {\r\n .base[open] {\r\n opacity: 0;\r\n transform: translateY(-3.125rem) scaleY(0.8);\r\n }\r\n .base[open]::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n }\r\n }\r\n .header {\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n padding: 1.5rem 1.5rem 1rem 1.5rem;\r\n background-color: var(--m3e-dialog-header-container-color, transparent);\r\n }\r\n ::slotted([slot=\"header\"]) {\r\n margin: unset;\r\n flex: 1 1 auto;\r\n color: var(--m3e-dialog-header-color, inherit);\r\n font-size: var(--m3e-dialog-header-font-size, ${DesignToken.typescale.standard.headline.small.fontSize});\r\n font-weight: var(--m3e-dialog-header-font-weight, ${DesignToken.typescale.standard.headline.small.fontWeight});\r\n line-height: var(--m3e-dialog-header-line-height, ${DesignToken.typescale.standard.headline.small.lineHeight});\r\n letter-spacing: var(--m3e-dialog-header-tracking, ${DesignToken.typescale.standard.headline.small.tracking});\r\n }\r\n .content {\r\n padding-inline: 1.5rem;\r\n color: var(--m3e-dialog-content-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(--m3e-dialog-content-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-dialog-content-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-dialog-content-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-dialog-content-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n .actions {\r\n padding: 1.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 :host(:not(:state(-with-actions))) .content {\r\n margin-bottom: 1.5rem;\r\n }\r\n :host(:not(:state(-with-actions))) .actions {\r\n display: none;\r\n }\r\n .close {\r\n margin-inline-start: 0.5rem;\r\n }\r\n ::slotted([slot=\"close-icon\"]),\r\n .close-icon {\r\n width: 1em;\r\n font-size: var(--m3e-icon-button-icon-size, 1.5rem) !important;\r\n }\r\n @media (forced-colors: active) {\r\n .base:not([open])::backdrop,\r\n .base[open]::backdrop {\r\n transition: none;\r\n }\r\n .base {\r\n border-style: solid;\r\n border-width: 1px;\r\n border-color: CanvasText;\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n .base:not([open]),\r\n .base[open],\r\n .base:not([open])::backdrop,\r\n .base[open]::backdrop {\r\n transition: none;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __nextId = 0;\r\n /** @private */ #id = M3eDialogElement.__nextId++;\r\n\r\n /** @private */ #open = false;\r\n /** @private */ #escapePressedWithoutCancel = false;\r\n /** @private */ @state() private _withActions = false;\r\n /** @private */ @query(\".base\") private readonly _base!: HTMLDialogElement;\r\n /** @private */ @query(\".content\") private readonly _content!: HTMLDialogElement;\r\n\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n\r\n /**\r\n * Whether the dialog is an alert.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) alert = false;\r\n\r\n /**\r\n * Whether the dialog is open.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) get open() {\r\n return this.#open;\r\n }\r\n set open(value: boolean) {\r\n if (value === this.#open) return;\r\n this.#open = value;\r\n if (this.#open) {\r\n this.show();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /**\r\n * Whether a button is presented that can be used to close the dialog.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) dismissible = false;\r\n\r\n /**\r\n * Whether users cannot click the backdrop or press ESC to dismiss the dialog.\r\n * @default false\r\n */\r\n @property({ attribute: \"disable-close\", type: Boolean }) disableClose = false;\r\n\r\n /**\r\n * Whether to disable focus trapping, which keeps keyboard `Tab` navigation within the dialog.\r\n * @default false\r\n */\r\n @property({ attribute: \"no-focus-trap\", type: Boolean }) noFocusTrap = false;\r\n\r\n /**\r\n * The accessible label given to the button used to dismiss the dialog.\r\n * @default \"Close\"\r\n */\r\n @property({ attribute: \"close-label\" }) closeLabel = \"Close\";\r\n\r\n /**\r\n * The return value of the dialog.\r\n * @default \"\"\r\n */\r\n returnValue = \"\";\r\n\r\n /**\r\n * Asynchronously opens the dialog.\r\n * @returns {Promise<void>} A `Promise` that resolves when the dialog is open.\r\n */\r\n async show(): Promise<void> {\r\n await this.updateComplete;\r\n\r\n if (this._base.open) {\r\n return;\r\n }\r\n\r\n if (!this.dispatchEvent(new Event(\"opening\", { cancelable: true }))) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n this.#scrollLockController.lock();\r\n this._base.showModal();\r\n this._content.scrollTop = 0;\r\n const focusable = this.querySelector<HTMLElement>(\"[autofocus]\");\r\n\r\n if (focusable) {\r\n focusWhenReady(focusable);\r\n }\r\n\r\n this.dispatchEvent(new Event(\"opened\"));\r\n }\r\n\r\n /**\r\n * Asynchronously closes the dialog.\r\n * @param {string} returnValue The value to return.\r\n * @returns {Promise<void>} A `Promise` that resolves when the dialog is closed.\r\n */\r\n async hide(returnValue: string = this.returnValue): Promise<void> {\r\n if (!this.isConnected) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n await this.updateComplete;\r\n\r\n this.#scrollLockController.unlock();\r\n\r\n if (!this._base.open) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n const prevReturnValue = this.returnValue;\r\n this.returnValue = returnValue;\r\n\r\n if (!this.dispatchEvent(new Event(\"closing\", { cancelable: true }))) {\r\n this.returnValue = prevReturnValue;\r\n return;\r\n }\r\n\r\n this.open = false;\r\n this._base.close(returnValue);\r\n this.dispatchEvent(new Event(\"closed\"));\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<dialog\r\n class=\"base\"\r\n role=\"${ifDefined(this.alert ? \"alertdialog\" : undefined)}\"\r\n aria-labelledby=\"m3e-dialog-${this.#id}-header\"\r\n .returnValue=\"${this.returnValue}\"\r\n @close=\"${this.#handleClose}\"\r\n @cancel=\"${this.#handleCancel}\"\r\n @click=\"${this.#handleClick}\"\r\n @keydown=\"${this.#handleKeyDown}\"\r\n >\r\n <m3e-elevation level=\"3\"></m3e-elevation>\r\n <m3e-focus-trap ?disabled=\"${this.noFocusTrap}\">\r\n <div class=\"header\">\r\n <slot name=\"header\" id=\"m3e-dialog-${this.#id}-header\"></slot>\r\n ${this.#renderCloseButton()}\r\n </div>\r\n <m3e-scroll-container class=\"content\" dividers=\"${this._withActions ? \"above-below\" : \"above\"}\">\r\n <slot></slot>\r\n </m3e-scroll-container>\r\n <div class=\"actions\">\r\n <slot name=\"actions\" @slotchange=\"${this.#handleActionsSlotChange}\"></slot>\r\n </div>\r\n </m3e-focus-trap>\r\n </dialog>`;\r\n }\r\n\r\n /** @private */\r\n #renderCloseButton(): unknown {\r\n return !this.dismissible\r\n ? nothing\r\n : html`<m3e-icon-button aria-label=\"${this.closeLabel}\" class=\"close\" @click=\"${this.hide}\">\r\n <slot name=\"close-icon\">\r\n <svg class=\"close-icon\" viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path\r\n d=\"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z\"\r\n />\r\n </svg>\r\n </slot>\r\n </m3e-icon-button>`;\r\n }\r\n\r\n /** @private */\r\n #handleClose(): void {\r\n if (!this.#escapePressedWithoutCancel) {\r\n return;\r\n }\r\n this.#escapePressedWithoutCancel = true;\r\n this._base?.dispatchEvent(new Event(\"cancel\", { cancelable: true }));\r\n }\r\n\r\n /** @private */\r\n #handleCancel(e: Event): void {\r\n if (e.target !== this._base) return;\r\n this.#escapePressedWithoutCancel = false;\r\n e.preventDefault();\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleClick(e: Event): void {\r\n if (!this.disableClose && e.target === this._base) {\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 if (!this.disableClose) {\r\n this.hide();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleActionsSlotChange(e: Event): void {\r\n this._withActions = (<HTMLSlotElement>e.target).assignedNodes({ flatten: true }).length > 0;\r\n setCustomState(this, \"-with-actions\", this._withActions);\r\n }\r\n}\r\n\r\ninterface M3eDialogElementEventMap extends HTMLElementEventMap {\r\n opening: Event;\r\n opened: Event;\r\n closing: Event;\r\n closed: Event;\r\n cancel: Event;\r\n}\r\n\r\nexport interface M3eDialogElement {\r\n addEventListener<K extends keyof M3eDialogElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[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 M3eDialogElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDialogElement, ev: M3eDialogElementEventMap[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-dialog\": M3eDialogElement;\r\n }\r\n}\r\n","import { ActionElementBase, customElement, HtmlFor } from \"@m3e/web/core\";\r\n\r\nimport { M3eDialogElement } from \"./DialogElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to open a dialog.\r\n * @tag m3e-dialog-trigger\r\n */\r\n@customElement(\"m3e-dialog-trigger\")\r\nexport class M3eDialogTriggerElement extends HtmlFor(ActionElementBase) {\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override _onClick(): void {\r\n if (this.control instanceof M3eDialogElement) {\r\n this.control.show();\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-dialog-trigger\": M3eDialogTriggerElement;\r\n }\r\n}\r\n"],"names":["M3eDialogActionElement","ActionElementBase","constructor","this","returnValue","_onClick","closest","hide","__decorate","property","attribute","prototype","customElement","M3eDialogElement","AttachInternals","LitElement","_M3eDialogElement_id","set","M3eDialogElement_1","__nextId","_M3eDialogElement_open","_M3eDialogElement_escapePressedWithoutCancel","_withActions","_M3eDialogElement_scrollLockController","ScrollLockController","alert","dismissible","disableClose","noFocusTrap","closeLabel","open","__classPrivateFieldGet","value","__classPrivateFieldSet","show","updateComplete","_base","dispatchEvent","Event","cancelable","lock","showModal","_content","scrollTop","focusable","querySelector","focusWhenReady","isConnected","unlock","prevReturnValue","close","render","html","ifDefined","undefined","_M3eDialogElement_instances","_M3eDialogElement_handleClose","_M3eDialogElement_handleCancel","_M3eDialogElement_handleClick","_M3eDialogElement_handleKeyDown","_M3eDialogElement_renderCloseButton","call","_M3eDialogElement_handleActionsSlotChange","nothing","e","target","preventDefault","key","shiftKey","ctrlKey","assignedNodes","flatten","length","setCustomState","styles","css","DesignToken","shape","corner","extraLarge","color","onSurface","surfaceContainerHigh","scrim","unsafeCSS","motion","duration","short3","easing","emphasized","long2","standard","typescale","headline","small","fontSize","fontWeight","lineHeight","tracking","onSurfaceVariant","body","medium","state","query","type","Boolean","reflect","M3eDialogTriggerElement","HtmlFor","connectedCallback","super","parentElement","ariaHasPopup","disconnectedCallback","control"],"mappings":";;;;;yhBAaO,IAAMA,EAAN,cAAqCC,EAArCC,WAAAA,uBAKoCC,KAAAC,YAAc,EAMzD,CAHqBC,QAAAA,GACjBF,KAAKG,QAAQ,eAAeC,KAAKJ,KAAKC,YACxC,+BALyCI,EAAA,CAAxCC,EAAS,CAAEC,UAAW,kBAAmCV,EAAAW,UAAA,mBAAA,GAL/CX,EAAsBQ,EAAA,CADlCI,EAAc,sBACFZ,GCkEN,IAAMa,IAAN,cAA+BC,EAAgBC,IAA/Cb,WAAAA,mCAwJWc,EAAAC,IAAAd,KAAMe,EAAiBC,YAEvBC,EAAAH,IAAAd,MAAQ,GACRkB,EAAAJ,IAAAd,MAA8B,GACbA,KAAAmB,cAAe,EAIvBC,EAAAN,IAAAd,KAAwB,IAAIqB,EAAqBrB,OAM7CA,KAAAsB,OAAQ,EAuBRtB,KAAAuB,aAAc,EAMcvB,KAAAwB,cA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H,o1BAkDrErF,EAAAM,SAAW,EAKTX,EAAA,CAAhB8F,KAAqCzF,EAAAF,UAAA,uBACLH,EAAA,CAAhC+F,EAAM,UAAoD1F,EAAAF,UAAA,gBACvBH,EAAA,CAAnC+F,EAAM,aAA0D1F,EAAAF,UAAA,mBAQpDH,EAAA,CAA5BC,EAAS,CAAE+F,KAAMC,WAAyB5F,EAAAF,UAAA,aAAA,GAMCH,EAAA,CAA3CC,EAAS,CAAE+F,KAAMC,QAASC,SAAS,KAEnC7F,EAAAF,UAAA,OAAA,MAe4BH,EAAA,CAA5BC,EAAS,CAAE+F,KAAMC,WAA+B5F,EAAAF,UAAA,mBAAA,GAMQH,EAAA,CAAxDC,EAAS,CAAEC,UAAW,gBAAiB8F,KAAMC,WAAgC5F,EAAAF,UAAA,oBAAA,GAMrBH,EAAA,CAAxDC,EAAS,CAAEC,UAAW,gBAAiB8F,KAAMC,WAA+B5F,EAAAF,UAAA,mBAAA,GAMrCH,EAAA,CAAvCC,EAAS,CAAEC,UAAW,iBAAsCG,EAAAF,UAAA,kBAAA,GA/MlDE,EAAgBK,EAAAV,EAAA,CAD5BI,EAAc,eACFC,GCtEN,IAAM8F,EAAN,cAAsCC,EAAQ3G,IAE1C4G,iBAAAA,GACPC,MAAMD,oBAEF1G,KAAK4G,gBACP5G,KAAK4G,cAAcC,aAAe,SAEtC,CAGSC,oBAAAA,GACPH,MAAMG,uBAEF9G,KAAK4G,gBACP5G,KAAK4G,cAAcC,aAAe,KAEtC,CAGS3G,QAAAA,GACHF,KAAK+G,mBAAmBrG,GAC1BV,KAAK+G,QAAQhF,MAEjB,GAxBWyE,EAAuBnG,EAAA,CADnCI,EAAc,uBACF+F"}
@@ -6,7 +6,7 @@
6
6
  import { __decorate, __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
7
7
  import { css, LitElement, html, unsafeCSS, nothing } from 'lit';
8
8
  import { property, query } from 'lit/decorators.js';
9
- import { DesignToken, customElement, KeyboardClick, Focusable, Disabled, AttachInternals, Role, EventAttribute, ReconnectedCallback, setCustomState, hasAssignedNodes } from '@m3e/web/core';
9
+ import { DesignToken, customElement, KeyboardClick, Focusable, Disabled, AttachInternals, Role, ReconnectedCallback, setCustomState, hasAssignedNodes } from '@m3e/web/core';
10
10
  import { M3eDirectionality } from '@m3e/web/core/bidi';
11
11
 
12
12
  var _M3eAccordionElement_instances, _M3eAccordionElement_panels, _M3eAccordionElement_handleSlotChange, _M3eAccordionElement_handleOpening;
@@ -294,7 +294,7 @@ var M3eExpansionPanelElement_1;
294
294
  * @cssprop --m3e-expansion-panel-actions-divider-thickness - Thickness of the divider above actions.
295
295
  * @cssprop --m3e-expansion-panel-actions-divider-color - Color of the divider above actions.
296
296
  */
297
- let M3eExpansionPanelElement = M3eExpansionPanelElement_1 = class M3eExpansionPanelElement extends EventAttribute(Disabled(ReconnectedCallback(AttachInternals(LitElement, true))), "opening", "opened", "closing", "closed") {
297
+ let M3eExpansionPanelElement = M3eExpansionPanelElement_1 = class M3eExpansionPanelElement extends Disabled(ReconnectedCallback(AttachInternals(LitElement, true))) {
298
298
  constructor() {
299
299
  super(...arguments);
300
300
  _M3eExpansionPanelElement_instances.add(this);