@aceshooting/lyra-ui 32.1.0 → 33.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/CHANGELOG.md +224 -1583
  2. package/README.md +12 -1
  3. package/custom-elements.slim.json +1 -0
  4. package/dist/accent-roles.css +1 -0
  5. package/dist/cli/migrate-wa.mjs +50 -48
  6. package/dist/cli/migration-contract.json.gz +0 -0
  7. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +1 -1
  8. package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +10 -0
  9. package/dist/components/conversation/code-block/code-block-base.class.d.ts +3 -1
  10. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  11. package/dist/components/conversation/code-block/code-block-core.class.d.ts +1 -1
  12. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  13. package/dist/components/conversation/code-block/code-block.class.d.ts +3 -2
  14. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  15. package/dist/components/conversation/code-block/code-grammar-registry.d.ts +35 -0
  16. package/dist/components/conversation/code-block/code-grammar-registry.js +1 -0
  17. package/dist/components/conversation/model-select/model-select.class.d.ts +8 -7
  18. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +1 -1
  19. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +1 -1
  20. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +8 -7
  21. package/dist/components/data/table/table-support.d.ts +2 -3
  22. package/dist/components/data/table/table.class.d.ts +2 -1
  23. package/dist/components/data/timeline/timeline.class.d.ts +17 -6
  24. package/dist/components/data/timeline/timeline.class.js +2 -2
  25. package/dist/components/data/timeline/timeline.styles.js +1 -1
  26. package/dist/components/forms/catalog-picker-base.d.ts +14 -1
  27. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  28. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +4 -5
  29. package/dist/components/forms/checkbox-group/checkbox-group.styles.js +1 -1
  30. package/dist/components/forms/code-editor/code-editor.class.d.ts +14 -5
  31. package/dist/components/forms/code-editor/code-editor.styles.js +1 -1
  32. package/dist/components/forms/color-picker/color-picker.class.d.ts +18 -7
  33. package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
  34. package/dist/components/forms/combobox/combobox-option-html.js +1 -0
  35. package/dist/components/forms/combobox/combobox.class.d.ts +30 -9
  36. package/dist/components/forms/combobox/combobox.class.js +110 -21
  37. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  38. package/dist/components/forms/country-picker/country-picker.class.d.ts +4 -5
  39. package/dist/components/forms/currency-picker/currency-picker.class.d.ts +4 -5
  40. package/dist/components/forms/date-picker/date-input.class.d.ts +14 -5
  41. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  42. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +10 -0
  43. package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
  44. package/dist/components/forms/icon-button/icon-button.class.d.ts +2 -1
  45. package/dist/components/forms/input/input-shared.d.ts +14 -5
  46. package/dist/components/forms/input/time-input.class.d.ts +15 -6
  47. package/dist/components/forms/input/time-input.styles.js +1 -1
  48. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +8 -7
  49. package/dist/components/forms/otp-input/otp-input.class.d.ts +4 -5
  50. package/dist/components/forms/otp-input/otp-input.styles.js +1 -1
  51. package/dist/components/forms/phone-input/phone-input.class.d.ts +14 -5
  52. package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
  53. package/dist/components/forms/radio/radio-group.class.d.ts +4 -5
  54. package/dist/components/forms/radio/radio-group.styles.js +1 -1
  55. package/dist/components/forms/radio/radio.class.js +2 -2
  56. package/dist/components/forms/select/select.class.d.ts +5 -6
  57. package/dist/components/forms/signature-pad/signature-pad.class.d.ts +4 -5
  58. package/dist/components/forms/signature-pad/signature-pad.styles.js +1 -1
  59. package/dist/components/forms/slider/slider.class.d.ts +6 -5
  60. package/dist/components/forms/slider/slider.styles.js +1 -1
  61. package/dist/components/forms/textarea/textarea.class.d.ts +14 -5
  62. package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +4 -5
  63. package/dist/components/forms/token-input/token-input.class.d.ts +10 -10
  64. package/dist/components/forms/token-input/token-input.class.js +1 -1
  65. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  66. package/dist/components/forms/unit-picker/unit-picker.class.d.ts +4 -5
  67. package/dist/components/layout/command-palette/command-palette.class.d.ts +1 -1
  68. package/dist/components/layout/menu/menu.class.d.ts +1 -1
  69. package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.d.ts +1 -1
  70. package/dist/components/layout/segmented/segmented.class.d.ts +2 -2
  71. package/dist/components/layout/stepper/step.class.d.ts +14 -1
  72. package/dist/components/layout/stepper/step.class.js +2 -2
  73. package/dist/components/media/file-input/file-input.class.d.ts +2 -1
  74. package/dist/components/media/file-input/file-input.class.js +1 -1
  75. package/dist/components/media/file-input/file-input.styles.js +1 -1
  76. package/dist/components/media/lightbox/lightbox-item.class.d.ts +10 -0
  77. package/dist/components/media/lightbox/lightbox-item.class.js +1 -1
  78. package/dist/components/media/lightbox/lightbox-source.js +1 -1
  79. package/dist/components/media/lightbox/lightbox-types.d.ts +4 -1
  80. package/dist/components/media/lightbox/lightbox.class.d.ts +42 -19
  81. package/dist/components/media/lightbox/lightbox.class.js +4 -3
  82. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  83. package/dist/components/overlays/context-menu/context-menu.class.d.ts +1 -1
  84. package/dist/components/overlays/dialog/dialog.class.d.ts +19 -3
  85. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  86. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  87. package/dist/components/overlays/drawer/drawer.class.d.ts +8 -2
  88. package/dist/components/overlays/drawer/drawer.class.js +1 -1
  89. package/dist/components/overlays/overlay/dropdown.class.d.ts +1 -1
  90. package/dist/components/overlays/overlay/overlay.styles.js +1 -1
  91. package/dist/components/overlays/overlay/popover.class.d.ts +1 -1
  92. package/dist/components/overlays/overlay/popover.class.js +1 -1
  93. package/dist/components/overlays/overlay/tooltip.class.d.ts +5 -0
  94. package/dist/components/overlays/overlay/tooltip.class.js +2 -2
  95. package/dist/components/overlays/toast/toast-item.class.d.ts +2 -2
  96. package/dist/components/overlays/toast/toast-item.styles.js +1 -1
  97. package/dist/components/retrieval/citation-badge/citation-badge.class.d.ts +1 -1
  98. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +1 -1
  99. package/dist/components/utility/copy-button/copy-button.class.d.ts +2 -1
  100. package/dist/components/utility/copy-button/copy-button.class.js +1 -1
  101. package/dist/components/utility/export-button/export-button.class.d.ts +1 -1
  102. package/dist/components/utility/icon/icon-library-bootstrap.d.ts +50 -0
  103. package/dist/components/utility/icon/icon-library-bootstrap.js +1 -0
  104. package/dist/components/utility/icon/icon-library-font-awesome.d.ts +68 -0
  105. package/dist/components/utility/icon/icon-library-font-awesome.js +1 -0
  106. package/dist/components/utility/known-date/known-date.class.d.ts +10 -0
  107. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +1 -1
  108. package/dist/components/utility/number-ticker/number-ticker.class.d.ts +10 -2
  109. package/dist/components/utility/number-ticker/number-ticker.class.js +1 -1
  110. package/dist/components/utility/tour/tour.class.d.ts +1 -1
  111. package/dist/framework-types.d.ts +1 -1
  112. package/dist/internal/accessibility-visibility.js +1 -1
  113. package/dist/internal/autoloader-manifest.js +1 -1
  114. package/dist/internal/declarative-overlay-action.js +1 -0
  115. package/dist/internal/default-strings/forms.generated.js +1 -1
  116. package/dist/internal/document-token-css.generated.js +10 -0
  117. package/dist/internal/document-tokens.generated.js +2 -11
  118. package/dist/internal/document-tokens.js +2 -2
  119. package/dist/internal/dom-guards.js +1 -1
  120. package/dist/internal/external-label-association.js +1 -0
  121. package/dist/internal/focus-navigation.js +1 -1
  122. package/dist/internal/form-control/chrome.styles.js +1 -1
  123. package/dist/internal/form-control-labels.js +1 -1
  124. package/dist/internal/localization-runtime.js +1 -1
  125. package/dist/internal/localization-types.d.ts +1 -1
  126. package/dist/internal/localization.js +1 -1
  127. package/dist/internal/lyra-element.d.ts +11 -2
  128. package/dist/internal/lyra-element.js +2 -2
  129. package/dist/internal/package-metadata.js +1 -1
  130. package/dist/internal/theme-observation.js +1 -1
  131. package/dist/lyra.d.ts +1 -1
  132. package/dist/lyra.js +1 -1
  133. package/dist/styles/tokens-root.css +1 -1
  134. package/dist/styles/utilities.css +1 -1
  135. package/dist/theme-core.css +1 -1
  136. package/dist/theme.css +1 -1
  137. package/llms/components/lr-checkbox-group.md +2 -2
  138. package/llms/components/lr-citation-badge.md +1 -1
  139. package/llms/components/lr-code-block-core.md +3 -1
  140. package/llms/components/lr-code-block.md +14 -0
  141. package/llms/components/lr-code-editor.md +2 -2
  142. package/llms/components/lr-color-picker.md +4 -4
  143. package/llms/components/lr-combobox.md +21 -5
  144. package/llms/components/lr-context-menu.md +1 -1
  145. package/llms/components/lr-copy-button.md +4 -3
  146. package/llms/components/lr-country-picker.md +2 -2
  147. package/llms/components/lr-currency-picker.md +2 -2
  148. package/llms/components/lr-date-input.md +1 -1
  149. package/llms/components/lr-date-picker.md +1 -1
  150. package/llms/components/lr-dialog.md +30 -2
  151. package/llms/components/lr-drawer.md +7 -1
  152. package/llms/components/lr-entity-chip.md +1 -1
  153. package/llms/components/lr-export-button.md +1 -1
  154. package/llms/components/lr-file-input.md +1 -1
  155. package/llms/components/lr-icon.md +96 -0
  156. package/llms/components/lr-input.md +2 -2
  157. package/llms/components/lr-lightbox.md +43 -17
  158. package/llms/components/lr-locale-picker.md +2 -2
  159. package/llms/components/lr-mention-popover.md +1 -1
  160. package/llms/components/lr-menu.md +1 -1
  161. package/llms/components/lr-model-select.md +4 -4
  162. package/llms/components/lr-native-time-input.md +2 -2
  163. package/llms/components/lr-number-input.md +2 -2
  164. package/llms/components/lr-number-ticker.md +7 -2
  165. package/llms/components/lr-otp-input.md +2 -2
  166. package/llms/components/lr-phone-input.md +2 -2
  167. package/llms/components/lr-popover.md +1 -1
  168. package/llms/components/lr-radio-group.md +2 -2
  169. package/llms/components/lr-segmented.md +1 -1
  170. package/llms/components/lr-select.md +3 -3
  171. package/llms/components/lr-selection-toolbar.md +1 -1
  172. package/llms/components/lr-signature-pad.md +2 -2
  173. package/llms/components/lr-slider.md +1 -1
  174. package/llms/components/lr-step.md +7 -1
  175. package/llms/components/lr-textarea.md +2 -2
  176. package/llms/components/lr-time-input.md +3 -3
  177. package/llms/components/lr-time-zone-picker.md +2 -2
  178. package/llms/components/lr-timeline.md +12 -5
  179. package/llms/components/lr-toast.md +1 -1
  180. package/llms/components/lr-token-input.md +10 -9
  181. package/llms/components/lr-tool-call-chip.md +1 -1
  182. package/llms/components/lr-tooltip.md +5 -0
  183. package/llms/components/lr-unit-picker.md +2 -2
  184. package/llms/components/lr-usage-badge.md +1 -1
  185. package/llms/components/lr-voice-picker.md +4 -3
  186. package/llms/index.md +115 -115
  187. package/llms/migration.md +87 -8
  188. package/llms/peers.md +2 -2
  189. package/llms/shared/forms-and-accessibility.md +4 -1
  190. package/llms/shared/frameworks-and-ssr.md +10 -1
  191. package/llms/shared/imports-and-registration.md +8 -1
  192. package/llms/shared/localization-and-rtl.md +5 -0
  193. package/llms/shared/native-styles-and-utilities.md +34 -5
  194. package/llms/shared/styles-and-tokens.md +58 -4
  195. package/llms/shared/testing-and-utilities.md +9 -0
  196. package/llms/shared.md +128 -12
  197. package/locales.json +1 -1
  198. package/package.json +14 -5
  199. package/registrations.json +1 -1
  200. package/skills/compose-lyra-interfaces/SKILL.md +1 -1
  201. package/skills/lyra-ui/SKILL.md +1 -1
  202. package/skills/lyra-ui/commands/migrate.md +1 -1
@@ -3,7 +3,9 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
3
3
  * Reason a dialog was dismissed, forwarded as the `lr-close` event
4
4
  * detail. `'escape'` and `'backdrop'` are emitted by the dialog's own built-in
5
5
  * dismiss triggers; `'close-button'` by the built-in header close button
6
- * (rendered unless `without-close-button` is set); `'unmount'` is emitted when the dialog is
6
+ * (rendered unless `without-close-button` is set); `'close-action'` by an activated descendant
7
+ * carrying the declarative close attribute (`data-dialog="close"`, or `data-drawer="close"` inside
8
+ * `<lr-drawer>`); `'unmount'` is emitted when the dialog is
7
9
  * removed from the DOM while still open by something other than its own
8
10
  * `close()` (e.g. a consumer's own cleanup code, or a parent re-render that
9
11
  * drops it); any other string is whatever a caller passes to `close()` (e.g. a
@@ -73,6 +75,18 @@ export interface LyraDialogCloseDetail{reason:DialogCloseReason;}export interfac
73
75
  * neither `heading` nor the `label` slot is set) and closes the dialog via the same `close()` path
74
76
  * as Escape/backdrop-dismiss, with reason `'close-button'`; `without-close-button` removes it.
75
77
  *
78
+ * Declarative actions open and close the dialog from markup alone. Activating any element with
79
+ * `data-dialog="open <id>"` (a click, so keyboard activation of a button counts) opens the
80
+ * `<lr-dialog>` with that `id`, looked up in the trigger's own shadow root or document first and
81
+ * then in its document; an `id` that matches nothing, or matches something other than a dialog,
82
+ * is ignored. Activating a descendant with `data-dialog="close"` -- including one inside a
83
+ * descendant's open shadow root -- closes the nearest owning dialog with reason `'close-action'`
84
+ * and the action as the `lr-hide` `source`; a nested dialog consumes its own close action. Both run
85
+ * the ordinary `show()`/close lifecycle, so `lr-show`, `lr-hide` and `lr-close-request` can veto
86
+ * them. A disabled, `aria-disabled="true"` or inert action does nothing, as does a click whose
87
+ * default was already prevented. One delegated document listener serves every dialog and drawer
88
+ * and is removed once the last of them disconnects.
89
+ *
76
90
  * The `body` part is the element that scrolls, so it carries `tabindex="0"` only while it
77
91
  * actually overflows; a short body keeps `tabindex="-1"`. A dialog holding only prose, a table,
78
92
  * or a rendered document would otherwise have no keyboard stop at all and its content would be
@@ -221,7 +235,7 @@ export interface LyraDialogCloseDetail{reason:DialogCloseReason;}export interfac
221
235
  * @cssprop [--lr-overlay-border=var(--lr-color-border-subtle)] - Shared floating-surface edge
222
236
  * colour, on the panel and, unless `--lr-dialog-divider-color` is set, on the header's and
223
237
  * footer's dividing rules.
224
- * @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner radius, on the
238
+ * @cssprop [--lr-overlay-radius=var(--lr-radius-container)] - Shared floating-surface corner radius, on the
225
239
  * panel and on the close button.
226
240
  * @cssprop [--lr-overlay-shadow-modal=var(--lr-shadow-xl)] - Elevation of a modal panel. A separate
227
241
  * tier from `--lr-overlay-shadow-anchored`, so raising popups never raises dialogs.
@@ -291,7 +305,9 @@ withLabel:boolean;private hasFooterSlot;private hasLabelSlot;private hasHeaderAc
291
305
  * ownership without changing its logical `open` state; deactivation restores it. */
292
306
  modal:LyraDialogModalController;
293
307
  /** Drawer overrides this for its nonmodal `contained` mode.*/
294
- protected get modalSurface():boolean;private syncFullscreenQuery;protected willUpdate(changed:PropertyValues):void;private flushPendingScrollLockRelease;protected updated(changed:PropertyValues):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private headingChanged;private armHeadingObserver;private resetHeadingObserver;private syncBodyTabIndex;private armBodyOverflowObserver;private resetBodyOverflowObserver;private defaultSlotElements;
308
+ protected get modalSurface():boolean;
309
+ /** The `data-*` attribute that addresses this overlay declaratively; drawer answers `'drawer'`.*/
310
+ protected get declarativeKind():'dialog'|'drawer';private releaseDeclarativeActions?;private syncFullscreenQuery;protected willUpdate(changed:PropertyValues):void;private flushPendingScrollLockRelease;protected updated(changed:PropertyValues):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private headingChanged;private armHeadingObserver;private resetHeadingObserver;private syncBodyTabIndex;private armBodyOverflowObserver;private resetBodyOverflowObserver;private defaultSlotElements;
295
311
  /** Whether an external-removal hide request can preserve open state for a later reconnect.*/
296
312
  protected get disconnectHideCancelable():boolean;private onDefaultSlotChange;private onFooterSlotChange;private detectLightDomChrome;
297
313
  /**
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{OwnedMutationObserver,OwnedResizeObserver}from"../../../internal/owned-observer.js";import{ModalOpenRequest}from"../../../internal/modal-open-request.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{ModalSurfaceController}from"../../../internal/modal-surface-controller.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{html,isServer,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{activateOverlay,collectFocusableElements,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{cancelDeferredFocusReturn,captureFocusReturnOpener,scheduleDeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityText,composedAccessibilityTextResult,observeAccessibleTextReferences,releaseAccessibleTextReferences,isAccessibilitySubtreeExcluded}from"../../../internal/accessibility-visibility.js";import{closeIcon}from"../../../internal/icons.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{styles}from"./dialog.styles.js";import{LYRA_DEFAULT_close}from"../../../internal/default-strings/shared.generated.js";const HEADING_SELECTOR='h1, h2, h3, h4, h5, h6, [role="heading"]',FULLSCREEN_NARROW_QUERY="(max-width: 40rem)";class LyraDialog extends LyraElement{static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close}}constructor(){super(),this._open=!1,this.label="",this.headingLevel="3",this.withoutCloseButton=!1,this.withoutHeader=!1,this.noHeader=!1,this.fillBody=!1,this.fullscreenNarrow=!1,this.withFooter=!1,this.size="m",this.hostAriaLabel=null,this.lightDismiss=!1,this.withLabel=!1,this.hasFooterSlot=!1,this.hasLabelSlot=!1,this.hasHeaderActionsSlot=!1,this.focusReturnOpener=null,this.nativeModal=new NativeModalCarrier(this,{onCancel:event=>this.onNativeCancel(event),onUnexpectedClose:carrier=>{!this.open||!this.modalSurface||(this.closeFrom("api",carrier),this.open&&this.enterTopLayer())}}),this.modalPresentation=new ModalSurfaceController(this,this.nativeModal),this.hostDescription=new HostDescriptionController(this,()=>this.renderRoot.querySelector('[role="dialog"]')),this.headingObserver=new OwnedMutationObserver(this,()=>this.headingChanged()),this.bodyOverflowObserver=new OwnedResizeObserver(this,()=>this.syncBodyTabIndex()),this.transitionToken=0,this.openRequest=new ModalOpenRequest,this.transitionAnimations=[],this.headingId=nextId("dialog-heading"),this.externalModalDepth=0,this.modal={activateExternal:()=>{this.externalModalDepth++,this.externalModalDepth===1&&this.overlay?.suspend()},deactivateExternal:()=>{this.externalModalDepth!==0&&(this.externalModalDepth--,this.externalModalDepth===0&&this.open&&this.modalSurface&&(this.overlay?.resume(),queueMicrotask(()=>this.focusInitial())))}},this.onDefaultSlotChange=()=>{this.detectLightDomChrome(),this.syncBodyTabIndex(),this.resetBodyOverflowObserver(),this.armBodyOverflowObserver()},this.onFooterSlotChange=()=>{this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer")},this.onNativeCancel=event=>{if(event.preventDefault(),!this.open||!this.overlay?.isTopmost())return;const panel=this.renderRoot.querySelector('[part~="panel"]')??this;this.requestClose("keyboard","escape",panel)},this.onBackdropClick=()=>{this.lightDismiss&&this.overlay?.dismissBackdrop()},this.onCloseButtonClick=()=>{const button=this.renderRoot.querySelector('[part~="close-button"]')??this;this.requestClose("close-button","close-button",button)},new GlassScrollLayer(this,'[part~="panel"]',()=>this.open)}static{this.styles=[LyraElement.styles,styles,nativeModalCarrierStyles]}get open(){return this._open}set open(next){const normalized=!!next;if(!this.openRequest.coalesce(normalized)&&normalized!==this._open){if(!this.hasUpdated){this.applyOpenState(normalized);return}normalized?this.show():this.close("api")}}get modalSurface(){return!0}syncFullscreenQuery(){this.releaseFullscreenQuery?.(),this.releaseFullscreenQuery=void 0;const view=this.ownerDocument?.defaultView;if(!this.fullscreenNarrow||!this.isConnected||typeof view?.matchMedia!="function"){this.removeAttribute("data-fullscreen");return}const query=view.matchMedia(FULLSCREEN_NARROW_QUERY),apply=()=>{this.toggleAttribute("data-fullscreen",query.matches)};query.addEventListener("change",apply),this.releaseFullscreenQuery=()=>query.removeEventListener("change",apply),apply()}willUpdate(changed){if(super.willUpdate(changed),changed.has("fullscreenNarrow")&&this.syncFullscreenQuery(),(!this.hasUpdated||changed.has("open")&&this.open)&&(this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer"),this.detectLightDomChrome()),this.open&&(changed.has("open")||changed.has("contained"))&&this.nativeModal.prepare(this.modalSurface),changed.has("open")){if(this.flushPendingScrollLockRelease(),this.open)cancelDeferredFocusReturn(this),this.focusReturnOpener=captureFocusReturnOpener(this),this.isConnected&&this.modalSurface&&this.activateOverlay();else{this.modalPresentation.beginClose();const returnsFocus=this.overlay!==void 0||composedContains(this,deepActiveElement(this.ownerDocument));this.pendingScrollLockRelease=this.deactivateOverlay({deferScrollLockRelease:!0});const opener=this.focusReturnOpener;this.focusReturnOpener=null,returnsFocus&&opener&&this.isConnected&&scheduleDeferredFocusReturn({host:this,candidates:()=>[opener],settled:this.hideSettled,isCurrent:()=>!this.open})}this.hideSettled=void 0}}flushPendingScrollLockRelease(){const release=this.pendingScrollLockRelease;this.pendingScrollLockRelease=void 0,release?.()}updated(changed){super.updated(changed),changed.has("open")&&this.armHeadingObserver(),this.syncBodyTabIndex(),this.armBodyOverflowObserver(),changed.has("open")&&this.open&&this.isConnected&&(this.modalSurface&&(this.enterTopLayer(),this.focusInitial()),queueMicrotask(()=>{this.open&&this.isConnected&&this.detectLightDomChrome()}))}connectedCallback(){super.connectedCallback(),this.syncFullscreenQuery(),this.armHeadingObserver(),this.syncBodyTabIndex(),this.armBodyOverflowObserver(),this.hasUpdated&&this.open&&(this.modalSurface&&(this.overlay?.isActive()?this.externalModalDepth===0&&this.overlay.resume():this.activateOverlay(),this.enterTopLayer()),queueMicrotask(()=>{!this.open||!this.isConnected||(this.detectLightDomChrome(),this.modalSurface&&this.focusInitial())}))}disconnectedCallback(){this.releaseFullscreenQuery?.(),this.releaseFullscreenQuery=void 0,this.removeAttribute("data-fullscreen"),this.resetHeadingObserver(),this.resetBodyOverflowObserver(),super.disconnectedCallback(),this.modalPresentation.disconnect(),this.overlay?.suspend(),cancelDeferredFocusReturn(this),this.transitionToken++,this.flushPendingScrollLockRelease(),this.cancelTransitionAnimations(),this.removeAttribute("data-closing"),this.open&&queueMicrotask(()=>{if(!this.isConnected&&this.open){if(this.emit("lr-hide",{source:this},{cancelable:this.disconnectHideCancelable}).defaultPrevented){this.syncOpenAttribute();return}this.applyOpenState(!1),this.emit("lr-close",{reason:"unmount"}),this.emit("lr-after-hide")}})}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted(),this.resetHeadingObserver(),this.resetBodyOverflowObserver(),this.isConnected&&(this.armHeadingObserver(),this.armBodyOverflowObserver(),this.syncBodyTabIndex())}headingChanged(){this.detectLightDomChrome(),this.syncBodyTabIndex(),this.resetHeadingObserver(),this.armHeadingObserver()}armHeadingObserver(){if(!this.isConnected||this.headingObserver.active&&this.headingObserverOpen===this.open)return;this.resetHeadingObserver();const observer=this.headingObserver;if(this.headingObserverOpen=this.open,observer.observe(this,{childList:!0}),this.open){for(const child of this.children)observer.observe(child,{attributes:!0,attributeFilter:["slot"]});const heading=Array.from(this.children).find(child=>child.getAttribute("slot")===null&&child.matches(HEADING_SELECTOR));if(!heading)return;observer.observe(heading,{attributes:!0,attributeFilter:["aria-label","aria-labelledby","aria-hidden","hidden","inert","class","style","slot"],characterData:!0,childList:!0,subtree:!0}),heading.hasAttribute("aria-labelledby")&&(this.headingReferences={releases:[],changed:()=>this.headingChanged()},observeAccessibleTextReferences(observer,heading,composedAccessibilityTextResult(heading,{ancestorBoundary:this,requireRendered:!1}),this.headingReferences))}}resetHeadingObserver(){this.headingReferences&&releaseAccessibleTextReferences(this.headingReferences),this.headingReferences=void 0,this.headingObserver.clear(),this.headingObserverOpen=void 0}syncBodyTabIndex(){const body=this.renderRoot?.querySelector('[part="body"]');if(!body)return;const next=this.open&&(body.scrollHeight>body.clientHeight&&body.scrollHeight>0||body.scrollWidth>body.clientWidth&&body.scrollWidth>0)?0:-1;body.tabIndex!==next&&(body.tabIndex=next)}armBodyOverflowObserver(){const body=this.renderRoot?.querySelector('[part="body"]');if(!body||!this.isConnected||this.bodyOverflowObservedBody===body)return;this.resetBodyOverflowObserver();const observer=this.bodyOverflowObserver;this.bodyOverflowObservedBody=body,observer.observe(body);for(const element of this.defaultSlotElements())observer.observe(element)}resetBodyOverflowObserver(){this.bodyOverflowObserver.clear(),this.bodyOverflowObservedBody=void 0}defaultSlotElements(){return this.renderRoot?.querySelector('[part="body"] slot:not([name])')?.assignedElements({flatten:!0})??[]}get disconnectHideCancelable(){return!1}detectLightDomChrome(){const children=Array.from(this.children),heading=children.find(el=>el.getAttribute("slot")===null&&el.matches(HEADING_SELECTOR));!heading||isAccessibilitySubtreeExcluded(heading)?this.headingText=void 0:heading.hasAttribute("aria-label")?this.headingText=heading.getAttribute("aria-label")??"":heading.hasAttribute("aria-labelledby")?this.headingText=composedAccessibilityText(heading,{ancestorBoundary:this}).trim()||void 0:this.headingText=composedAccessibilityText(Array.from(heading.childNodes),{ancestorBoundary:heading}).trim()||void 0,this.hasLabelSlot=children.some(el=>el.getAttribute("slot")==="label"),this.hasHeaderActionsSlot=children.some(el=>el.getAttribute("slot")==="header-actions")}show(){if(this.openRequest.coalesce(!0)||this._open)return Promise.resolve();this.openRequest.begin(!0);const prevented=this.emit("lr-show",null,{cancelable:!0}).defaultPrevented,superseded=this.openRequest.superseded(!0);return this.openRequest.finish(),prevented||superseded?(this.syncOpenAttribute(),Promise.resolve()):(this.cancelTransitionAnimations(),this.removeAttribute("data-closing"),this.applyOpenState(!0),this.settleTransition("lr-after-show"))}hide(){return this.close("api")}close(reason="api"){return this.closeFrom(reason,this)}closeFrom(reason,source){if(this.openRequest.coalesce(!1)||!this._open)return Promise.resolve();if(this.openRequest.begin(!1),this.emit("lr-hide",{source},{cancelable:!0}).defaultPrevented||this.openRequest.superseded(!1))return this.openRequest.finish(),this.syncOpenAttribute(),Promise.resolve();if(this.emit("lr-close-request",{reason},{cancelable:!0}).defaultPrevented||this.openRequest.superseded(!1))return this.openRequest.finish(),this.syncOpenAttribute(),Promise.resolve();this.openRequest.finish(),this.cancelTransitionAnimations(),this.isConnected&&this.setAttribute("data-closing",""),this.applyOpenState(!1);const settled=this.settleTransition("lr-after-hide");return this.hideSettled=settled,this.emit("lr-close",{reason}),settled}applyOpenState(next){const old=this._open;this._open=next,next&&(this.initialFocusDecision=void 0),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}panelAnimationName(showing){return showing?"dialog.show":"dialog.hide"}overlayAnimationName(showing){return showing?"dialog.overlay.show":"dialog.overlay.hide"}panelAnimationSpec(showing){const offset="translateY(calc(-1 * var(--lr-size-0-5rem)))";return{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-panel-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]}}overlayAnimationSpec(showing){return{keyframes:showing?[{opacity:0},{opacity:1}]:[{opacity:1},{opacity:0}],durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-backdrop-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]}}cancelTransitionAnimations(){for(const animation of this.transitionAnimations)animation.cancel();this.transitionAnimations=[]}async settleTransition(event){const token=++this.transitionToken;if(await this.updateComplete,this.transitionToken===token){if(this.isConnected){const root=this.renderRoot,panel=root.querySelector('[part~="panel"]'),backdrop=root.querySelector('[part~="backdrop"]'),showing=event==="lr-after-show",animations=[panel?animateRegistered(this,panel,this.panelAnimationName(showing),this.effectiveDirection,this.panelAnimationSpec(showing)):void 0,this.modalSurface&&backdrop?animateRegistered(this,backdrop,this.overlayAnimationName(showing),this.effectiveDirection,this.overlayAnimationSpec(showing)):void 0].filter(animation=>animation!==void 0);if(this.transitionAnimations=animations,await Promise.all(animations.map(animation=>animation.finished.catch(()=>{}))),this.transitionToken!==token)return;this.cancelTransitionAnimations()}event==="lr-after-hide"&&(this.removeAttribute("data-closing"),this.leaveTopLayer(),this.flushPendingScrollLockRelease()),this.emit(event)}}enterTopLayer(){this.externalModalDepth===0&&this.overlay?.resume(),this.modalPresentation.show()}leaveTopLayer(){this.modalPresentation.hide()}requestClose(source,reason,sourceElement){this.emit("lr-request-close",{source},{cancelable:!0}).defaultPrevented||this.closeFrom(reason,sourceElement)}focusInitial(){this.overlay?.focusInitial()}activateOverlay(){!this.isConnected||this.overlay?.isActive()||(this.overlay=activateOverlay({host:this,panel:()=>this.shadowRoot?.querySelector('[part~="panel"]')??null,onEscape:()=>{const panel=this.renderRoot.querySelector('[part~="panel"]')??this;this.requestClose("keyboard","escape",panel)},onBackdrop:()=>{const backdrop=this.renderRoot.querySelector('[part~="backdrop"]')??this;this.requestClose("overlay","backdrop",backdrop)},preferredInitialFocus:()=>{const panel=this.renderRoot.querySelector('[part~="panel"]'),body=this.renderRoot.querySelector('[part="body"]'),stops=body?collectFocusableElements(body):[];return stops.find(stop=>stop!==body)??stops[0]??panel},beforeInitialFocus:()=>(this.initialFocusDecision===void 0&&(this.initialFocusDecision=!this.emit("lr-initial-focus",null,{cancelable:!0}).defaultPrevented),this.initialFocusDecision),lockScroll:!0,suspendWhenUnrendered:!0}),this.externalModalDepth>0&&this.overlay.suspend())}deactivateOverlay(options){const overlay=this.overlay;return this.overlay=void 0,overlay?.deactivate(options)}render(){const suppressHeader=this.withoutHeader||this.noHeader,renderHeading=!suppressHeader&&!this.headingText&&(this.hasLabelSlot||isServer&&this.withLabel||(this.label??"").length>0||!!this.heading),hasHostName=this.hostAriaLabel!==null,explicitName=hasHostName?this.hostAriaLabel:this.headingText,hasExplicitName=hasHostName||!!explicitName,useHeadingForName=!hasExplicitName&&renderHeading,showHeader=!suppressHeader&&(renderHeading||this.hasHeaderActionsSlot||!this.withoutCloseButton),headingLevel=resolveHeadingLevel(this.headingLevel);return this.nativeModal.render(html`
1
+ import{__decorate}from"tslib";import{OwnedMutationObserver,OwnedResizeObserver}from"../../../internal/owned-observer.js";import{ModalOpenRequest}from"../../../internal/modal-open-request.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{ModalSurfaceController}from"../../../internal/modal-surface-controller.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{html,isServer,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{activateOverlay,collectFocusableElements,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{cancelDeferredFocusReturn,captureFocusReturnOpener,scheduleDeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityText,composedAccessibilityTextResult,observeAccessibleTextReferences,releaseAccessibleTextReferences,isAccessibilitySubtreeExcluded}from"../../../internal/accessibility-visibility.js";import{closeIcon}from"../../../internal/icons.js";import{registerDeclarativeOverlay}from"../../../internal/declarative-overlay-action.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{styles}from"./dialog.styles.js";import{LYRA_DEFAULT_close}from"../../../internal/default-strings/shared.generated.js";const HEADING_SELECTOR='h1, h2, h3, h4, h5, h6, [role="heading"]',FULLSCREEN_NARROW_QUERY="(max-width: 40rem)";class LyraDialog extends LyraElement{static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close}}constructor(){super(),this._open=!1,this.label="",this.headingLevel="3",this.withoutCloseButton=!1,this.withoutHeader=!1,this.noHeader=!1,this.fillBody=!1,this.fullscreenNarrow=!1,this.withFooter=!1,this.size="m",this.hostAriaLabel=null,this.lightDismiss=!1,this.withLabel=!1,this.hasFooterSlot=!1,this.hasLabelSlot=!1,this.hasHeaderActionsSlot=!1,this.focusReturnOpener=null,this.nativeModal=new NativeModalCarrier(this,{onCancel:event=>this.onNativeCancel(event),onUnexpectedClose:carrier=>{!this.open||!this.modalSurface||(this.closeFrom("api",carrier),this.open&&this.enterTopLayer())}}),this.modalPresentation=new ModalSurfaceController(this,this.nativeModal),this.hostDescription=new HostDescriptionController(this,()=>this.renderRoot.querySelector('[role="dialog"]')),this.headingObserver=new OwnedMutationObserver(this,()=>this.headingChanged()),this.bodyOverflowObserver=new OwnedResizeObserver(this,()=>this.syncBodyTabIndex()),this.transitionToken=0,this.openRequest=new ModalOpenRequest,this.transitionAnimations=[],this.headingId=nextId("dialog-heading"),this.externalModalDepth=0,this.modal={activateExternal:()=>{this.externalModalDepth++,this.externalModalDepth===1&&this.overlay?.suspend()},deactivateExternal:()=>{this.externalModalDepth!==0&&(this.externalModalDepth--,this.externalModalDepth===0&&this.open&&this.modalSurface&&(this.overlay?.resume(),queueMicrotask(()=>this.focusInitial())))}},this.onDefaultSlotChange=()=>{this.detectLightDomChrome(),this.syncBodyTabIndex(),this.resetBodyOverflowObserver(),this.armBodyOverflowObserver()},this.onFooterSlotChange=()=>{this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer")},this.onNativeCancel=event=>{if(event.preventDefault(),!this.open||!this.overlay?.isTopmost())return;const panel=this.renderRoot.querySelector('[part~="panel"]')??this;this.requestClose("keyboard","escape",panel)},this.onBackdropClick=()=>{this.lightDismiss&&this.overlay?.dismissBackdrop()},this.onCloseButtonClick=()=>{const button=this.renderRoot.querySelector('[part~="close-button"]')??this;this.requestClose("close-button","close-button",button)},new GlassScrollLayer(this,'[part~="panel"]',()=>this.open)}static{this.styles=[LyraElement.styles,styles,nativeModalCarrierStyles]}get open(){return this._open}set open(next){const normalized=!!next;if(!this.openRequest.coalesce(normalized)&&normalized!==this._open){if(!this.hasUpdated){this.applyOpenState(normalized);return}normalized?this.show():this.close("api")}}get modalSurface(){return!0}get declarativeKind(){return"dialog"}syncFullscreenQuery(){this.releaseFullscreenQuery?.(),this.releaseFullscreenQuery=void 0;const view=this.ownerDocument?.defaultView;if(!this.fullscreenNarrow||!this.isConnected||typeof view?.matchMedia!="function"){this.removeAttribute("data-fullscreen");return}const query=view.matchMedia(FULLSCREEN_NARROW_QUERY),apply=()=>{this.toggleAttribute("data-fullscreen",query.matches)};query.addEventListener("change",apply),this.releaseFullscreenQuery=()=>query.removeEventListener("change",apply),apply()}willUpdate(changed){if(super.willUpdate(changed),changed.has("fullscreenNarrow")&&this.syncFullscreenQuery(),(!this.hasUpdated||changed.has("open")&&this.open)&&(this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer"),this.detectLightDomChrome()),this.open&&(changed.has("open")||changed.has("contained"))&&this.nativeModal.prepare(this.modalSurface),changed.has("open")){if(this.flushPendingScrollLockRelease(),this.open)cancelDeferredFocusReturn(this),this.focusReturnOpener=captureFocusReturnOpener(this),this.isConnected&&this.modalSurface&&this.activateOverlay();else{this.modalPresentation.beginClose();const returnsFocus=this.overlay!==void 0||composedContains(this,deepActiveElement(this.ownerDocument));this.pendingScrollLockRelease=this.deactivateOverlay({deferScrollLockRelease:!0});const opener=this.focusReturnOpener;this.focusReturnOpener=null,returnsFocus&&opener&&this.isConnected&&scheduleDeferredFocusReturn({host:this,candidates:()=>[opener],settled:this.hideSettled,isCurrent:()=>!this.open})}this.hideSettled=void 0}}flushPendingScrollLockRelease(){const release=this.pendingScrollLockRelease;this.pendingScrollLockRelease=void 0,release?.()}updated(changed){super.updated(changed),changed.has("open")&&this.armHeadingObserver(),this.syncBodyTabIndex(),this.armBodyOverflowObserver(),changed.has("open")&&this.open&&this.isConnected&&(this.modalSurface&&(this.enterTopLayer(),this.focusInitial()),queueMicrotask(()=>{this.open&&this.isConnected&&this.detectLightDomChrome()}))}connectedCallback(){super.connectedCallback(),this.releaseDeclarativeActions?.(),this.releaseDeclarativeActions=registerDeclarativeOverlay(this,{kind:()=>this.declarativeKind,open:()=>{this.show()},close:source=>{this.closeFrom("close-action",source)}}),this.syncFullscreenQuery(),this.armHeadingObserver(),this.syncBodyTabIndex(),this.armBodyOverflowObserver(),this.hasUpdated&&this.open&&(this.modalSurface&&(this.overlay?.isActive()?this.externalModalDepth===0&&this.overlay.resume():this.activateOverlay(),this.enterTopLayer()),queueMicrotask(()=>{!this.open||!this.isConnected||(this.detectLightDomChrome(),this.modalSurface&&this.focusInitial())}))}disconnectedCallback(){this.releaseDeclarativeActions?.(),this.releaseDeclarativeActions=void 0,this.releaseFullscreenQuery?.(),this.releaseFullscreenQuery=void 0,this.removeAttribute("data-fullscreen"),this.resetHeadingObserver(),this.resetBodyOverflowObserver(),super.disconnectedCallback(),this.modalPresentation.disconnect(),this.overlay?.suspend(),cancelDeferredFocusReturn(this),this.transitionToken++,this.flushPendingScrollLockRelease(),this.cancelTransitionAnimations(),this.removeAttribute("data-closing"),this.open&&queueMicrotask(()=>{if(!this.isConnected&&this.open){if(this.emit("lr-hide",{source:this},{cancelable:this.disconnectHideCancelable}).defaultPrevented){this.syncOpenAttribute();return}this.applyOpenState(!1),this.emit("lr-close",{reason:"unmount"}),this.emit("lr-after-hide")}})}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted(),this.resetHeadingObserver(),this.resetBodyOverflowObserver(),this.isConnected&&(this.armHeadingObserver(),this.armBodyOverflowObserver(),this.syncBodyTabIndex())}headingChanged(){this.detectLightDomChrome(),this.syncBodyTabIndex(),this.resetHeadingObserver(),this.armHeadingObserver()}armHeadingObserver(){if(!this.isConnected||this.headingObserver.active&&this.headingObserverOpen===this.open)return;this.resetHeadingObserver();const observer=this.headingObserver;if(this.headingObserverOpen=this.open,observer.observe(this,{childList:!0}),this.open){for(const child of this.children)observer.observe(child,{attributes:!0,attributeFilter:["slot"]});const heading=Array.from(this.children).find(child=>child.getAttribute("slot")===null&&child.matches(HEADING_SELECTOR));if(!heading)return;observer.observe(heading,{attributes:!0,attributeFilter:["aria-label","aria-labelledby","aria-hidden","hidden","inert","class","style","slot"],characterData:!0,childList:!0,subtree:!0}),heading.hasAttribute("aria-labelledby")&&(this.headingReferences={releases:[],changed:()=>this.headingChanged()},observeAccessibleTextReferences(observer,heading,composedAccessibilityTextResult(heading,{ancestorBoundary:this,requireRendered:!1}),this.headingReferences))}}resetHeadingObserver(){this.headingReferences&&releaseAccessibleTextReferences(this.headingReferences),this.headingReferences=void 0,this.headingObserver.clear(),this.headingObserverOpen=void 0}syncBodyTabIndex(){const body=this.renderRoot?.querySelector('[part="body"]');if(!body)return;const next=this.open&&(body.scrollHeight>body.clientHeight&&body.scrollHeight>0||body.scrollWidth>body.clientWidth&&body.scrollWidth>0)?0:-1;body.tabIndex!==next&&(body.tabIndex=next)}armBodyOverflowObserver(){const body=this.renderRoot?.querySelector('[part="body"]');if(!body||!this.isConnected||this.bodyOverflowObservedBody===body)return;this.resetBodyOverflowObserver();const observer=this.bodyOverflowObserver;this.bodyOverflowObservedBody=body,observer.observe(body);for(const element of this.defaultSlotElements())observer.observe(element)}resetBodyOverflowObserver(){this.bodyOverflowObserver.clear(),this.bodyOverflowObservedBody=void 0}defaultSlotElements(){return this.renderRoot?.querySelector('[part="body"] slot:not([name])')?.assignedElements({flatten:!0})??[]}get disconnectHideCancelable(){return!1}detectLightDomChrome(){const children=Array.from(this.children),heading=children.find(el=>el.getAttribute("slot")===null&&el.matches(HEADING_SELECTOR));!heading||isAccessibilitySubtreeExcluded(heading)?this.headingText=void 0:heading.hasAttribute("aria-label")?this.headingText=heading.getAttribute("aria-label")??"":heading.hasAttribute("aria-labelledby")?this.headingText=composedAccessibilityText(heading,{ancestorBoundary:this}).trim()||void 0:this.headingText=composedAccessibilityText(Array.from(heading.childNodes),{ancestorBoundary:heading}).trim()||void 0,this.hasLabelSlot=children.some(el=>el.getAttribute("slot")==="label"),this.hasHeaderActionsSlot=children.some(el=>el.getAttribute("slot")==="header-actions")}show(){if(this.openRequest.coalesce(!0)||this._open)return Promise.resolve();this.openRequest.begin(!0);const prevented=this.emit("lr-show",null,{cancelable:!0}).defaultPrevented,superseded=this.openRequest.superseded(!0);return this.openRequest.finish(),prevented||superseded?(this.syncOpenAttribute(),Promise.resolve()):(this.cancelTransitionAnimations(),this.removeAttribute("data-closing"),this.applyOpenState(!0),this.settleTransition("lr-after-show"))}hide(){return this.close("api")}close(reason="api"){return this.closeFrom(reason,this)}closeFrom(reason,source){if(this.openRequest.coalesce(!1)||!this._open)return Promise.resolve();if(this.openRequest.begin(!1),this.emit("lr-hide",{source},{cancelable:!0}).defaultPrevented||this.openRequest.superseded(!1))return this.openRequest.finish(),this.syncOpenAttribute(),Promise.resolve();if(this.emit("lr-close-request",{reason},{cancelable:!0}).defaultPrevented||this.openRequest.superseded(!1))return this.openRequest.finish(),this.syncOpenAttribute(),Promise.resolve();this.openRequest.finish(),this.cancelTransitionAnimations(),this.isConnected&&this.setAttribute("data-closing",""),this.applyOpenState(!1);const settled=this.settleTransition("lr-after-hide");return this.hideSettled=settled,this.emit("lr-close",{reason}),settled}applyOpenState(next){const old=this._open;this._open=next,next&&(this.initialFocusDecision=void 0),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}panelAnimationName(showing){return showing?"dialog.show":"dialog.hide"}overlayAnimationName(showing){return showing?"dialog.overlay.show":"dialog.overlay.hide"}panelAnimationSpec(showing){const offset="translateY(calc(-1 * var(--lr-size-0-5rem)))";return{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-panel-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]}}overlayAnimationSpec(showing){return{keyframes:showing?[{opacity:0},{opacity:1}]:[{opacity:1},{opacity:0}],durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-backdrop-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]}}cancelTransitionAnimations(){for(const animation of this.transitionAnimations)animation.cancel();this.transitionAnimations=[]}async settleTransition(event){const token=++this.transitionToken;if(await this.updateComplete,this.transitionToken===token){if(this.isConnected){const root=this.renderRoot,panel=root.querySelector('[part~="panel"]'),backdrop=root.querySelector('[part~="backdrop"]'),showing=event==="lr-after-show",animations=[panel?animateRegistered(this,panel,this.panelAnimationName(showing),this.effectiveDirection,this.panelAnimationSpec(showing)):void 0,this.modalSurface&&backdrop?animateRegistered(this,backdrop,this.overlayAnimationName(showing),this.effectiveDirection,this.overlayAnimationSpec(showing)):void 0].filter(animation=>animation!==void 0);if(this.transitionAnimations=animations,await Promise.all(animations.map(animation=>animation.finished.catch(()=>{}))),this.transitionToken!==token)return;this.cancelTransitionAnimations()}event==="lr-after-hide"&&(this.removeAttribute("data-closing"),this.leaveTopLayer(),this.flushPendingScrollLockRelease()),this.emit(event)}}enterTopLayer(){this.externalModalDepth===0&&this.overlay?.resume(),this.modalPresentation.show()}leaveTopLayer(){this.modalPresentation.hide()}requestClose(source,reason,sourceElement){this.emit("lr-request-close",{source},{cancelable:!0}).defaultPrevented||this.closeFrom(reason,sourceElement)}focusInitial(){this.overlay?.focusInitial()}activateOverlay(){!this.isConnected||this.overlay?.isActive()||(this.overlay=activateOverlay({host:this,panel:()=>this.shadowRoot?.querySelector('[part~="panel"]')??null,onEscape:()=>{const panel=this.renderRoot.querySelector('[part~="panel"]')??this;this.requestClose("keyboard","escape",panel)},onBackdrop:()=>{const backdrop=this.renderRoot.querySelector('[part~="backdrop"]')??this;this.requestClose("overlay","backdrop",backdrop)},preferredInitialFocus:()=>{const panel=this.renderRoot.querySelector('[part~="panel"]'),body=this.renderRoot.querySelector('[part="body"]'),stops=body?collectFocusableElements(body):[];return stops.find(stop=>stop!==body)??stops[0]??panel},beforeInitialFocus:()=>(this.initialFocusDecision===void 0&&(this.initialFocusDecision=!this.emit("lr-initial-focus",null,{cancelable:!0}).defaultPrevented),this.initialFocusDecision),lockScroll:!0,suspendWhenUnrendered:!0}),this.externalModalDepth>0&&this.overlay.suspend())}deactivateOverlay(options){const overlay=this.overlay;return this.overlay=void 0,overlay?.deactivate(options)}render(){const suppressHeader=this.withoutHeader||this.noHeader,renderHeading=!suppressHeader&&!this.headingText&&(this.hasLabelSlot||isServer&&this.withLabel||(this.label??"").length>0||!!this.heading),hasHostName=this.hostAriaLabel!==null,explicitName=hasHostName?this.hostAriaLabel:this.headingText,hasExplicitName=hasHostName||!!explicitName,useHeadingForName=!hasExplicitName&&renderHeading,showHeader=!suppressHeader&&(renderHeading||this.hasHeaderActionsSlot||!this.withoutCloseButton),headingLevel=resolveHeadingLevel(this.headingLevel);return this.nativeModal.render(html`
2
2
  <div part="backdrop overlay" @click=${this.onBackdropClick}></div>
3
3
  <div part="panel dialog" role=${this.open&&!this.nativeModal.requested?"dialog":nothing} aria-modal=${this.open&&this.modalSurface&&!this.nativeModal.requested?"true":nothing} aria-label=${!this.nativeModal.requested&&hasExplicitName?explicitName:nothing} aria-labelledby=${!this.nativeModal.requested&&useHeadingForName?this.headingId:nothing} tabindex="-1" >
4
4
  <span class="glass-scroll-layer" aria-hidden="true"></span>
@@ -1 +1 @@
1
- import{modalHostStyles}from"../../../internal/native-modal-carrier.styles.js";import{dialogChrome,dialogOpenHost}from"../../../internal/modal-surface.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{glassScrollLayerStyles}from"../../../internal/glass-scroll-layer.styles.js";import{glassIndependentRootStyles}from"../../../internal/glass-independent-root.styles.js";import{overlaySurface}from"../../../internal/overlay-surface.styles.js";import{activeFill,focusRingInwardOffset}from"../../../internal/interactive-control.styles.js";const styles=css` :host{--_lr-dialog-overlay-color:var(--lr-color-overlay);--_lr-dialog-max-width:var(--lr-size-32rem);--_lr-dialog-close-background:transparent;--_lr-dialog-close-background-hover:var(--lr-color-brand-quiet);--_lr-dialog-close-background-active: ${activeFill("var( --lr-icon-button-hover-bg, var(--lr-color-brand-quiet) )")};--_lr-dialog-close-color:var(--lr-color-text-quiet);--_lr-dialog-close-color-hover:var(--lr-color-brand);--_lr-dialog-close-color-active:var(--lr-icon-button-hover-color, var(--lr-color-brand));--_lr-dialog-close-radius:var(--lr-overlay-radius, var(--lr-radius));${modalHostStyles} ${dialogChrome} padding-block-start:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-top));padding-block-end:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-bottom));padding-inline-start:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-inline-start));padding-inline-end:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-inline-end))}${dialogOpenHost} :host([data-closing]){display:flex;pointer-events:none}:host([size='2xs']){--_lr-dialog-max-width:var(--lr-size-20rem)}:host([size=xs]){--_lr-dialog-max-width:var(--lr-size-24rem)}:host([size=s]),:host([size=small]){--_lr-dialog-max-width:var(--lr-size-28rem)}:host([size=l]),:host([size=large]){--_lr-dialog-max-width:var(--lr-size-38rem)}:host([size=xl]){--_lr-dialog-max-width:var(--lr-size-48rem)}[part~=base]{display:contents}[part~=backdrop]{position:absolute;inset:0;background:var(--lr-dialog-overlay-color,var(--backdrop-color,var(--_lr-dialog-overlay-color)));backdrop-filter:var(--backdrop-filter,var(--lr-dialog-backdrop-filter,none))}[part~=panel]{position:relative;display:flex;flex-direction:column;min-inline-size:0;inline-size:var(--width,var(--lr-dialog-width,auto));max-inline-size:min(var(--lr-dialog-max-width,var(--width,var(--lr-dialog-width,var(--_lr-dialog-max-width)))),100%);block-size:var(--lr-dialog-height,auto);max-block-size:min(var(--lr-dialog-max-height,100%),100%);--_lr-overlay-surface:var(--lr-color-surface-container-highest);--_lr-dialog-panel-fill:var( --lr-dialog-panel-bg, var(--lr-overlay-surface, var(--_lr-overlay-surface, var(--lr-color-surface-container-highest))) );${overlaySurface} box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-xl));overflow:auto}[part=header]{display:flex;flex-wrap:wrap;align-items:center;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-s);padding:var(--header-spacing,var(--spacing,var(--lr-dialog-spacing-block,var(--lr-space-m)) var(--lr-dialog-spacing,var(--lr-space-l))));border-block-end:var(--lr-dialog-header-border,var(--lr-border-width-thin) solid var(--lr-dialog-divider-color,var(--lr-overlay-border,var(--lr-color-border-subtle))))}[part~=heading]{flex:1 1 auto;min-inline-size:0;margin:0;font-family:var(--lr-dialog-heading-font-family,var(--lr-font-heading));font-size:var(--lr-dialog-heading-font-size,inherit);font-weight:var(--lr-dialog-heading-font-weight,var(--lr-font-weight-semibold));letter-spacing:var(--lr-dialog-heading-letter-spacing,normal);line-height:var(--lr-dialog-heading-line-height,inherit);overflow:hidden;overflow-wrap:break-word;white-space:normal}[part=header-actions]{flex:1 1 auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere;gap:var(--lr-space-xs);margin-inline-start:auto}[part=header-actions] ::slotted(*){min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part~=close-button]{flex:0 0 auto;margin-inline-start:auto;--_lr-icon-button-background-default:var(--_lr-dialog-close-background);--_lr-icon-button-background-hover-default:var(--_lr-dialog-close-background-hover);--_lr-icon-button-background-active-default:var(--_lr-dialog-close-background-active);--_lr-icon-button-color-default:var(--_lr-dialog-close-color);--_lr-icon-button-color-hover-default:var(--_lr-dialog-close-color-hover);--_lr-icon-button-color-active-default:var(--_lr-dialog-close-color-active);--_lr-icon-button-radius-default:var(--_lr-dialog-close-radius)}[part=header-actions] + [part~=close-button]{margin-inline-start:0}[part~=close-button] svg{display:block}[part=body]{flex:1 1 auto;min-inline-size:0;max-inline-size:100%;padding:var(--body-spacing,var(--spacing,var(--lr-dialog-spacing,var(--lr-space-l))));overflow:var(--lr-dialog-body-overflow,auto);overflow-wrap:anywhere}:host([fill-body]) [part=body]{display:flex;flex-direction:column;flex:1 1 auto;min-block-size:0}:host([fill-body]) [part=body] ::slotted(*){flex:1 1 auto;min-block-size:0}[part=body]:focus-visible{${focusRingInwardOffset}}[part=footer]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-s);padding:var(--footer-spacing,var(--spacing,var(--lr-dialog-spacing-block,var(--lr-space-m)) var(--lr-dialog-spacing,var(--lr-space-l))));border-block-start:var(--lr-border-width-thin) solid var(--lr-dialog-divider-color,var(--lr-overlay-border,var(--lr-color-border-subtle)));overflow-wrap:anywhere}[part=footer] ::slotted(*){min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=footer][hidden]{display:none}:host([fullscreen-narrow][data-fullscreen]){padding:0}:host([fullscreen-narrow][data-fullscreen]) [part~=panel]{box-sizing:border-box;inline-size:100%;max-inline-size:100%;block-size:100%;max-block-size:100%;border-radius:0;padding-block:var(--lr-safe-area-top) var(--lr-safe-area-bottom);padding-inline:var(--lr-safe-area-inline-start) var(--lr-safe-area-inline-end)}${glassScrollLayerStyles} ${glassIndependentRootStyles} ${glassSurface('[part~="panel"]',css`var(--_lr-dialog-panel-fill, var(--lr-overlay-surface, var(--_lr-overlay-surface, var(--lr-color-surface-container-highest))))`,void 0,!0)} `;export{styles};
1
+ import{modalHostStyles}from"../../../internal/native-modal-carrier.styles.js";import{dialogChrome,dialogOpenHost}from"../../../internal/modal-surface.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{glassScrollLayerStyles}from"../../../internal/glass-scroll-layer.styles.js";import{glassIndependentRootStyles}from"../../../internal/glass-independent-root.styles.js";import{overlaySurface}from"../../../internal/overlay-surface.styles.js";import{activeFill,focusRingInwardOffset}from"../../../internal/interactive-control.styles.js";const styles=css` :host{--_lr-dialog-overlay-color:var(--lr-color-overlay);--_lr-dialog-max-width:var(--lr-size-32rem);--_lr-dialog-close-background:transparent;--_lr-dialog-close-background-hover:var(--lr-color-brand-quiet);--_lr-dialog-close-background-active: ${activeFill("var( --lr-icon-button-hover-bg, var(--lr-color-brand-quiet) )")};--_lr-dialog-close-color:var(--lr-color-text-quiet);--_lr-dialog-close-color-hover:var(--lr-color-brand);--_lr-dialog-close-color-active:var(--lr-icon-button-hover-color, var(--lr-color-brand));--_lr-dialog-close-radius:var(--lr-overlay-radius, var(--lr-radius-container));${modalHostStyles} ${dialogChrome} padding-block-start:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-top));padding-block-end:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-bottom));padding-inline-start:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-inline-start));padding-inline-end:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-inline-end))}${dialogOpenHost} :host([data-closing]){display:flex;pointer-events:none}:host([size='2xs']){--_lr-dialog-max-width:var(--lr-size-20rem)}:host([size=xs]){--_lr-dialog-max-width:var(--lr-size-24rem)}:host([size=s]),:host([size=small]){--_lr-dialog-max-width:var(--lr-size-28rem)}:host([size=l]),:host([size=large]){--_lr-dialog-max-width:var(--lr-size-38rem)}:host([size=xl]){--_lr-dialog-max-width:var(--lr-size-48rem)}[part~=base]{display:contents}[part~=backdrop]{position:absolute;inset:0;background:var(--lr-dialog-overlay-color,var(--backdrop-color,var(--_lr-dialog-overlay-color)));backdrop-filter:var(--backdrop-filter,var(--lr-dialog-backdrop-filter,none))}[part~=panel]{position:relative;display:flex;flex-direction:column;min-inline-size:0;inline-size:var(--width,var(--lr-dialog-width,auto));max-inline-size:min(var(--lr-dialog-max-width,var(--width,var(--lr-dialog-width,var(--_lr-dialog-max-width)))),100%);block-size:var(--lr-dialog-height,auto);max-block-size:min(var(--lr-dialog-max-height,100%),100%);--_lr-overlay-surface:var(--lr-color-surface-container-highest);--_lr-dialog-panel-fill:var( --lr-dialog-panel-bg, var(--lr-overlay-surface, var(--_lr-overlay-surface, var(--lr-color-surface-container-highest))) );${overlaySurface} box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-xl));overflow:auto}[part=header]{display:flex;flex-wrap:wrap;align-items:center;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-s);padding:var(--header-spacing,var(--spacing,var(--lr-dialog-spacing-block,var(--lr-space-m)) var(--lr-dialog-spacing,var(--lr-space-l))));border-block-end:var(--lr-dialog-header-border,var(--lr-border-width-thin) solid var(--lr-dialog-divider-color,var(--lr-overlay-border,var(--lr-color-border-subtle))))}[part~=heading]{flex:1 1 auto;min-inline-size:0;margin:0;font-family:var(--lr-dialog-heading-font-family,var(--lr-font-heading));font-size:var(--lr-dialog-heading-font-size,inherit);font-weight:var(--lr-dialog-heading-font-weight,var(--lr-font-weight-semibold));letter-spacing:var(--lr-dialog-heading-letter-spacing,normal);line-height:var(--lr-dialog-heading-line-height,inherit);overflow:hidden;overflow-wrap:break-word;white-space:normal}[part=header-actions]{flex:1 1 auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere;gap:var(--lr-space-xs);margin-inline-start:auto}[part=header-actions] ::slotted(*){min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part~=close-button]{flex:0 0 auto;margin-inline-start:auto;--_lr-icon-button-background-default:var(--_lr-dialog-close-background);--_lr-icon-button-background-hover-default:var(--_lr-dialog-close-background-hover);--_lr-icon-button-background-active-default:var(--_lr-dialog-close-background-active);--_lr-icon-button-color-default:var(--_lr-dialog-close-color);--_lr-icon-button-color-hover-default:var(--_lr-dialog-close-color-hover);--_lr-icon-button-color-active-default:var(--_lr-dialog-close-color-active);--_lr-icon-button-radius-default:var(--_lr-dialog-close-radius)}[part=header-actions] + [part~=close-button]{margin-inline-start:0}[part~=close-button] svg{display:block}[part=body]{flex:1 1 auto;min-inline-size:0;max-inline-size:100%;padding:var(--body-spacing,var(--spacing,var(--lr-dialog-spacing,var(--lr-space-l))));overflow:var(--lr-dialog-body-overflow,auto);overflow-wrap:anywhere}:host([fill-body]) [part=body]{display:flex;flex-direction:column;flex:1 1 auto;min-block-size:0}:host([fill-body]) [part=body] ::slotted(*){flex:1 1 auto;min-block-size:0}[part=body]:focus-visible{${focusRingInwardOffset}}[part=footer]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-s);padding:var(--footer-spacing,var(--spacing,var(--lr-dialog-spacing-block,var(--lr-space-m)) var(--lr-dialog-spacing,var(--lr-space-l))));border-block-start:var(--lr-border-width-thin) solid var(--lr-dialog-divider-color,var(--lr-overlay-border,var(--lr-color-border-subtle)));overflow-wrap:anywhere}[part=footer] ::slotted(*){min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=footer][hidden]{display:none}:host([fullscreen-narrow][data-fullscreen]){padding:0}:host([fullscreen-narrow][data-fullscreen]) [part~=panel]{box-sizing:border-box;inline-size:100%;max-inline-size:100%;block-size:100%;max-block-size:100%;border-radius:0;padding-block:var(--lr-safe-area-top) var(--lr-safe-area-bottom);padding-inline:var(--lr-safe-area-inline-start) var(--lr-safe-area-inline-end)}${glassScrollLayerStyles} ${glassIndependentRootStyles} ${glassSurface('[part~="panel"]',css`var(--_lr-dialog-panel-fill, var(--lr-overlay-surface, var(--_lr-overlay-surface, var(--lr-color-surface-container-highest))))`,void 0,!0)} `;export{styles};
@@ -12,6 +12,12 @@ import type{PropertyValues}from'lit';import{LyraDialog}from'../dialog/dialog.cla
12
12
  * `showBottom`/`hideBottom`, and `showStart`/`hideStart`; the scrim uses
13
13
  * `drawer.overlay.show`/`drawer.overlay.hide`.
14
14
  *
15
+ * Declarative actions use `data-drawer` instead of `data-dialog`: activating any element with
16
+ * `data-drawer="open <id>"` opens the `<lr-drawer>` with that `id`, and activating a descendant
17
+ * with `data-drawer="close"` closes the nearest owning drawer with reason `'close-action'`. Every
18
+ * other rule -- lookup scope, nesting, vetoes, disabled and inert actions -- is `<lr-dialog>`'s.
19
+ * `data-dialog` never addresses a drawer, and `data-drawer` never addresses a dialog.
20
+ *
15
21
  * @customElement lr-drawer
16
22
  * @slot - The drawer body.
17
23
  * @slot label - Rich header content, inherited from `<lr-dialog>`.
@@ -60,7 +66,7 @@ import type{PropertyValues}from'lit';import{LyraDialog}from'../dialog/dialog.cla
60
66
  * @cssprop [--lr-drawer-inset=var(--lr-space-s)] - Gap between a `floating` panel and the viewport
61
67
  * (or, with `contained`, its containing block) on every side. The device safe-area insets still
62
68
  * win wherever they are larger. Ignored unless `floating` is set.
63
- * @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner
69
+ * @cssprop [--lr-overlay-radius=var(--lr-radius-container)] - Shared floating-surface corner
64
70
  * radius, read by the panel only when `floating` is set.
65
71
  * @cssprop [--lr-drawer-enter-x=calc(-1 * var(--lr-size-1rem))] - Horizontal offset the panel
66
72
  * slides in from, and back out to, for start/end drawers. Its private default changes per
@@ -82,6 +88,6 @@ contained:boolean;
82
88
  * `--lr-drawer-inset` gap on every side (default `var(--lr-space-s)`) and corners rounded with
83
89
  * `--lr-overlay-radius`. Off by default, so the drawer stays square and edge-flush. Combines
84
90
  * with `contained`, where the gap is measured from the containing block. */
85
- floating:boolean;protected get modalSurface():boolean;
91
+ floating:boolean;protected get modalSurface():boolean;protected get declarativeKind():'dialog'|'drawer';
86
92
  /** A mapped drawer's hide request is cancelable on every path, including external removal.*/
87
93
  protected get disconnectHideCancelable():boolean;protected panelAnimationName(showing:boolean):string;protected overlayAnimationName(showing:boolean):string;protected panelAnimationSpec(showing:boolean):RegisteredAnimationSpec;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;}declare global{interface HTMLElementTagNameMap{'lr-drawer':LyraDrawer;}}
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import{declaredDefaultConverter}from"../../../internal/converters.js";import{property}from"lit/decorators.js";import{LyraDialog}from"../dialog/dialog.class.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host{justify-content:flex-start;align-items:stretch;padding:0}:host([contained]){pointer-events:none;position:absolute}:host([contained]:not([data-closing])) [part~=panel]{pointer-events:auto}:host([contained]) [part~=backdrop]{display:none}:host(:is([placement=end],:not([placement]))){justify-content:flex-end}:host([placement=top]){justify-content:stretch;align-items:flex-start}:host([placement=bottom]){justify-content:stretch;align-items:flex-end}[part~=panel]{inline-size:min(var(--size,var(--lr-drawer-width,var(--width,var(--lr-dialog-width,var(--lr-size-24rem))))),100%);block-size:100%;max-inline-size:min(var(--lr-dialog-max-width,var(--_lr-dialog-max-width)),100%);border-radius:var(--lr-drawer-radius,var(--_lr-drawer-radius,0));--_lr-dialog-panel-fill:var(--lr-drawer-panel-bg,var(--lr-dialog-panel-bg,var(--lr-overlay-surface,var(--_lr-overlay-surface,var(--lr-color-surface-container-highest)))));max-block-size:100%;box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-l))}:host([placement=top]) [part~=panel],:host([placement=bottom]) [part~=panel]{inline-size:100%;block-size:min(var(--size,var(--lr-drawer-height,var(--lr-size-24rem))),100%);max-block-size:100%;max-inline-size:100%}:host(:not([contained])) [part~=panel]{box-sizing:border-box;padding-block:var(--lr-safe-area-top) var(--lr-safe-area-bottom)}:host(:not([contained]):is([placement=end],:not([placement]))) [part~=panel]{padding-inline-end:var(--lr-safe-area-inline-end)}:host(:not([contained])[placement=start]) [part~=panel]{padding-inline-start:var(--lr-safe-area-inline-start)}:host(:not([contained]):is([placement=top],[placement=bottom])) [part~=panel]{padding-inline:var(--lr-safe-area-inline-start) var(--lr-safe-area-inline-end)}:host(:not([contained])[placement=top]) [part~=panel]{padding-block-end:0}:host(:not([contained])[placement=bottom]) [part~=panel]{padding-block-start:0}:host(:is([placement=end],:not([placement]))) [part~=panel],:host(:dir(rtl)) [part~=panel]{--_lr-drawer-enter-x:var(--lr-size-1rem)}:host(:dir(rtl):is([placement=end],:not([placement]))) [part~=panel]{--_lr-drawer-enter-x:calc(-1 * var(--lr-size-1rem))}:host([placement=bottom]) [part~=panel]{--_lr-drawer-enter-y:var(--lr-size-1rem)}:host([floating]){--_lr-drawer-radius:var(--lr-overlay-radius,var(--lr-radius))}:host([floating]:not([contained])){padding-block-start:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-top));padding-block-end:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-bottom));padding-inline-start:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-inline-start));padding-inline-end:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-inline-end))}:host([floating][contained]){padding:var(--lr-drawer-inset,var(--lr-space-s))}:host([floating]:not([contained])) [part~=panel]{padding:0}[part=body]{flex:0 auto}`;class LyraDrawer extends LyraDialog{constructor(){super(...arguments),this.placement="end",this.contained=!1,this.floating=!1}static{this.styles=[LyraDialog.styles,styles]}get modalSurface(){return!this.contained}get disconnectHideCancelable(){return!0}panelAnimationName(showing){const placement=`${this.placement.charAt(0).toUpperCase()}${this.placement.slice(1)}`;return`drawer.${showing?"show":"hide"}${placement}`}overlayAnimationName(showing){return showing?"drawer.overlay.show":"drawer.overlay.hide"}panelAnimationSpec(showing){const block=this.placement==="top"||this.placement==="bottom",offset=block?"translateY(var(--lr-drawer-enter-y, var(--_lr-drawer-enter-y, calc(-1 * var(--lr-size-1rem)))))":"translateX(var(--lr-drawer-enter-x, var(--_lr-drawer-enter-x, calc(-1 * var(--lr-size-1rem)))))",resting=block?"translateY(0)":"translateX(0)",keyframes=showing?[{opacity:0,transform:offset},{opacity:1,transform:resting}]:[{opacity:1,transform:resting},{opacity:0,transform:offset}];return{keyframes,rtlKeyframes:keyframes,durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-panel-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]}}willUpdate(changed){super.willUpdate(changed),!(!changed.has("contained")||!this.open)&&(this.modalSurface&&this.isConnected?this.activateOverlay():(this.deactivateOverlay({restoreFocus:!1}),this.leaveTopLayer()))}updated(changed){super.updated(changed),changed.has("contained")&&this.open&&this.isConnected&&this.modalSurface&&(this.enterTopLayer(),this.focusInitial())}}__decorate([property({reflect:!0,converter:declaredDefaultConverter("end")})],LyraDrawer.prototype,"placement",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDrawer.prototype,"contained",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDrawer.prototype,"floating",void 0);export{LyraDrawer};
1
+ import{__decorate}from"tslib";import{declaredDefaultConverter}from"../../../internal/converters.js";import{property}from"lit/decorators.js";import{LyraDialog}from"../dialog/dialog.class.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host{justify-content:flex-start;align-items:stretch;padding:0}:host([contained]){pointer-events:none;position:absolute}:host([contained]:not([data-closing])) [part~=panel]{pointer-events:auto}:host([contained]) [part~=backdrop]{display:none}:host(:is([placement=end],:not([placement]))){justify-content:flex-end}:host([placement=top]){justify-content:stretch;align-items:flex-start}:host([placement=bottom]){justify-content:stretch;align-items:flex-end}[part~=panel]{inline-size:min(var(--size,var(--lr-drawer-width,var(--width,var(--lr-dialog-width,var(--lr-size-24rem))))),100%);block-size:100%;max-inline-size:min(var(--lr-dialog-max-width,var(--_lr-dialog-max-width)),100%);border-radius:var(--lr-drawer-radius,var(--_lr-drawer-radius,0));--_lr-dialog-panel-fill:var(--lr-drawer-panel-bg,var(--lr-dialog-panel-bg,var(--lr-overlay-surface,var(--_lr-overlay-surface,var(--lr-color-surface-container-highest)))));max-block-size:100%;box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-l))}:host([placement=top]) [part~=panel],:host([placement=bottom]) [part~=panel]{inline-size:100%;block-size:min(var(--size,var(--lr-drawer-height,var(--lr-size-24rem))),100%);max-block-size:100%;max-inline-size:100%}:host(:not([contained])) [part~=panel]{box-sizing:border-box;padding-block:var(--lr-safe-area-top) var(--lr-safe-area-bottom)}:host(:not([contained]):is([placement=end],:not([placement]))) [part~=panel]{padding-inline-end:var(--lr-safe-area-inline-end)}:host(:not([contained])[placement=start]) [part~=panel]{padding-inline-start:var(--lr-safe-area-inline-start)}:host(:not([contained]):is([placement=top],[placement=bottom])) [part~=panel]{padding-inline:var(--lr-safe-area-inline-start) var(--lr-safe-area-inline-end)}:host(:not([contained])[placement=top]) [part~=panel]{padding-block-end:0}:host(:not([contained])[placement=bottom]) [part~=panel]{padding-block-start:0}:host(:is([placement=end],:not([placement]))) [part~=panel],:host(:dir(rtl)) [part~=panel]{--_lr-drawer-enter-x:var(--lr-size-1rem)}:host(:dir(rtl):is([placement=end],:not([placement]))) [part~=panel]{--_lr-drawer-enter-x:calc(-1 * var(--lr-size-1rem))}:host([placement=bottom]) [part~=panel]{--_lr-drawer-enter-y:var(--lr-size-1rem)}:host([floating]){--_lr-drawer-radius:var(--lr-overlay-radius,var(--lr-radius-container))}:host([floating]:not([contained])){padding-block-start:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-top));padding-block-end:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-bottom));padding-inline-start:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-inline-start));padding-inline-end:max(var(--lr-drawer-inset,var(--lr-space-s)),var(--lr-safe-area-inline-end))}:host([floating][contained]){padding:var(--lr-drawer-inset,var(--lr-space-s))}:host([floating]:not([contained])) [part~=panel]{padding:0}[part=body]{flex:0 auto}`;class LyraDrawer extends LyraDialog{constructor(){super(...arguments),this.placement="end",this.contained=!1,this.floating=!1}static{this.styles=[LyraDialog.styles,styles]}get modalSurface(){return!this.contained}get declarativeKind(){return"drawer"}get disconnectHideCancelable(){return!0}panelAnimationName(showing){const placement=`${this.placement.charAt(0).toUpperCase()}${this.placement.slice(1)}`;return`drawer.${showing?"show":"hide"}${placement}`}overlayAnimationName(showing){return showing?"drawer.overlay.show":"drawer.overlay.hide"}panelAnimationSpec(showing){const block=this.placement==="top"||this.placement==="bottom",offset=block?"translateY(var(--lr-drawer-enter-y, var(--_lr-drawer-enter-y, calc(-1 * var(--lr-size-1rem)))))":"translateX(var(--lr-drawer-enter-x, var(--_lr-drawer-enter-x, calc(-1 * var(--lr-size-1rem)))))",resting=block?"translateY(0)":"translateX(0)",keyframes=showing?[{opacity:0,transform:offset},{opacity:1,transform:resting}]:[{opacity:1,transform:resting},{opacity:0,transform:offset}];return{keyframes,rtlKeyframes:keyframes,durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-panel-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]}}willUpdate(changed){super.willUpdate(changed),!(!changed.has("contained")||!this.open)&&(this.modalSurface&&this.isConnected?this.activateOverlay():(this.deactivateOverlay({restoreFocus:!1}),this.leaveTopLayer()))}updated(changed){super.updated(changed),changed.has("contained")&&this.open&&this.isConnected&&this.modalSurface&&(this.enterTopLayer(),this.focusInitial())}}__decorate([property({reflect:!0,converter:declaredDefaultConverter("end")})],LyraDrawer.prototype,"placement",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDrawer.prototype,"contained",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraDrawer.prototype,"floating",void 0);export{LyraDrawer};
@@ -53,7 +53,7 @@ import{type PropertyValues,type TemplateResult}from'lit';import type{Placement}f
53
53
  * inherited from the popover surface.
54
54
  * @cssprop [--lr-overlay-border=var(--lr-color-border-subtle)] - Shared floating-surface edge
55
55
  * colour, inherited from the popover surface.
56
- * @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner radius,
56
+ * @cssprop [--lr-overlay-radius=var(--lr-radius-container)] - Shared floating-surface corner radius,
57
57
  * inherited from the popover surface.
58
58
  * @cssprop [--lr-overlay-shadow-anchored=var(--lr-shadow-m)] - Elevation of an anchored,
59
59
  * positioner-placed overlay, inherited from the popover surface.
@@ -1 +1 @@
1
- import{css}from"lit";import{anchoredPopupSettle,overlaySurface,overlaySurfaceFill}from"../../../internal/overlay-surface.styles.js";const styles=css` :host{display:inline-block}[part=trigger]{display:inline-block}:host([full-width-trigger]){display:block}:host([full-width-trigger]) [part=trigger]{display:block}:host([full-width-trigger]) slot[name=trigger]::slotted(*){box-sizing:border-box;inline-size:100%}[part~=popup]{position:fixed;top:0;left:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));inline-size:var(--lr-overlay-inline-size,auto);max-inline-size:min(var(--max-width,var(--lr-overlay-max-inline-size,var(--lr-overlay-inline-size,var(--lr-size-20rem)))),var(--lr-positioner-available-inline-size,var(--lr-size-20rem)));min-inline-size:min(var(--_lr-popup-min-inline-size,var(--lr-overlay-min-inline-size,0px)),var(--lr-positioner-available-inline-size,100vw));max-block-size:var(--lr-positioner-available-block-size,var(--lr-size-20rem));overflow:auto;${overlaySurface} box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m))}[part~=hover-bridge]{position:fixed;inset:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));clip-path:polygon(var(--lr-positioner-hover-bridge-top-left-x,0) var(--lr-positioner-hover-bridge-top-left-y,0),var(--lr-positioner-hover-bridge-top-right-x,0) var(--lr-positioner-hover-bridge-top-right-y,0),var(--lr-positioner-hover-bridge-bottom-right-x,0) var(--lr-positioner-hover-bridge-bottom-right-y,0),var(--lr-positioner-hover-bridge-bottom-left-x,0) var(--lr-positioner-hover-bridge-bottom-left-y,0))}[part~=popup]{--_lr-popup-exit-transform:translateY(var(--lr-size-neg-0-25rem))}${anchoredPopupSettle} [part~=content]{padding:var(--lr-overlay-content-padding,var(--lr-space-m))}[part~=popup]:where([data-has-arrow]){overflow:visible}[part~=popup]:where([data-has-arrow]) [part~=content]{overflow:auto;max-block-size:var(--lr-positioner-available-block-size,var(--lr-size-20rem))}[part~=arrow]{position:absolute;inline-size:calc(2 * var(--arrow-size,var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))));block-size:calc(2 * var(--arrow-size,var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))));rotate:45deg;${overlaySurfaceFill} clip-path:polygon(100% 0,100% 100%,0 100%)}`,tooltipStyles=/* @__PURE__ */(()=>css` :host{display:inline-block}[part=trigger]{display:inline-block}[part~=popup]{position:absolute;top:0;left:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));min-inline-size:0;inline-size:max-content;max-inline-size:min(var(--max-width,var(--lr-tooltip-max-inline-size,var(--lr-size-20rem))),var(--lr-positioner-available-inline-size,100vi));max-block-size:var(--lr-positioner-available-block-size,100vb);overflow-x:clip;overflow-y:auto;overflow-wrap:anywhere;padding:var(--lr-space-xs) var(--lr-space-s);border-radius:var(--lr-overlay-radius,var(--lr-radius-xs));background:var(--lr-tooltip-bg,var(--lr-color-neutral));color:var(--lr-tooltip-color,var(--lr-color-on-neutral));font-size:var(--lr-font-size-sm);line-height:var(--lr-line-height-compact);box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m))}[part~=popup]{--_lr-popup-exit-transform:none}${anchoredPopupSettle} [part~=popup]:where([data-has-arrow]){overflow:visible}[part~=arrow]{position:absolute;inline-size:calc(2 * var(--arrow-size,var(--lr-tooltip-arrow-size,var(--lr-size-0-375rem))));block-size:calc(2 * var(--arrow-size,var(--lr-tooltip-arrow-size,var(--lr-size-0-375rem))));rotate:45deg;background:var(--lr-tooltip-bg,var(--lr-color-neutral))}`)();export{styles,tooltipStyles};
1
+ import{css}from"lit";import{anchoredPopupSettle,overlaySurface,overlaySurfaceFill}from"../../../internal/overlay-surface.styles.js";const styles=css` :host{display:inline-block}[part=trigger]{display:inline-block}:host([full-width-trigger]){display:block}:host([full-width-trigger]) [part=trigger]{display:block}:host([full-width-trigger]) slot[name=trigger]::slotted(*){box-sizing:border-box;inline-size:100%}[part~=popup]{position:fixed;top:0;left:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));inline-size:var(--lr-overlay-inline-size,auto);max-inline-size:min(var(--max-width,var(--lr-overlay-max-inline-size,var(--lr-overlay-inline-size,var(--lr-size-20rem)))),var(--lr-positioner-available-inline-size,var(--lr-size-20rem)));min-inline-size:min(var(--_lr-popup-min-inline-size,var(--lr-overlay-min-inline-size,0px)),var(--lr-positioner-available-inline-size,100vw));max-block-size:var(--lr-positioner-available-block-size,var(--lr-size-20rem));overflow:auto;${overlaySurface} box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m))}[part~=hover-bridge]{position:fixed;inset:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));clip-path:polygon(var(--lr-positioner-hover-bridge-top-left-x,0) var(--lr-positioner-hover-bridge-top-left-y,0),var(--lr-positioner-hover-bridge-top-right-x,0) var(--lr-positioner-hover-bridge-top-right-y,0),var(--lr-positioner-hover-bridge-bottom-right-x,0) var(--lr-positioner-hover-bridge-bottom-right-y,0),var(--lr-positioner-hover-bridge-bottom-left-x,0) var(--lr-positioner-hover-bridge-bottom-left-y,0))}[part~=popup]{--_lr-popup-exit-transform:translateY(var(--lr-size-neg-0-25rem))}${anchoredPopupSettle} [part~=content]{padding:var(--lr-overlay-content-padding,var(--lr-space-m))}[part~=popup]:where([data-has-arrow]){overflow:visible}[part~=popup]:where([data-has-arrow]) [part~=content]{overflow:auto;max-block-size:var(--lr-positioner-available-block-size,var(--lr-size-20rem))}[part~=arrow]{position:absolute;inline-size:calc(2 * var(--arrow-size,var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))));block-size:calc(2 * var(--arrow-size,var(--lr-overlay-arrow-size,var(--lr-size-0-375rem))));rotate:45deg;${overlaySurfaceFill} clip-path:polygon(100% 0,100% 100%,0 100%)}`,tooltipStyles=/* @__PURE__ */(()=>css` :host{display:inline-block}[part=trigger]{display:inline-block}:host([full-width-trigger]){display:block}:host([full-width-trigger]) [part=trigger]{display:block}:host([full-width-trigger]) slot[name=trigger]::slotted(*){box-sizing:border-box;inline-size:100%}[part~=popup]{position:absolute;top:0;left:0;z-index:var(--lr-overlay-stack-index,var(--lr-layer-popover));min-inline-size:0;inline-size:max-content;max-inline-size:min(var(--max-width,var(--lr-tooltip-max-inline-size,var(--lr-size-20rem))),var(--lr-positioner-available-inline-size,100vi));max-block-size:var(--lr-positioner-available-block-size,100vb);overflow-x:clip;overflow-y:auto;overflow-wrap:anywhere;padding:var(--lr-space-xs) var(--lr-space-s);border-radius:var(--lr-overlay-radius,var(--lr-radius-xs));background:var(--lr-tooltip-bg,var(--lr-color-neutral));color:var(--lr-tooltip-color,var(--lr-color-on-neutral));font-size:var(--lr-font-size-sm);line-height:var(--lr-line-height-compact);box-shadow:var(--lr-overlay-shadow-anchored,var(--lr-shadow-m))}[part~=popup]{--_lr-popup-exit-transform:none}${anchoredPopupSettle} [part~=popup]:where([data-has-arrow]){overflow:visible}[part~=arrow]{position:absolute;inline-size:calc(2 * var(--arrow-size,var(--lr-tooltip-arrow-size,var(--lr-size-0-375rem))));block-size:calc(2 * var(--arrow-size,var(--lr-tooltip-arrow-size,var(--lr-size-0-375rem))));rotate:45deg;background:var(--lr-tooltip-bg,var(--lr-color-neutral))}`)();export{styles,tooltipStyles};
@@ -147,7 +147,7 @@ export interface LyraPopoverEventMap{'lr-show':CustomEvent<null>;'lr-after-show'
147
147
  * that subtree without touching the page, card and control surfaces behind them.
148
148
  * @cssprop [--lr-overlay-border=var(--lr-color-border-subtle)] - Shared floating-surface edge
149
149
  * colour, on the popup and on the arrow's two outward-facing edges.
150
- * @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner radius. The
150
+ * @cssprop [--lr-overlay-radius=var(--lr-radius-container)] - Shared floating-surface corner radius. The
151
151
  * arrow is deliberately excluded: its corners are already cut by its clip path.
152
152
  * @cssprop [--lr-overlay-shadow-anchored=var(--lr-shadow-m)] - Elevation of an anchored,
153
153
  * positioner-placed overlay. A separate tier from `--lr-overlay-shadow-modal`, so raising popups
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{AnchoredDisclosureController}from"../../../internal/anchored-disclosure-controller.js";import{DocumentPointerListener}from"../../../internal/document-pointer.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{normalizeLabel}from"../../../internal/accessible-name.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{tag}from"../../../internal/prefix.js";import{PositioningStrategyState,positioningStrategyConverter,resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{deferredPlaceReady,syncTopLayerRelease,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{OwnerAnimationFrameWaiter}from"../../../internal/owner-animation-frame.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{finiteDuration,finiteNumber}from"../../../internal/numbers.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{isKeyboardFocusEvent}from"../../../internal/focus-modality.js";import{declaredDefaultConverter,literalSetConverter,omittedEmptyStringConverter,blankNumberConverter}from"../../../internal/converters.js";import{activateNonmodalOverlay,composedContains}from"../../../internal/nonmodal-overlay-manager.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{applyOverlayArrow}from"./overlay-arrow.js";import{liveVirtualElement,normalizeVirtualRect,OverlayAnchorIdentity,OverlayDelayTimer,resolveOverlayAnchor,resolveOverlayAccessibleTrigger,resolveOverlayInteractionTrigger}from"../../../internal/overlay-shared.js";import{styles}from"./overlay.styles.js";import{glassPopoverStyles}from"./popover-glass.styles.js";import{LYRA_DEFAULT_popover}from"../../../internal/default-strings/overlays.generated.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";const DEFAULT_DISTANCE=8,EXPANDABLE_TRIGGER_ROLES=new Set(["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","switch"]);function supportsTriggerExpansion(element){const role=element.getAttribute("role")?.trim().split(/\s+/)[0];return role?EXPANDABLE_TRIGGER_ROLES.has(role):element.matches("button, a[href], select, summary")?!0:element.localName==="input"&&["button","submit","reset","image","checkbox"].includes(element.type)}let popoverConnectionSequence=0;const POPUP_ROLE=literalSetConverter(["dialog","menu","none"],"dialog"),POPOVER_TRIGGER_KEYWORDS=["click","hover","focus","manual","hover-card"];function normalizeTriggerList(next){const keywords=[];for(const token of String(next??"").toLowerCase().split(/\s+/)){const keyword=token;POPOVER_TRIGGER_KEYWORDS.includes(keyword)&&!keywords.includes(keyword)&&keywords.push(keyword)}return keywords.length>0?keywords.join(" "):"click"}const DEFAULT_TRIGGER_DELAY=0;class LyraPopover extends LyraElement{static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel,popover:LYRA_DEFAULT_popover}}constructor(){super(),this._open=!1,this.placement="top",this.strategy=new PositioningStrategyState(this,this.defaultPositioningStrategy),this.topLayer=!1,this.distance=8,this.skidding=0,this._for="",this.forElement=null,this.anchor=null,this.virtualElement=null,this.interactionBoundary=null,this.withoutArrow=!1,this.arrowPlacement="anchor",this.arrowPadding=0,this.fullWidthTrigger=!1,this._trigger="click",this.showDelay=0,this.hideDelay=0,this.hoverBridge=!1,this.accessibleLabel="",this._popupRole="dialog",this._disabled=!1,this.openedByInteraction=!1,this.pinned=!1,this.suppressTriggerFocusOpen=!1,this.delayTimer=new OverlayDelayTimer,this.resolvedSide="bottom",this.anchorPositioned=!1,this.popupHidden=!0,this.disconnecting=!1,this.reconnectedWhileDisconnecting=!1,this.directionChanged=!1,this.anchorIdentity=new OverlayAnchorIdentity,this.triggerUpgrades=new CustomElementUpgradeObserver(()=>{this.isConnected&&this.syncTriggerA11y()}),this.transientRevealFrame=new OwnerAnimationFrameWaiter(this),this.positioningGeneration=0,this.generatedHostId=nextId("popover"),this.popupId=nextId("popover-popup"),this.outsidePress=new DocumentPointerListener(this,event=>this.onDocumentPointer(event)),this.hostIdObserverGeneration=0,this.connectionSequence=0,this.popoverInternals=attachInternalsSafely(this),this.onExternalTriggerKeyDown=event=>{this.onTriggerKeyDown(event)},this.onTriggerSlotChange=event=>{this.collectTriggerFromSlot(event.target)},this.onTriggerClick=()=>{if(!this.virtualAnchor&&(this.syncTriggerA11y(),!this.isManualTrigger)){if(this.cancelPendingTransition(),this.isHoverCard){this.open&&this.hide({focusTrigger:!1});return}if(this.opensOn("click")&&!this.opensOn("hover")&&!this.opensOn("focus")){this.open?this.hide():this.show();return}if(this.open&&this.pinned){this.hide();return}this.open||(this.openedByInteraction=!1,this.show()),this.pinned=this.open}},this.onTriggerPointerEnter=()=>{this.opensOn("hover")&&this.requestDelayedTransition(!0)},this.onTriggerPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupPointerEnter=()=>{!this.opensOn("hover")||!this.open||this.cancelPendingTransition()},this.onPopupPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onSurfaceFocusIn=event=>{!this.opensOn("focus")||this.suppressTriggerFocusOpen||(!this.open||this.triggerElement!=null&&event.composedPath().includes(this.triggerElement))&&!isKeyboardFocusEvent(event)||this.requestDelayedTransition(!0)},this.onSurfaceFocusOut=event=>{this.opensOn("focus")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupClick=event=>{if(event.defaultPrevented)return;const path=event.composedPath(),hostIndex=path.indexOf(this);if(hostIndex<0)return;const closeAction=path.slice(0,hostIndex).find(target=>target.nodeType===1&&target.getAttribute("data-popover")==="close");if(!closeAction)return;event.stopPropagation();const state2=closeAction;state2.effectiveDisabled===!0||state2.disabled===!0||closeAction.hasAttribute("disabled")||closeAction.getAttribute("aria-disabled")?.trim().toLowerCase()==="true"||closeAction.hasAttribute("inert")||closeAction.closest("[inert]")||this.hide()},this.onDocumentPointer=event=>{this.overlayHandle?.isTopmost()&&(this.isInsideLightDismissBoundary(event.composedPath())||this.hide())},this.disclosure=new AnchoredDisclosureController({host:this,isOpen:()=>this._open,setOpen:value=>this.setOpen(value),emit:name=>name==="lr-show"||name==="lr-hide"?this.emitCancelableLifecycle(name).defaultPrevented:this.emitSettledLifecycle(name).defaultPrevented,popup:()=>this.renderRoot.querySelector('[part~="popup"]'),readyToShow:async isCurrent=>{const positioned=await waitForDeferredPlacement(()=>this.cleanup);return isCurrent()&&this.open&&positioned&&this.anchorPositioned},animate:(showing,popup)=>{const offset="translateY(var(--lr-size-neg-0-25rem))";return animateRegistered(this,popup,`${this.animationNamespace}.${showing?"show":"hide"}`,this.effectiveDirection,{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:this.animationDurationProperties(showing),easingProperties:["--lr-easing-standard"]})},afterHide:()=>{this.popupHidden=!0}}),new GlassScrollLayer(this,'[part~="popup"]')}static{this.styles=[LyraElement.styles,styles,glassPopoverStyles]}get open(){return this._open}set open(next){const normalized=!!next&&this.canOpen;if(normalized!==this._open){if(!this.hasUpdated){this.setOpen(normalized),this.isConnected&&this.connectionSequence>0&&this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers());return}normalized?this.show():this.hide()}}get positioningStrategy(){return this.strategy.value}set positioningStrategy(next){const previous=this.strategy.value;this.strategy.set(next),previous!==this.strategy.value&&this.onPositioningStrategyChanged(previous,this.strategy.value)}onPositioningStrategyChanged(_previous,_next){}get for(){return this._for}set for(next){this._for=next??""}get trigger(){return this._trigger}set trigger(next){const normalized=normalizeTriggerList(next);if(normalized===this._trigger)return;const old=this._trigger;this._trigger=normalized,this.requestUpdate("trigger",old)}get triggerKeywords(){return this._trigger.split(" ")}get isManualTrigger(){return this.triggerKeywords.includes("manual")}get isHoverCard(){return!this.isManualTrigger&&this.triggerKeywords.includes("hover-card")}opensOn(keyword){return this.isHoverCard?keyword==="hover"||keyword==="focus":!this.isManualTrigger&&this.triggerKeywords.includes(keyword)}get popupRole(){return this._popupRole}set popupRole(next){const normalized=POPUP_ROLE.normalize(next);if(normalized===this._popupRole)return;const old=this._popupRole;this._popupRole=normalized,this.requestUpdate("popupRole",old)}get disabled(){return this._disabled}set disabled(next){const normalized=!!next;if(normalized===this._disabled)return;const old=this._disabled;this._disabled=normalized,this.requestUpdate("disabled",old),normalized&&this.open&&(this.hasUpdated?this.hide():this.open=!1)}get defaultDistance(){return DEFAULT_DISTANCE}get defaultPositioningStrategy(){return"fixed"}get resolvedPositioningStrategy(){return resolveEffectivePositioningStrategy(this,this.strategy.authored,this.defaultPositioningStrategy)}get positioningSync(){}get animationNamespace(){return"popover"}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-duration-fast"]}get popupPartNames(){return["popup","dialog","popup__popup"].join(" ")}get contentPartNames(){return["content","body"].join(" ")}get triggerPopupRole(){return this.popupRole}get popupSurfaceRole(){return this.popupRole==="none"?void 0:this.popupRole}get effectivePopupLabel(){return hostAriaLabel(this)??normalizeLabel(this.accessibleLabel)??this.localize(this.triggerPopupRole==="menu"?"menuLabel":"popover")}get rendersArrow(){return!this.withoutArrow}get arrowPartNames(){return"arrow popup__arrow"}get rendersHoverBridge(){return this.hoverBridge&&this.opensOn("hover")&&this.open}get canOpen(){return!this.disabled}renderPopupContent(){return html`<slot></slot>`}onTriggerKeyDown(_event){}isInsideLightDismissBoundary(path){const boundary=this.virtualAnchor?this.virtualInteractionBoundary:this.interactionBoundary;return path.includes(this)||this.triggerElement!=null&&path.includes(this.triggerElement)||boundary!=null&&boundary.isConnected&&boundary.ownerDocument===this.ownerDocument&&path.includes(boundary)}onPopupPositioned(){this.openedByInteraction||this.overlayHandle?.focusAutofocus()}willUpdate(changed){super.willUpdate(changed);const direction=this.effectiveDirection;this.directionChanged=direction!==this.positioningDirection,this.positioningDirection=direction;const lostVirtualElement=changed.has("virtualElement")&&liveVirtualElement(changed.get("virtualElement"))&&!liveVirtualElement(this.virtualElement);(this.anchorIdentity.lostAnchorProperty(changed,this.anchor)||lostVirtualElement)&&this.open&&!this.resolveAnchor()&&this.forceClose({focusTrigger:!1}),changed.has("open")&&!this.open&&(this.anchorPositioned=!1),changed.has("open")&&this.open&&(this.popupHidden=!1),(changed.has("anchor")||changed.has("virtualElement")||changed.has("for"))&&(this.anchorPositioned=!1)}updated(changed){if(super.updated(changed),changed.has("trigger")&&(this.cancelPendingTransition(),!this.opensOn("hover")&&!this.opensOn("focus")&&(this.pinned=!1)),changed.has("showDelay")&&this.delayTimer.pendingDirection==="show"&&this.requestDelayedTransition(!0,!0),changed.has("hideDelay")&&this.delayTimer.pendingDirection==="hide"&&this.requestDelayedTransition(!1,!0),(changed.has("for")||changed.has("forElement")||changed.has("anchor")||changed.has("open"))&&this.syncAnchorIdentityObservation(),changed.has("for")||changed.has("forElement")?this.syncInteractionTrigger():changed.has("trigger")&&this.syncTriggerA11y(),this.directionChanged||changed.has("open")||changed.has("placement")||changed.has("positioningStrategy")||changed.has("topLayer")||changed.has("hoverBridge")||changed.has("trigger")||changed.has("distance")||changed.has("skidding")||changed.has("for")||changed.has("forElement")||changed.has("anchor")||changed.has("virtualElement")||changed.has("arrow")||changed.has("withoutArrow")||changed.has("arrowPlacement")||changed.has("arrowPadding")||changed.has("popupRole")){if(this.open&&this.isConnected?this.positionPopup():changed.has("open")&&this.invalidatePositioning(),changed.has("open"))if(this.open)this.isConnected&&(this.startLightDismiss(),this.activatePopoverOverlay());else{this.pinned=!1,this.openedByInteraction=!1,this.cancelPendingTransition(),this.positionedAnchor=void 0,this.stopLightDismiss(),this.suppressTriggerFocusOpen=!0;try{this.overlayHandle?.deactivate()}finally{this.suppressTriggerFocusOpen=!1}this.overlayHandle=void 0,this.virtualAnchor=void 0,this.returnFocusTo=void 0,this.virtualInteractionBoundary=void 0,this.syncInteractionTrigger()}this.isConnected&&this.syncTriggerA11y()}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.triggerSlotElement;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectTriggerFromSlot(s))})}connectedCallback(){if(this.disconnecting){this.reconnectedWhileDisconnecting=!0;return}if(super.connectedCallback(),this.connectionSequence=++popoverConnectionSequence,this.addEventListener("focusin",this.onSurfaceFocusIn),this.addEventListener("focusout",this.onSurfaceFocusOut),this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers()),this.syncAnchorIdentityObservation(),this.id||(this.id=this.generatedHostId),this.observeHostId(),this.syncInteractionTrigger(),this.hasUpdated&&this.open){const wasPreviouslyActivated=this.overlayHandle?.isActive()===!0;this.startLightDismiss(),wasPreviouslyActivated?this.overlayHandle.resume():this.activatePopoverOverlay(),this.popupHidden=!1,this.positionPopup()}}disconnectedCallback(){this.disconnecting=!0;try{this.teardownOnDisconnect(),super.disconnectedCallback()}finally{this.disconnecting=!1}this.reconnectedWhileDisconnecting&&(this.reconnectedWhileDisconnecting=!1,this.isConnected&&this.connectedCallback())}teardownOnDisconnect(){this.connectionSequence=0,this.anchorIdentity.stop(),this.invalidatePositioning(),this.stopLightDismiss(),this.resetHostIdObserver(),this.overlayHandle?.suspend(),this.triggerElement?.removeEventListener("click",this.onTriggerClick),this.triggerElement?.removeEventListener("keydown",this.onExternalTriggerKeyDown),this.triggerElement&&this.unbindTriggerInteractions(this.triggerElement),this.releaseTriggerA11y(),this.triggerElement=void 0,this.removeEventListener("focusin",this.onSurfaceFocusIn),this.removeEventListener("focusout",this.onSurfaceFocusOut),this.cancelPendingTransition(),this.virtualInteractionBoundary=void 0,this.pinned=!1,this.openedByInteraction=!1,this.disclosure.reset(),this.popupHidden=!0}adoptedCallback(){super.adoptedCallback(),this.anchorIdentity.stop(),this.resetHostIdObserver(),this.releaseTriggerA11y()}syncAnchorIdentityObservation(){this.anchorIdentity.stop();const directAnchor=this.open?this.anchor??this.forElement??void 0:void 0;this.anchorIdentity.observe(this,directAnchor,this.for,()=>this.anchor,directAnchorRemoved=>{if(this.resolveInteractionTrigger()!==this.triggerElement&&this.syncInteractionTrigger(),!this.open)return;const nextAnchor=this.resolveAnchor();if(directAnchorRemoved&&!nextAnchor){this.forceClose({focusTrigger:!1});return}nextAnchor!==this.positionedAnchor&&this.positionPopup()})}get connectedForElement(){const element=this.forElement;return element?.isConnected&&element.ownerDocument===this.ownerDocument?element:void 0}resolveInteractionTrigger(){return resolveOverlayInteractionTrigger(this,this.virtualAnchor,this.slottedTrigger??this.connectedForElement,this.for)}syncInteractionTrigger(slotChanged=!1){if(!this.isConnected)return;const next=this.resolveInteractionTrigger();if(next===this.triggerElement&&!slotChanged){this.syncTriggerA11y();return}this.cancelPendingTransition();const previous=this.triggerElement;if(previous?.removeEventListener("click",this.onTriggerClick),previous?.removeEventListener("keydown",this.onExternalTriggerKeyDown),previous&&this.unbindTriggerInteractions(previous),this.triggerElement=next,this.triggerUpgrades.disconnect(),this.triggerElement&&this.triggerElement!==this.slottedTrigger&&(this.triggerElement.addEventListener("click",this.onTriggerClick),this.triggerElement.addEventListener("keydown",this.onExternalTriggerKeyDown)),this.triggerElement&&this.bindTriggerInteractions(this.triggerElement),this.syncTriggerA11y(),this.open){if(previous&&next&&this.openedByInteraction&&!this.pinned&&![next,this].some(element=>element.matches(":hover"))&&!this.isWithinPopoverSurface(deepActiveElementIn(this.ownerDocument))||!this.resolveAnchor()){this.forceClose({focusTrigger:!1});return}this.updatePopoverRestoreFocusTarget(),this.positionPopup()}else this.isHoverCard&&next&&next!==previous&&next.matches(":hover")&&this.requestDelayedTransition(!0,!0)}activatePopoverOverlay(){!this.isConnected||this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part~="popup"]'),onEscape:()=>{this.hide()},restoreFocusTo:this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger}))}updatePopoverRestoreFocusTarget(){const target=this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger;if(this.overlayHandle?.isActive()){this.overlayHandle.updateRestoreFocusTo(target);return}this.activatePopoverOverlay()}showAt(rect,options){const normalizedRect=normalizeVirtualRect(rect);if(!normalizedRect)return;const previousAnchor=this.virtualAnchor,previousReturnFocusTo=this.returnFocusTo,previousInteractionBoundary=this.virtualInteractionBoundary,bounds=new DOMRect(normalizedRect.x,normalizedRect.y,normalizedRect.width,normalizedRect.height);if(this.virtualAnchor={getBoundingClientRect:()=>bounds,contextElement:normalizedRect.contextElement},this.returnFocusTo=options?.returnFocusTo,this.virtualInteractionBoundary=options?.interactionBoundary,this.syncInteractionTrigger(),this.open){this.updatePopoverRestoreFocusTarget(),this.positionPopup();return}this.show(),!this.open&&(this.virtualAnchor=previousAnchor,this.returnFocusTo=previousReturnFocusTo,this.virtualInteractionBoundary=previousInteractionBoundary,this.syncInteractionTrigger())}resolveAnchor(){return resolveOverlayAnchor(this,{virtualAnchor:this.virtualAnchor,anchor:liveVirtualElement(this.virtualElement)?this.virtualElement:this.anchor,for:this.connectedForElement?"":this.for,trigger:this.triggerElement})}positionPopup(){if(!this.renderRoot)return;this.invalidatePositioning();const popup=this.renderRoot.querySelector('[part~="popup"]'),arrowElement=this.renderRoot.querySelector('[part~="arrow"]'),bridgeElement=this.renderRoot.querySelector('[part~="hover-bridge"]'),anchor=this.resolveAnchor();if(!this.open||!anchor||!popup){this.positionedAnchor=void 0,this.anchorPositioned=!1;return}anchor!==this.positionedAnchor&&(this.anchorPositioned=!1);const generation=this.positioningGeneration;if(this.openedByInteraction&&!this.anchorPositioned){this.cleanup=Object.assign(()=>this.transientRevealFrame.cancel(),{ready:this.transientRevealFrame.wait().then(current=>!current||generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor?!1:(this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement),this.cleanup?.ready??!1))});return}this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement)}invalidatePositioning(){this.positioningGeneration++,this.cleanup?.(),this.cleanup=void 0}startPositioning(generation,anchor,popup,arrowElement,bridgeElement){this.placedTopLayer=syncTopLayerRelease(popup,this.placedTopLayer,this.topLayer);const operation=deferredPlaceReady(anchor,popup,{placement:rtlAwarePlacement(this.placement,this),strategy:this.topLayer?"fixed":this.resolvedPositioningStrategy,topLayer:this.topLayer,offset:finiteNumber(this.distance,this.defaultDistance),skidding:finiteNumber(this.skidding,0),sync:this.positioningSync,arrow:this.rendersArrow&&arrowElement?arrowElement:void 0,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),hoverBridge:this.rendersHoverBridge&&bridgeElement?bridgeElement:void 0,onPlaced:({placement,arrow})=>{if(generation!==this.positioningGeneration)return;const becamePositioned=!this.anchorPositioned||this.positionedAnchor!==anchor;this.positionedAnchor=anchor,this.anchorPositioned=!0;const side=applyOverlayArrow(arrowElement,{placement,coords:arrow,enabled:this.rendersArrow,arrowPlacement:this.arrowPlacement,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),rtl:this.effectiveDirection==="rtl",sizeProperty:"--arrow-size",fallbackSizeProperty:"--lr-overlay-arrow-size"});side!==this.resolvedSide&&(this.resolvedSide=side),this.updateComplete.then(()=>{generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor||becamePositioned&&this.onPopupPositioned()})}});this.cleanup=operation,operation.ready.then(positioned=>{!positioned&&generation===this.positioningGeneration&&this.open&&this.forceClose({focusTrigger:!1})})}syncTriggerA11y(){const popup=this.renderRoot?.querySelector('[part~="popup"]')??null,contribution={attributes:{"aria-haspopup":this.triggerPopupRole==="none"?null:this.triggerPopupRole,"aria-expanded":this.open?"true":"false"},controls:popup?[popup]:[]},accessibleTrigger=this.accessibleTrigger;this.observeAccessibleTrigger(accessibleTrigger);const semanticTrigger=accessibleTrigger&&!this.isHoverCard&&supportsTriggerExpansion(accessibleTrigger)?accessibleTrigger:null;this.accessibleTriggerAria?this.accessibleTriggerAria.update(semanticTrigger,contribution):this.accessibleTriggerAria=acquireAriaOwnership(semanticTrigger,contribution),this.overlayHandle?.isActive()&&!this.virtualAnchor&&this.overlayHandle.updateRestoreFocusTo(accessibleTrigger)}get accessibleTrigger(){const trigger=this.triggerElement;return trigger?resolveOverlayAccessibleTrigger(trigger):null}observeAccessibleTrigger(target){this.accessibleTriggerObserver?.disconnect();const trigger=this.triggerElement;if(!trigger||!this.isConnected)return;const view=this.ownerDocument.defaultView;if(view?.MutationObserver){this.accessibleTriggerObserver??=new view.MutationObserver(()=>{this.isConnected&&this.syncTriggerA11y()});const roots=new Set([trigger]);trigger.shadowRoot&&roots.add(trigger.shadowRoot);let current=target;for(;current&&current!==trigger;){const root=current.getRootNode();if(root.nodeType!==11||!("host"in root))break;roots.add(root),current=root.host}for(const root of roots)this.accessibleTriggerObserver.observe(root,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","tabindex","disabled","href","type"]})}this.triggerUpgrades.observeElement(trigger)}releaseTriggerA11y(){this.accessibleTriggerObserver?.disconnect(),this.accessibleTriggerObserver=void 0,this.triggerUpgrades.disconnect(),this.accessibleTriggerAria?.release(),this.accessibleTriggerAria=void 0}collectTriggerFromSlot(slot){const next=slot.assignedElements({flatten:!0})[0];next!==this.slottedTrigger&&(this.slottedTrigger=next,this.syncInteractionTrigger(!0))}requestInteractionClose(next){this.pinned||this.isWithinPopoverSurface(next)||this.hasFocusWithinSurface()||this.requestDelayedTransition(!1)}isWithinPopoverSurface(target){if(target===null||target.nodeType!==1)return!1;const element=target;if(composedContains(this,element))return!0;const popup=this.renderRoot?.querySelector('[part~="popup"]')??null;return popup&&composedContains(popup,element)?!0:this.triggerElement!=null&&composedContains(this.triggerElement,element)}hasFocusWithinSurface(){const active=deepActiveElementIn(this.ownerDocument);return active===null||this.triggerElement&&composedContains(this.triggerElement,active)?!1:this.isWithinPopoverSurface(active)}requestDelayedTransition(next,deferImmediate=!1){if(this.cancelPendingTransition(),next&&!this.canOpen)return;const commit=()=>{next?(this.openedByInteraction=!0,this.show()):this.hide()},delay=Math.max(0,finiteDuration(next?this.showDelay:this.hideDelay,DEFAULT_TRIGGER_DELAY)),view=this.ownerDocument.defaultView;if(!view||delay<=0&&!deferImmediate){commit();return}this.delayTimer.schedule(view,delay,next?"show":"hide",commit)}cancelPendingTransition(){this.delayTimer.cancel()}triggerNeedsOwnFocusListeners(trigger){return!composedContains(this,trigger)}bindTriggerInteractions(trigger){trigger.addEventListener("mouseenter",this.onTriggerPointerEnter),trigger.addEventListener("mouseleave",this.onTriggerPointerLeave),this.triggerNeedsOwnFocusListeners(trigger)&&(trigger.addEventListener("focusin",this.onSurfaceFocusIn),trigger.addEventListener("focusout",this.onSurfaceFocusOut))}unbindTriggerInteractions(trigger){trigger.removeEventListener("mouseenter",this.onTriggerPointerEnter),trigger.removeEventListener("mouseleave",this.onTriggerPointerLeave),trigger.removeEventListener("focusin",this.onSurfaceFocusIn),trigger.removeEventListener("focusout",this.onSurfaceFocusOut)}startLightDismiss(){this.outsidePress.bind()}stopLightDismiss(){this.outsidePress.unbind()}observeHostId(){const ownerDocument=this.ownerDocument;if(this.hostIdObserver&&this.hostIdObserverDocument===ownerDocument)return;this.resetHostIdObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor||!this.isConnected)return;const generation=this.hostIdObserverGeneration,observer=new MutationObserverCtor(()=>{this.hostIdObserver!==observer||this.hostIdObserverDocument!==ownerDocument||this.hostIdObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.id||(this.id=this.generatedHostId),this.syncTriggerA11y())});this.hostIdObserver=observer,this.hostIdObserverDocument=ownerDocument,observer.observe(this,{attributes:!0,attributeFilter:["id"]})}resetHostIdObserver(){this.hostIdObserverGeneration+=1,this.hostIdObserver?.disconnect(),this.hostIdObserver=void 0,this.hostIdObserverDocument=void 0}setOpen(next){if(this._open===next)return;const old=this._open;this._open=next,setCustomState(this.popoverInternals,"open",next),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}show(){return this.canOpen?this.disclosure.show(()=>!this.closePopoverPeers()):Promise.resolve()}hide(options){return this.disclosure.hide(()=>this.prepareClose(options))}hasPopoverAncestor(peer){const trigger=this.triggerElement??this.resolveInteractionTrigger();return composedContains(peer,this)||trigger!==void 0&&composedContains(peer,trigger)}closePopoverPeers(){if(this.virtualAnchor||this.localName!==tag("popover"))return!0;const root=this.getRootNode();for(const peer of root.querySelectorAll(tag("popover")))if(!(peer===this||!peer.open||peer.virtualAnchor)&&!this.hasPopoverAncestor(peer)&&(peer.hide({focusTrigger:!1}),peer.open))return!1;return!0}reconcileInitialPopoverPeers(){if(!this.isConnected||!this._open||this.virtualAnchor||this.localName!==tag("popover"))return;const root=this.getRootNode(),peers=[];let winner;for(const peer of root.querySelectorAll(tag("popover")))!peer.isConnected||!peer._open||peer.virtualAnchor||!(peer.connectionSequence>0)||(peers.push(peer),(!winner||peer.connectionSequence>winner.connectionSequence)&&(winner=peer));if(winner!==this){winner?.hasPopoverAncestor(this)||this.closeForInitialPeerReconciliation();return}for(const peer of peers)peer!==this&&!this.hasPopoverAncestor(peer)&&peer.closeForInitialPeerReconciliation()}closeForInitialPeerReconciliation(){this._open&&(this.disclosure.reset(),this.invalidatePositioning(),this.stopLightDismiss(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.positionedAnchor=void 0,this.anchorPositioned=!1,this.popupHidden=!0,this.returnFocusTo=void 0,this.setOpen(!1),this.syncOpenAttribute())}forceClose(options){return this.disclosure.forceClose(()=>this.prepareClose(options))}prepareClose(options){options?.focusTrigger===!1&&(this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0),this.anchorPositioned||(this.popupHidden=!0)}emitCancelableLifecycle(name){return this.emit(name,null,{cancelable:!0})}emitSettledLifecycle(name){return this.emit(name)}render(){const popupRole=this.popupSurfaceRole;return html`
1
+ import{__decorate}from"tslib";import{AnchoredDisclosureController}from"../../../internal/anchored-disclosure-controller.js";import{findDeclarativeAction,isDeclarativeActionInert}from"../../../internal/declarative-overlay-action.js";import{DocumentPointerListener}from"../../../internal/document-pointer.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{normalizeLabel}from"../../../internal/accessible-name.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{acquireAriaOwnership}from"../../../internal/aria-ownership.js";import{tag}from"../../../internal/prefix.js";import{PositioningStrategyState,positioningStrategyConverter,resolveEffectivePositioningStrategy}from"../../../internal/positioning-strategy.js";import{deferredPlaceReady,syncTopLayerRelease,waitForDeferredPlacement}from"../../../internal/anchored-overlay-runtime.js";import{OwnerAnimationFrameWaiter}from"../../../internal/owner-animation-frame.js";import{rtlAwarePlacement}from"../../../internal/rtl.js";import{finiteDuration,finiteNumber}from"../../../internal/numbers.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{isKeyboardFocusEvent}from"../../../internal/focus-modality.js";import{declaredDefaultConverter,literalSetConverter,omittedEmptyStringConverter,blankNumberConverter}from"../../../internal/converters.js";import{activateNonmodalOverlay,composedContains}from"../../../internal/nonmodal-overlay-manager.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{applyOverlayArrow}from"./overlay-arrow.js";import{liveVirtualElement,normalizeVirtualRect,OverlayAnchorIdentity,OverlayDelayTimer,resolveOverlayAnchor,resolveOverlayAccessibleTrigger,resolveOverlayInteractionTrigger}from"../../../internal/overlay-shared.js";import{styles}from"./overlay.styles.js";import{glassPopoverStyles}from"./popover-glass.styles.js";import{LYRA_DEFAULT_popover}from"../../../internal/default-strings/overlays.generated.js";import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";const DEFAULT_DISTANCE=8,EXPANDABLE_TRIGGER_ROLES=new Set(["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","switch"]);function supportsTriggerExpansion(element){const role=element.getAttribute("role")?.trim().split(/\s+/)[0];return role?EXPANDABLE_TRIGGER_ROLES.has(role):element.matches("button, a[href], select, summary")?!0:element.localName==="input"&&["button","submit","reset","image","checkbox"].includes(element.type)}let popoverConnectionSequence=0;const POPUP_ROLE=literalSetConverter(["dialog","menu","none"],"dialog"),POPOVER_TRIGGER_KEYWORDS=["click","hover","focus","manual","hover-card"];function normalizeTriggerList(next){const keywords=[];for(const token of String(next??"").toLowerCase().split(/\s+/)){const keyword=token;POPOVER_TRIGGER_KEYWORDS.includes(keyword)&&!keywords.includes(keyword)&&keywords.push(keyword)}return keywords.length>0?keywords.join(" "):"click"}const DEFAULT_TRIGGER_DELAY=0;class LyraPopover extends LyraElement{static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel,popover:LYRA_DEFAULT_popover}}constructor(){super(),this._open=!1,this.placement="top",this.strategy=new PositioningStrategyState(this,this.defaultPositioningStrategy),this.topLayer=!1,this.distance=8,this.skidding=0,this._for="",this.forElement=null,this.anchor=null,this.virtualElement=null,this.interactionBoundary=null,this.withoutArrow=!1,this.arrowPlacement="anchor",this.arrowPadding=0,this.fullWidthTrigger=!1,this._trigger="click",this.showDelay=0,this.hideDelay=0,this.hoverBridge=!1,this.accessibleLabel="",this._popupRole="dialog",this._disabled=!1,this.openedByInteraction=!1,this.pinned=!1,this.suppressTriggerFocusOpen=!1,this.delayTimer=new OverlayDelayTimer,this.resolvedSide="bottom",this.anchorPositioned=!1,this.popupHidden=!0,this.disconnecting=!1,this.reconnectedWhileDisconnecting=!1,this.directionChanged=!1,this.anchorIdentity=new OverlayAnchorIdentity,this.triggerUpgrades=new CustomElementUpgradeObserver(()=>{this.isConnected&&this.syncTriggerA11y()}),this.transientRevealFrame=new OwnerAnimationFrameWaiter(this),this.positioningGeneration=0,this.generatedHostId=nextId("popover"),this.popupId=nextId("popover-popup"),this.outsidePress=new DocumentPointerListener(this,event=>this.onDocumentPointer(event)),this.hostIdObserverGeneration=0,this.connectionSequence=0,this.popoverInternals=attachInternalsSafely(this),this.onExternalTriggerKeyDown=event=>{this.onTriggerKeyDown(event)},this.onTriggerSlotChange=event=>{this.collectTriggerFromSlot(event.target)},this.onTriggerClick=()=>{if(!this.virtualAnchor&&(this.syncTriggerA11y(),!this.isManualTrigger)){if(this.cancelPendingTransition(),this.isHoverCard){this.open&&this.hide({focusTrigger:!1});return}if(this.opensOn("click")&&!this.opensOn("hover")&&!this.opensOn("focus")){this.open?this.hide():this.show();return}if(this.open&&this.pinned){this.hide();return}this.open||(this.openedByInteraction=!1,this.show()),this.pinned=this.open}},this.onTriggerPointerEnter=()=>{this.opensOn("hover")&&this.requestDelayedTransition(!0)},this.onTriggerPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupPointerEnter=()=>{!this.opensOn("hover")||!this.open||this.cancelPendingTransition()},this.onPopupPointerLeave=event=>{this.opensOn("hover")&&this.requestInteractionClose(event.relatedTarget)},this.onSurfaceFocusIn=event=>{!this.opensOn("focus")||this.suppressTriggerFocusOpen||(!this.open||this.triggerElement!=null&&event.composedPath().includes(this.triggerElement))&&!isKeyboardFocusEvent(event)||this.requestDelayedTransition(!0)},this.onSurfaceFocusOut=event=>{this.opensOn("focus")&&this.requestInteractionClose(event.relatedTarget)},this.onPopupClick=event=>{if(event.defaultPrevented)return;const path=event.composedPath(),hostIndex=path.indexOf(this);if(hostIndex<0)return;const closeAction=findDeclarativeAction(path,"data-popover",hostIndex,value=>value==="close");closeAction&&(event.stopPropagation(),!isDeclarativeActionInert(closeAction)&&this.hide())},this.onDocumentPointer=event=>{this.overlayHandle?.isTopmost()&&(this.isInsideLightDismissBoundary(event.composedPath())||this.hide())},this.disclosure=new AnchoredDisclosureController({host:this,isOpen:()=>this._open,setOpen:value=>this.setOpen(value),emit:name=>name==="lr-show"||name==="lr-hide"?this.emitCancelableLifecycle(name).defaultPrevented:this.emitSettledLifecycle(name).defaultPrevented,popup:()=>this.renderRoot.querySelector('[part~="popup"]'),readyToShow:async isCurrent=>{const positioned=await waitForDeferredPlacement(()=>this.cleanup);return isCurrent()&&this.open&&positioned&&this.anchorPositioned},animate:(showing,popup)=>{const offset="translateY(var(--lr-size-neg-0-25rem))";return animateRegistered(this,popup,`${this.animationNamespace}.${showing?"show":"hide"}`,this.effectiveDirection,{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:this.animationDurationProperties(showing),easingProperties:["--lr-easing-standard"]})},afterHide:()=>{this.popupHidden=!0}}),new GlassScrollLayer(this,'[part~="popup"]')}static{this.styles=[LyraElement.styles,styles,glassPopoverStyles]}get open(){return this._open}set open(next){const normalized=!!next&&this.canOpen;if(normalized!==this._open){if(!this.hasUpdated){this.setOpen(normalized),this.isConnected&&this.connectionSequence>0&&this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers());return}normalized?this.show():this.hide()}}get positioningStrategy(){return this.strategy.value}set positioningStrategy(next){const previous=this.strategy.value;this.strategy.set(next),previous!==this.strategy.value&&this.onPositioningStrategyChanged(previous,this.strategy.value)}onPositioningStrategyChanged(_previous,_next){}get for(){return this._for}set for(next){this._for=next??""}get trigger(){return this._trigger}set trigger(next){const normalized=normalizeTriggerList(next);if(normalized===this._trigger)return;const old=this._trigger;this._trigger=normalized,this.requestUpdate("trigger",old)}get triggerKeywords(){return this._trigger.split(" ")}get isManualTrigger(){return this.triggerKeywords.includes("manual")}get isHoverCard(){return!this.isManualTrigger&&this.triggerKeywords.includes("hover-card")}opensOn(keyword){return this.isHoverCard?keyword==="hover"||keyword==="focus":!this.isManualTrigger&&this.triggerKeywords.includes(keyword)}get popupRole(){return this._popupRole}set popupRole(next){const normalized=POPUP_ROLE.normalize(next);if(normalized===this._popupRole)return;const old=this._popupRole;this._popupRole=normalized,this.requestUpdate("popupRole",old)}get disabled(){return this._disabled}set disabled(next){const normalized=!!next;if(normalized===this._disabled)return;const old=this._disabled;this._disabled=normalized,this.requestUpdate("disabled",old),normalized&&this.open&&(this.hasUpdated?this.hide():this.open=!1)}get defaultDistance(){return DEFAULT_DISTANCE}get defaultPositioningStrategy(){return"fixed"}get resolvedPositioningStrategy(){return resolveEffectivePositioningStrategy(this,this.strategy.authored,this.defaultPositioningStrategy)}get positioningSync(){}get animationNamespace(){return"popover"}animationDurationProperties(showing){return[showing?"--show-duration":"--hide-duration","--lr-duration-fast"]}get popupPartNames(){return["popup","dialog","popup__popup"].join(" ")}get contentPartNames(){return["content","body"].join(" ")}get triggerPopupRole(){return this.popupRole}get popupSurfaceRole(){return this.popupRole==="none"?void 0:this.popupRole}get effectivePopupLabel(){return hostAriaLabel(this)??normalizeLabel(this.accessibleLabel)??this.localize(this.triggerPopupRole==="menu"?"menuLabel":"popover")}get rendersArrow(){return!this.withoutArrow}get arrowPartNames(){return"arrow popup__arrow"}get rendersHoverBridge(){return this.hoverBridge&&this.opensOn("hover")&&this.open}get canOpen(){return!this.disabled}renderPopupContent(){return html`<slot></slot>`}onTriggerKeyDown(_event){}isInsideLightDismissBoundary(path){const boundary=this.virtualAnchor?this.virtualInteractionBoundary:this.interactionBoundary;return path.includes(this)||this.triggerElement!=null&&path.includes(this.triggerElement)||boundary!=null&&boundary.isConnected&&boundary.ownerDocument===this.ownerDocument&&path.includes(boundary)}onPopupPositioned(){this.openedByInteraction||this.overlayHandle?.focusAutofocus()}willUpdate(changed){super.willUpdate(changed);const direction=this.effectiveDirection;this.directionChanged=direction!==this.positioningDirection,this.positioningDirection=direction;const lostVirtualElement=changed.has("virtualElement")&&liveVirtualElement(changed.get("virtualElement"))&&!liveVirtualElement(this.virtualElement);(this.anchorIdentity.lostAnchorProperty(changed,this.anchor)||lostVirtualElement)&&this.open&&!this.resolveAnchor()&&this.forceClose({focusTrigger:!1}),changed.has("open")&&!this.open&&(this.anchorPositioned=!1),changed.has("open")&&this.open&&(this.popupHidden=!1),(changed.has("anchor")||changed.has("virtualElement")||changed.has("for"))&&(this.anchorPositioned=!1)}updated(changed){if(super.updated(changed),changed.has("trigger")&&(this.cancelPendingTransition(),!this.opensOn("hover")&&!this.opensOn("focus")&&(this.pinned=!1)),changed.has("showDelay")&&this.delayTimer.pendingDirection==="show"&&this.requestDelayedTransition(!0,!0),changed.has("hideDelay")&&this.delayTimer.pendingDirection==="hide"&&this.requestDelayedTransition(!1,!0),(changed.has("for")||changed.has("forElement")||changed.has("anchor")||changed.has("open"))&&this.syncAnchorIdentityObservation(),changed.has("for")||changed.has("forElement")?this.syncInteractionTrigger():changed.has("trigger")&&this.syncTriggerA11y(),this.directionChanged||changed.has("open")||changed.has("placement")||changed.has("positioningStrategy")||changed.has("topLayer")||changed.has("hoverBridge")||changed.has("trigger")||changed.has("distance")||changed.has("skidding")||changed.has("for")||changed.has("forElement")||changed.has("anchor")||changed.has("virtualElement")||changed.has("arrow")||changed.has("withoutArrow")||changed.has("arrowPlacement")||changed.has("arrowPadding")||changed.has("popupRole")){if(this.open&&this.isConnected?this.positionPopup():changed.has("open")&&this.invalidatePositioning(),changed.has("open"))if(this.open)this.isConnected&&(this.startLightDismiss(),this.activatePopoverOverlay());else{this.pinned=!1,this.openedByInteraction=!1,this.cancelPendingTransition(),this.positionedAnchor=void 0,this.stopLightDismiss(),this.suppressTriggerFocusOpen=!0;try{this.overlayHandle?.deactivate()}finally{this.suppressTriggerFocusOpen=!1}this.overlayHandle=void 0,this.virtualAnchor=void 0,this.returnFocusTo=void 0,this.virtualInteractionBoundary=void 0,this.syncInteractionTrigger()}this.isConnected&&this.syncTriggerA11y()}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.triggerSlotElement;queueMicrotask(()=>{collectInitialSlotAssignment(slot,s=>this.collectTriggerFromSlot(s))})}connectedCallback(){if(this.disconnecting){this.reconnectedWhileDisconnecting=!0;return}if(super.connectedCallback(),this.connectionSequence=++popoverConnectionSequence,this.addEventListener("focusin",this.onSurfaceFocusIn),this.addEventListener("focusout",this.onSurfaceFocusOut),this.updateBrowserDerivedState(()=>this.reconcileInitialPopoverPeers()),this.syncAnchorIdentityObservation(),this.id||(this.id=this.generatedHostId),this.observeHostId(),this.syncInteractionTrigger(),this.hasUpdated&&this.open){const wasPreviouslyActivated=this.overlayHandle?.isActive()===!0;this.startLightDismiss(),wasPreviouslyActivated?this.overlayHandle.resume():this.activatePopoverOverlay(),this.popupHidden=!1,this.positionPopup()}}disconnectedCallback(){this.disconnecting=!0;try{this.teardownOnDisconnect(),super.disconnectedCallback()}finally{this.disconnecting=!1}this.reconnectedWhileDisconnecting&&(this.reconnectedWhileDisconnecting=!1,this.isConnected&&this.connectedCallback())}teardownOnDisconnect(){this.connectionSequence=0,this.anchorIdentity.stop(),this.invalidatePositioning(),this.stopLightDismiss(),this.resetHostIdObserver(),this.overlayHandle?.suspend(),this.triggerElement?.removeEventListener("click",this.onTriggerClick),this.triggerElement?.removeEventListener("keydown",this.onExternalTriggerKeyDown),this.triggerElement&&this.unbindTriggerInteractions(this.triggerElement),this.releaseTriggerA11y(),this.triggerElement=void 0,this.removeEventListener("focusin",this.onSurfaceFocusIn),this.removeEventListener("focusout",this.onSurfaceFocusOut),this.cancelPendingTransition(),this.virtualInteractionBoundary=void 0,this.pinned=!1,this.openedByInteraction=!1,this.disclosure.reset(),this.popupHidden=!0}adoptedCallback(){super.adoptedCallback(),this.anchorIdentity.stop(),this.resetHostIdObserver(),this.releaseTriggerA11y()}syncAnchorIdentityObservation(){this.anchorIdentity.stop();const directAnchor=this.open?this.anchor??this.forElement??void 0:void 0;this.anchorIdentity.observe(this,directAnchor,this.for,()=>this.anchor,directAnchorRemoved=>{if(this.resolveInteractionTrigger()!==this.triggerElement&&this.syncInteractionTrigger(),!this.open)return;const nextAnchor=this.resolveAnchor();if(directAnchorRemoved&&!nextAnchor){this.forceClose({focusTrigger:!1});return}nextAnchor!==this.positionedAnchor&&this.positionPopup()})}get connectedForElement(){const element=this.forElement;return element?.isConnected&&element.ownerDocument===this.ownerDocument?element:void 0}resolveInteractionTrigger(){return resolveOverlayInteractionTrigger(this,this.virtualAnchor,this.slottedTrigger??this.connectedForElement,this.for)}syncInteractionTrigger(slotChanged=!1){if(!this.isConnected)return;const next=this.resolveInteractionTrigger();if(next===this.triggerElement&&!slotChanged){this.syncTriggerA11y();return}this.cancelPendingTransition();const previous=this.triggerElement;if(previous?.removeEventListener("click",this.onTriggerClick),previous?.removeEventListener("keydown",this.onExternalTriggerKeyDown),previous&&this.unbindTriggerInteractions(previous),this.triggerElement=next,this.triggerUpgrades.disconnect(),this.triggerElement&&this.triggerElement!==this.slottedTrigger&&(this.triggerElement.addEventListener("click",this.onTriggerClick),this.triggerElement.addEventListener("keydown",this.onExternalTriggerKeyDown)),this.triggerElement&&this.bindTriggerInteractions(this.triggerElement),this.syncTriggerA11y(),this.open){if(previous&&next&&this.openedByInteraction&&!this.pinned&&![next,this].some(element=>element.matches(":hover"))&&!this.isWithinPopoverSurface(deepActiveElementIn(this.ownerDocument))||!this.resolveAnchor()){this.forceClose({focusTrigger:!1});return}this.updatePopoverRestoreFocusTarget(),this.positionPopup()}else this.isHoverCard&&next&&next!==previous&&next.matches(":hover")&&this.requestDelayedTransition(!0,!0)}activatePopoverOverlay(){!this.isConnected||this.overlayHandle?.isActive()||(this.overlayHandle=activateNonmodalOverlay({host:this,panel:()=>this.renderRoot.querySelector('[part~="popup"]'),onEscape:()=>{this.hide()},restoreFocusTo:this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger}))}updatePopoverRestoreFocusTarget(){const target=this.virtualAnchor?this.returnFocusTo??null:this.accessibleTrigger;if(this.overlayHandle?.isActive()){this.overlayHandle.updateRestoreFocusTo(target);return}this.activatePopoverOverlay()}showAt(rect,options){const normalizedRect=normalizeVirtualRect(rect);if(!normalizedRect)return;const previousAnchor=this.virtualAnchor,previousReturnFocusTo=this.returnFocusTo,previousInteractionBoundary=this.virtualInteractionBoundary,bounds=new DOMRect(normalizedRect.x,normalizedRect.y,normalizedRect.width,normalizedRect.height);if(this.virtualAnchor={getBoundingClientRect:()=>bounds,contextElement:normalizedRect.contextElement},this.returnFocusTo=options?.returnFocusTo,this.virtualInteractionBoundary=options?.interactionBoundary,this.syncInteractionTrigger(),this.open){this.updatePopoverRestoreFocusTarget(),this.positionPopup();return}this.show(),!this.open&&(this.virtualAnchor=previousAnchor,this.returnFocusTo=previousReturnFocusTo,this.virtualInteractionBoundary=previousInteractionBoundary,this.syncInteractionTrigger())}resolveAnchor(){return resolveOverlayAnchor(this,{virtualAnchor:this.virtualAnchor,anchor:liveVirtualElement(this.virtualElement)?this.virtualElement:this.anchor,for:this.connectedForElement?"":this.for,trigger:this.triggerElement})}positionPopup(){if(!this.renderRoot)return;this.invalidatePositioning();const popup=this.renderRoot.querySelector('[part~="popup"]'),arrowElement=this.renderRoot.querySelector('[part~="arrow"]'),bridgeElement=this.renderRoot.querySelector('[part~="hover-bridge"]'),anchor=this.resolveAnchor();if(!this.open||!anchor||!popup){this.positionedAnchor=void 0,this.anchorPositioned=!1;return}anchor!==this.positionedAnchor&&(this.anchorPositioned=!1);const generation=this.positioningGeneration;if(this.openedByInteraction&&!this.anchorPositioned){this.cleanup=Object.assign(()=>this.transientRevealFrame.cancel(),{ready:this.transientRevealFrame.wait().then(current=>!current||generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor?!1:(this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement),this.cleanup?.ready??!1))});return}this.startPositioning(generation,anchor,popup,arrowElement,bridgeElement)}invalidatePositioning(){this.positioningGeneration++,this.cleanup?.(),this.cleanup=void 0}startPositioning(generation,anchor,popup,arrowElement,bridgeElement){this.placedTopLayer=syncTopLayerRelease(popup,this.placedTopLayer,this.topLayer);const operation=deferredPlaceReady(anchor,popup,{placement:rtlAwarePlacement(this.placement,this),strategy:this.topLayer?"fixed":this.resolvedPositioningStrategy,topLayer:this.topLayer,offset:finiteNumber(this.distance,this.defaultDistance),skidding:finiteNumber(this.skidding,0),sync:this.positioningSync,arrow:this.rendersArrow&&arrowElement?arrowElement:void 0,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),hoverBridge:this.rendersHoverBridge&&bridgeElement?bridgeElement:void 0,onPlaced:({placement,arrow})=>{if(generation!==this.positioningGeneration)return;const becamePositioned=!this.anchorPositioned||this.positionedAnchor!==anchor;this.positionedAnchor=anchor,this.anchorPositioned=!0;const side=applyOverlayArrow(arrowElement,{placement,coords:arrow,enabled:this.rendersArrow,arrowPlacement:this.arrowPlacement,arrowPadding:Math.max(0,finiteNumber(this.arrowPadding,0)),rtl:this.effectiveDirection==="rtl",sizeProperty:"--arrow-size",fallbackSizeProperty:"--lr-overlay-arrow-size"});side!==this.resolvedSide&&(this.resolvedSide=side),this.updateComplete.then(()=>{generation!==this.positioningGeneration||!this.open||this.resolveAnchor()!==anchor||becamePositioned&&this.onPopupPositioned()})}});this.cleanup=operation,operation.ready.then(positioned=>{!positioned&&generation===this.positioningGeneration&&this.open&&this.forceClose({focusTrigger:!1})})}syncTriggerA11y(){const popup=this.renderRoot?.querySelector('[part~="popup"]')??null,contribution={attributes:{"aria-haspopup":this.triggerPopupRole==="none"?null:this.triggerPopupRole,"aria-expanded":this.open?"true":"false"},controls:popup?[popup]:[]},accessibleTrigger=this.accessibleTrigger;this.observeAccessibleTrigger(accessibleTrigger);const semanticTrigger=accessibleTrigger&&!this.isHoverCard&&supportsTriggerExpansion(accessibleTrigger)?accessibleTrigger:null;this.accessibleTriggerAria?this.accessibleTriggerAria.update(semanticTrigger,contribution):this.accessibleTriggerAria=acquireAriaOwnership(semanticTrigger,contribution),this.overlayHandle?.isActive()&&!this.virtualAnchor&&this.overlayHandle.updateRestoreFocusTo(accessibleTrigger)}get accessibleTrigger(){const trigger=this.triggerElement;return trigger?resolveOverlayAccessibleTrigger(trigger):null}observeAccessibleTrigger(target){this.accessibleTriggerObserver?.disconnect();const trigger=this.triggerElement;if(!trigger||!this.isConnected)return;const view=this.ownerDocument.defaultView;if(view?.MutationObserver){this.accessibleTriggerObserver??=new view.MutationObserver(()=>{this.isConnected&&this.syncTriggerA11y()});const roots=new Set([trigger]);trigger.shadowRoot&&roots.add(trigger.shadowRoot);let current=target;for(;current&&current!==trigger;){const root=current.getRootNode();if(root.nodeType!==11||!("host"in root))break;roots.add(root),current=root.host}for(const root of roots)this.accessibleTriggerObserver.observe(root,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","tabindex","disabled","href","type"]})}this.triggerUpgrades.observeElement(trigger)}releaseTriggerA11y(){this.accessibleTriggerObserver?.disconnect(),this.accessibleTriggerObserver=void 0,this.triggerUpgrades.disconnect(),this.accessibleTriggerAria?.release(),this.accessibleTriggerAria=void 0}collectTriggerFromSlot(slot){const next=slot.assignedElements({flatten:!0})[0];next!==this.slottedTrigger&&(this.slottedTrigger=next,this.syncInteractionTrigger(!0))}requestInteractionClose(next){this.pinned||this.isWithinPopoverSurface(next)||this.hasFocusWithinSurface()||this.requestDelayedTransition(!1)}isWithinPopoverSurface(target){if(target===null||target.nodeType!==1)return!1;const element=target;if(composedContains(this,element))return!0;const popup=this.renderRoot?.querySelector('[part~="popup"]')??null;return popup&&composedContains(popup,element)?!0:this.triggerElement!=null&&composedContains(this.triggerElement,element)}hasFocusWithinSurface(){const active=deepActiveElementIn(this.ownerDocument);return active===null||this.triggerElement&&composedContains(this.triggerElement,active)?!1:this.isWithinPopoverSurface(active)}requestDelayedTransition(next,deferImmediate=!1){if(this.cancelPendingTransition(),next&&!this.canOpen)return;const commit=()=>{next?(this.openedByInteraction=!0,this.show()):this.hide()},delay=Math.max(0,finiteDuration(next?this.showDelay:this.hideDelay,DEFAULT_TRIGGER_DELAY)),view=this.ownerDocument.defaultView;if(!view||delay<=0&&!deferImmediate){commit();return}this.delayTimer.schedule(view,delay,next?"show":"hide",commit)}cancelPendingTransition(){this.delayTimer.cancel()}triggerNeedsOwnFocusListeners(trigger){return!composedContains(this,trigger)}bindTriggerInteractions(trigger){trigger.addEventListener("mouseenter",this.onTriggerPointerEnter),trigger.addEventListener("mouseleave",this.onTriggerPointerLeave),this.triggerNeedsOwnFocusListeners(trigger)&&(trigger.addEventListener("focusin",this.onSurfaceFocusIn),trigger.addEventListener("focusout",this.onSurfaceFocusOut))}unbindTriggerInteractions(trigger){trigger.removeEventListener("mouseenter",this.onTriggerPointerEnter),trigger.removeEventListener("mouseleave",this.onTriggerPointerLeave),trigger.removeEventListener("focusin",this.onSurfaceFocusIn),trigger.removeEventListener("focusout",this.onSurfaceFocusOut)}startLightDismiss(){this.outsidePress.bind()}stopLightDismiss(){this.outsidePress.unbind()}observeHostId(){const ownerDocument=this.ownerDocument;if(this.hostIdObserver&&this.hostIdObserverDocument===ownerDocument)return;this.resetHostIdObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor||!this.isConnected)return;const generation=this.hostIdObserverGeneration,observer=new MutationObserverCtor(()=>{this.hostIdObserver!==observer||this.hostIdObserverDocument!==ownerDocument||this.hostIdObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.id||(this.id=this.generatedHostId),this.syncTriggerA11y())});this.hostIdObserver=observer,this.hostIdObserverDocument=ownerDocument,observer.observe(this,{attributes:!0,attributeFilter:["id"]})}resetHostIdObserver(){this.hostIdObserverGeneration+=1,this.hostIdObserver?.disconnect(),this.hostIdObserver=void 0,this.hostIdObserverDocument=void 0}setOpen(next){if(this._open===next)return;const old=this._open;this._open=next,setCustomState(this.popoverInternals,"open",next),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}show(){return this.canOpen?this.disclosure.show(()=>!this.closePopoverPeers()):Promise.resolve()}hide(options){return this.disclosure.hide(()=>this.prepareClose(options))}hasPopoverAncestor(peer){const trigger=this.triggerElement??this.resolveInteractionTrigger();return composedContains(peer,this)||trigger!==void 0&&composedContains(peer,trigger)}closePopoverPeers(){if(this.virtualAnchor||this.localName!==tag("popover"))return!0;const root=this.getRootNode();for(const peer of root.querySelectorAll(tag("popover")))if(!(peer===this||!peer.open||peer.virtualAnchor)&&!this.hasPopoverAncestor(peer)&&(peer.hide({focusTrigger:!1}),peer.open))return!1;return!0}reconcileInitialPopoverPeers(){if(!this.isConnected||!this._open||this.virtualAnchor||this.localName!==tag("popover"))return;const root=this.getRootNode(),peers=[];let winner;for(const peer of root.querySelectorAll(tag("popover")))!peer.isConnected||!peer._open||peer.virtualAnchor||!(peer.connectionSequence>0)||(peers.push(peer),(!winner||peer.connectionSequence>winner.connectionSequence)&&(winner=peer));if(winner!==this){winner?.hasPopoverAncestor(this)||this.closeForInitialPeerReconciliation();return}for(const peer of peers)peer!==this&&!this.hasPopoverAncestor(peer)&&peer.closeForInitialPeerReconciliation()}closeForInitialPeerReconciliation(){this._open&&(this.disclosure.reset(),this.invalidatePositioning(),this.stopLightDismiss(),this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0,this.positionedAnchor=void 0,this.anchorPositioned=!1,this.popupHidden=!0,this.returnFocusTo=void 0,this.setOpen(!1),this.syncOpenAttribute())}forceClose(options){return this.disclosure.forceClose(()=>this.prepareClose(options))}prepareClose(options){options?.focusTrigger===!1&&(this.overlayHandle?.deactivate({restoreFocus:!1}),this.overlayHandle=void 0),this.anchorPositioned||(this.popupHidden=!0)}emitCancelableLifecycle(name){return this.emit(name,null,{cancelable:!0})}emitSettledLifecycle(name){return this.emit(name)}render(){const popupRole=this.popupSurfaceRole;return html`
2
2
  <span part="trigger" @click=${this.onTriggerClick} @keydown=${this.onTriggerKeyDown}>
3
3
  <slot name="trigger" @slotchange=${this.onTriggerSlotChange}></slot>
4
4
  </span>
@@ -212,6 +212,11 @@ withoutArrow:boolean;
212
212
  arrowPlacement:LyraArrowPlacement;
213
213
  /** Keeps the arrow this far from the popup's corners, in pixels.*/
214
214
  arrowPadding:number;
215
+ /** Lays the trigger out at full width, as on `lr-popover`: the host becomes a block box and the
216
+ * `trigger` part and the slotted trigger element stretch to the host's inline size, so a block
217
+ * trigger such as a card in a grid cell fills its column. Off by default, which keeps the
218
+ * `inline-block` trigger. Positioning is unaffected. */
219
+ fullWidthTrigger:boolean;
215
220
  /** Plain-text tooltip content, painted when the active content slot carries nothing of its own.
216
221
  * Whitespace-only text there (template indentation around a `slot="trigger"` element) counts as
217
222
  * nothing, so this text still paints and describes the trigger. */