@m3e/web 2.4.0 → 2.5.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 (80) hide show
  1. package/README.md +9 -2
  2. package/dist/all.js +526 -67
  3. package/dist/all.js.map +1 -1
  4. package/dist/all.min.js +45 -45
  5. package/dist/all.min.js.map +1 -1
  6. package/dist/bottom-sheet.js +33 -6
  7. package/dist/bottom-sheet.js.map +1 -1
  8. package/dist/bottom-sheet.min.js +1 -1
  9. package/dist/bottom-sheet.min.js.map +1 -1
  10. package/dist/breadcrumb.js +303 -0
  11. package/dist/breadcrumb.js.map +1 -0
  12. package/dist/breadcrumb.min.js +7 -0
  13. package/dist/breadcrumb.min.js.map +1 -0
  14. package/dist/content-pane.js +69 -0
  15. package/dist/content-pane.js.map +1 -0
  16. package/dist/content-pane.min.js +7 -0
  17. package/dist/content-pane.min.js.map +1 -0
  18. package/dist/core-a11y.js +12 -9
  19. package/dist/core-a11y.js.map +1 -1
  20. package/dist/core-a11y.min.js +2 -2
  21. package/dist/core-a11y.min.js.map +1 -1
  22. package/dist/core.js +48 -4
  23. package/dist/core.js.map +1 -1
  24. package/dist/core.min.js +1 -1
  25. package/dist/core.min.js.map +1 -1
  26. package/dist/css-custom-data.json +282 -162
  27. package/dist/custom-elements.json +3319 -1874
  28. package/dist/html-custom-data.json +234 -127
  29. package/dist/list.js +37 -37
  30. package/dist/list.js.map +1 -1
  31. package/dist/list.min.js +1 -1
  32. package/dist/list.min.js.map +1 -1
  33. package/dist/split-pane.js +56 -15
  34. package/dist/split-pane.js.map +1 -1
  35. package/dist/split-pane.min.js +1 -1
  36. package/dist/split-pane.min.js.map +1 -1
  37. package/dist/src/all.d.ts +2 -0
  38. package/dist/src/all.d.ts.map +1 -1
  39. package/dist/src/bottom-sheet/BottomSheetElement.d.ts +8 -2
  40. package/dist/src/bottom-sheet/BottomSheetElement.d.ts.map +1 -1
  41. package/dist/src/breadcrumb/BreadcrumbElement.d.ts +47 -0
  42. package/dist/src/breadcrumb/BreadcrumbElement.d.ts.map +1 -0
  43. package/dist/src/breadcrumb/BreadcrumbItemButtonElement.d.ts +37 -0
  44. package/dist/src/breadcrumb/BreadcrumbItemButtonElement.d.ts.map +1 -0
  45. package/dist/src/breadcrumb/BreadcrumbItemCurrent.d.ts +3 -0
  46. package/dist/src/breadcrumb/BreadcrumbItemCurrent.d.ts.map +1 -0
  47. package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts +88 -0
  48. package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts.map +1 -0
  49. package/dist/src/breadcrumb/index.d.ts +4 -0
  50. package/dist/src/breadcrumb/index.d.ts.map +1 -0
  51. package/dist/src/breadcrumb/isIconOnly.d.ts +3 -0
  52. package/dist/src/breadcrumb/isIconOnly.d.ts.map +1 -0
  53. package/dist/src/content-pane/ContentPaneElement.d.ts +44 -0
  54. package/dist/src/content-pane/ContentPaneElement.d.ts.map +1 -0
  55. package/dist/src/content-pane/index.d.ts +2 -0
  56. package/dist/src/content-pane/index.d.ts.map +1 -0
  57. package/dist/src/core/a11y/InteractivityChecker.d.ts +4 -2
  58. package/dist/src/core/a11y/InteractivityChecker.d.ts.map +1 -1
  59. package/dist/src/core/shared/mixins/LinkButton.d.ts +2 -1
  60. package/dist/src/core/shared/mixins/LinkButton.d.ts.map +1 -1
  61. package/dist/src/core/shared/utils/getScrollbarWidth.d.ts +7 -0
  62. package/dist/src/core/shared/utils/getScrollbarWidth.d.ts.map +1 -0
  63. package/dist/src/core/shared/utils/index.d.ts +1 -0
  64. package/dist/src/core/shared/utils/index.d.ts.map +1 -1
  65. package/dist/src/list/ListActionElement.d.ts +1 -0
  66. package/dist/src/list/ListActionElement.d.ts.map +1 -1
  67. package/dist/src/list/index.d.ts +0 -1
  68. package/dist/src/list/index.d.ts.map +1 -1
  69. package/dist/src/split-pane/SplitPaneElement.d.ts +6 -0
  70. package/dist/src/split-pane/SplitPaneElement.d.ts.map +1 -1
  71. package/dist/src/tree/TreeItemElement.d.ts.map +1 -1
  72. package/dist/tooltip.js +2 -2
  73. package/dist/tooltip.js.map +1 -1
  74. package/dist/tooltip.min.js +1 -1
  75. package/dist/tooltip.min.js.map +1 -1
  76. package/dist/tree.js +1 -2
  77. package/dist/tree.js.map +1 -1
  78. package/dist/tree.min.js +1 -1
  79. package/dist/tree.min.js.map +1 -1
  80. package/package.json +11 -1
@@ -1 +1 @@
1
- {"version":3,"file":"bottom-sheet.min.js","sources":["../../src/bottom-sheet/BottomSheetActionElement.ts","../../src/bottom-sheet/BottomSheetElement.ts","../../src/bottom-sheet/BottomSheetTriggerElement.ts"],"sourcesContent":["import { ActionElementBase, customElement } from \"@m3e/web/core\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to close a parenting bottom sheet.\r\n * @tag m3e-bottom-sheet-action\r\n *\r\n * @slot - Renders the content of the action.\r\n */\r\n@customElement(\"m3e-bottom-sheet-action\")\r\nexport class M3eBottomSheetActionElement extends ActionElementBase {\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n this.closest(\"m3e-bottom-sheet\")?.hide();\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-bottom-sheet-action\": M3eBottomSheetActionElement;\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, nothing, PropertyValues, unsafeCSS } from \"lit\";\r\nimport { property } from \"lit/decorators.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n computeCssSize,\r\n DesignToken,\r\n EventAttribute,\r\n focusWhenReady,\r\n hasAssignedNodes,\r\n hasCustomState,\r\n prefersReducedMotion,\r\n ResizeController,\r\n ScrollLockController,\r\n setCustomState,\r\n spaceSeparatedStringConverter,\r\n VelocityTracker,\r\n SuppressInitialAnimation,\r\n ReconnectedCallback,\r\n registerStyleSheet,\r\n InertController,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { isModifierAllowed, M3eInteractivityChecker } from \"@m3e/web/core/a11y\";\r\nimport \"@m3e/web/core/a11y\";\r\n\r\n/**\r\n * A sheet used to show secondary content anchored to the bottom of the screen.\r\n *\r\n * @description\r\n * The `m3e-bottom-sheet` component implements a Material 3 bottom sheet with\r\n * gesture‑driven resizing, detent snapping, and adaptive motion. It behaves as\r\n * a heavy surface: transitions use non‑bouncy, decelerating motion.\r\n *\r\n * The sheet supports direct manipulation through vertical drag gestures.\r\n * Movement below an 8px threshold is ignored to ensure reliable tap‑to‑cycle\r\n * behavior on the handle. Once activated, dragging updates the sheet height\r\n * with friction near the minimum height to prevent abrupt collapse.\r\n *\r\n * When detents are defined, the sheet snaps to the nearest detent on release.\r\n * If hideable, downward gestures may dismiss the sheet using either velocity\r\n * or a small distance threshold below the collapsed detent. When no detents\r\n * are present, the sheet behaves as a simple open/hidden surface with a\r\n * bottom‑measured hide threshold.\r\n *\r\n * @example\r\n * The following example shows a modal bottom sheet with a drag handle,\r\n * three detents (`fit`, `half`, and `full`), and an action list. The sheet\r\n * is opened using a dedicated `m3e-bottom-sheet-trigger` associated by ID.\r\n * ```html\r\n * <m3e-button>\r\n * <m3e-bottom-sheet-trigger for=\"bottomSheet\">\r\n * Open Bottom sheet\r\n * </m3e-bottom-sheet-trigger>\r\n * </m3e-button>\r\n *\r\n * <m3e-bottom-sheet id=\"bottomSheet\" modal handle hideable detents=\"fit half full\">\r\n * <m3e-action-list>\r\n * <m3e-list-action autofocus>\r\n * <m3e-bottom-sheet-action>Google Keep</m3e-bottom-sheet-action>\r\n * <span slot=\"supporting-text\">Add to a note</span>\r\n * </m3e-list-action>\r\n * <m3e-list-action>\r\n * <m3e-bottom-sheet-action>Google Docs</m3e-bottom-sheet-action>\r\n * <span slot=\"supporting-text\">Embed in a document</span>\r\n * </m3e-list-action>\r\n * </m3e-action-list>\r\n * </m3e-bottom-sheet>\r\n * ```\r\n *\r\n * @tag m3e-bottom-sheet\r\n *\r\n * @slot - Renders the content of the sheet.\r\n * @slot header - Renders the header of the sheet.\r\n *\r\n * @attr detent - The zero‑based index of the detent the sheet should open to.\r\n * @attr detents - Detents (discrete height states) the sheet can snap to.\r\n * @attr handle - Whether to display a drag handle and enable the top region of the sheet as a gesture surface for dragging between detents.\r\n * @attr handle-label - The accessible label given to the drag handle.\r\n * @attr hideable - Whether the bottom sheet can hide when its swiped down.\r\n * @attr hide-friction - The friction coefficient to hide the sheet, or set it to the next closest expanded detent.\r\n * @attr modal - Whether the bottom sheet behaves as modal.\r\n * @attr open - Whether the bottom sheet is open.\r\n *\r\n * @fires opening - Emitted when the sheet begins to open.\r\n * @fires opened - Emitted when the sheet has opened.\r\n * @fires cancel - Emitted when the sheet is cancelled.\r\n * @fires closing - Emitted when the sheet begins to close.\r\n * @fires closed - Emitted when the sheet has closed.\r\n *\r\n * @cssprop --m3e-bottom-sheet-width - The width of the sheet.\r\n * @cssprop --m3e-bottom-sheet-max-width - The maximum width of the sheet.\r\n * @cssprop --m3e-bottom-sheet-container-color - The background color of the sheet container.\r\n * @cssprop --m3e-bottom-sheet-elevation - The elevation level when not modal.\r\n * @cssprop --m3e-bottom-sheet-modal-elevation - The elevation level when modal.\r\n * @cssprop --m3e-bottom-sheet-full-elevation - The elevation level when full height.\r\n * @cssprop --m3e-bottom-sheet-z-index - The z-index of the non-modal sheet.\r\n * @cssprop --m3e-bottom-sheet-minimized-container-shape - The border radius when minimized.\r\n * @cssprop --m3e-bottom-sheet-container-shape - The border radius of the sheet container.\r\n * @cssprop --m3e-bottom-sheet-full-container-shape - The border radius when full height.\r\n * @cssprop --m3e-bottom-sheet-scrim-color - The color of the scrim overlay.\r\n * @cssprop --m3e-bottom-sheet-scrim-opacity - The opacity of the scrim overlay.\r\n * @cssprop --m3e-bottom-sheet-peek-height - The visible height when minimized.\r\n * @cssprop --m3e-bottom-sheet-compact-top-space - The top space in compact mode.\r\n * @cssprop --m3e-bottom-sheet-top-space - The top space in standard mode.\r\n * @cssprop --m3e-bottom-sheet-padding-block - The vertical padding.\r\n * @cssprop --m3e-bottom-sheet-padding-inline - The horizontal padding.\r\n * @cssprop --m3e-bottom-sheet-handle-container-height - The height of the drag handle container.\r\n * @cssprop --m3e-bottom-sheet-handle-width - The width of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-height - The height of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-shape - The border radius of the handle.\r\n * @cssprop --m3e-bottom-sheet-handle-color - The color of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-focus-ring-offset - The offset of the focus ring around the handle.\r\n * @cssprop --m3e-bottom-sheet-color - The foreground (text) color of the sheet.\r\n * @cssprop --m3e-bottom-sheet-content-font-size - Font size for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-font-weight - Font weight for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-line-height - Line height for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-tracking - Letter spacing (tracking) for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-header-font-size - Font size for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-font-weight - Font weight for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-line-height - Line height for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-tracking - Letter spacing (tracking) for the sheet header.\r\n */\r\n@customElement(\"m3e-bottom-sheet\")\r\nexport class M3eBottomSheetElement extends EventAttribute(\r\n ReconnectedCallback(SuppressInitialAnimation(AttachInternals(LitElement))),\r\n \"opening\",\r\n \"opened\",\r\n \"cancel\",\r\n \"closing\",\r\n \"closed\",\r\n) {\r\n static {\r\n registerStyleSheet(css`\r\n @property --_bottom-sheet-height {\r\n syntax: \"<length>\";\r\n inherits: false;\r\n initial-value: 50vh;\r\n }\r\n m3e-bottom-sheet > [slot=\"header\"] {\r\n margin-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n margin-inline: var(--m3e-bottom-sheet-padding-inline, 1rem);\r\n }\r\n `);\r\n }\r\n\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: block;\r\n position: fixed;\r\n left: 50%;\r\n top: calc(100vh - var(--_bottom-sheet-height));\r\n margin: 0;\r\n padding: 0;\r\n outline: none;\r\n overflow: hidden;\r\n border: none;\r\n box-sizing: border-box;\r\n width: var(--m3e-bottom-sheet-width, 100%);\r\n max-width: var(--m3e-bottom-sheet-max-width, 40rem);\r\n height: var(--_bottom-sheet-height);\r\n color: var(--m3e-bottom-sheet-color, ${DesignToken.color.onSurface});\r\n background-color: var(--m3e-bottom-sheet-container-color, ${DesignToken.color.surfaceContainerLow});\r\n }\r\n :host(:not(:state(-no-animate))) {\r\n transition: ${unsafeCSS(\r\n `transform ${DesignToken.motion.duration.medium2} ${DesignToken.motion.easing.standardDecelerate},\r\n border-radius ${DesignToken.motion.duration.medium2} ${DesignToken.motion.easing.standard}`,\r\n )};\r\n }\r\n :host(:not([modal]):not(:state(-full))) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host([modal]:not(:state(-full))) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-modal-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host(:state(-full)) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-full-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host(:not([modal])) {\r\n z-index: var(--m3e-bottom-sheet-z-index, 10);\r\n }\r\n :host(:not([modal]):not([open])),\r\n :host([modal]:not(:popover-open)) {\r\n border-radius: var(--m3e-bottom-sheet-minimized-container-shape, ${DesignToken.shape.corner.none});\r\n transform: translateX(-50%) translateY(100%);\r\n }\r\n :host(:not([modal])[open]:not(:state(-full))),\r\n :host([modal]:not(:state(-full)):popover-open) {\r\n border-radius: var(--m3e-bottom-sheet-container-shape, ${DesignToken.shape.corner.extraLargeTop});\r\n }\r\n :host(:not([modal])[open]:state(-full)),\r\n :host([modal]:state(-full):popover-open) {\r\n border-radius: var(--m3e-bottom-sheet-full-container-shape, ${DesignToken.shape.corner.extraLargeTop});\r\n }\r\n :host(:not([modal])[open]),\r\n :host([modal]:popover-open) {\r\n transform: translateX(-50%) translateY(0);\r\n }\r\n :host([modal]:not(:state(-no-animate)))::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host([modal]:popover-open)::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-bottom-sheet-scrim-color, ${DesignToken.color.scrim}) var(--m3e-bottom-sheet-scrim-opacity, 32%),\r\n transparent\r\n );\r\n }\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n @starting-style {\r\n :host([modal]:popover-open)::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-bottom-sheet-scrim-color, ${DesignToken.color.scrim}) 0%,\r\n transparent\r\n );\r\n }\r\n }\r\n .base {\r\n display: flex;\r\n border-radius: inherit;\r\n flex-direction: column;\r\n height: 100%;\r\n --_bottom-sheet-peek-height: var(--m3e-bottom-sheet-peek-height, 0);\r\n --_bottom-sheet-top-space: var(--m3e-bottom-sheet-compact-top-space, 4.5rem);\r\n }\r\n @media (max-height: 640px) {\r\n .base {\r\n --_bottom-sheet-top-space: var(--m3e-bottom-sheet-top-space, 3.5rem);\r\n }\r\n }\r\n .body {\r\n flex: 1 1 auto;\r\n overflow-y: auto;\r\n scrollbar-width: ${DesignToken.scrollbar.thinWidth};\r\n scrollbar-color: ${DesignToken.scrollbar.color};\r\n padding-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n padding-inline: var(--m3e-bottom-sheet-padding-inline, 1rem);\r\n font-size: var(--m3e-bottom-sheet-content-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(\r\n --m3e-bottom-sheet-content-font-weight,\r\n ${DesignToken.typescale.standard.body.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-bottom-sheet-content-line-height,\r\n ${DesignToken.typescale.standard.body.medium.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-bottom-sheet-content-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n .content {\r\n height: fit-content;\r\n }\r\n :host(:not([handle])) .header {\r\n display: none;\r\n }\r\n :host(:not([handle])) .body,\r\n .header {\r\n border-top-left-radius: inherit;\r\n border-top-right-radius: inherit;\r\n padding-block-start: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n font-size: var(--m3e-bottom-sheet-header-font-size, ${DesignToken.typescale.standard.title.large.fontSize});\r\n font-weight: var(--m3e-bottom-sheet-header-font-weight, ${DesignToken.typescale.standard.title.large.fontWeight});\r\n line-height: var(--m3e-bottom-sheet-header-line-height, ${DesignToken.typescale.standard.title.large.lineHeight});\r\n letter-spacing: var(--m3e-bottom-sheet-header-tracking, ${DesignToken.typescale.standard.title.large.tracking});\r\n }\r\n .header {\r\n cursor: grab;\r\n touch-action: none;\r\n outline: none;\r\n user-select: none;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n box-sizing: border-box;\r\n flex: none;\r\n display: flex;\r\n flex-direction: column;\r\n min-height: 3rem;\r\n --m3e-app-bar-container-color: var(--m3e-bottom-sheet-container-color, ${DesignToken.color.surfaceContainerLow});\r\n }\r\n .handle-row {\r\n position: relative;\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n opacity: 1;\r\n visibility: visible;\r\n height: var(--m3e-bottom-sheet-handle-container-height, 1.5rem);\r\n }\r\n :host(:not(:state(-no-animate))) .handle-row {\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n padding ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n height ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .handle {\r\n position: relative;\r\n width: var(--m3e-bottom-sheet-handle-width, 2rem);\r\n height: var(--m3e-bottom-sheet-handle-height, 4px);\r\n border-radius: var(--m3e-bottom-sheet-handle-shape, ${DesignToken.shape.corner.full});\r\n background-color: var(--m3e-bottom-sheet-handle-color, ${DesignToken.color.onSurfaceVariant});\r\n }\r\n .handle-touch {\r\n position: absolute;\r\n aspect-ratio: 1 / 1;\r\n height: 3rem;\r\n left: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2));\r\n right: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2));\r\n top: calc(\r\n 0px - calc(\r\n calc(3rem - var(--m3e-bottom-sheet-handle-container-height, 1.5rem)) - calc(\r\n var(--m3e-bottom-sheet-handle-height, 4px) / 2\r\n )\r\n )\r\n );\r\n }\r\n @media (prefers-reduced-motion) {\r\n :host(:not(:state(-no-animate))),\r\n :host([modal]:not(:state(-no-animate)))::backdrop,\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop,\r\n :host(:not(:state(-no-animate))) .handle-row {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n :host([modal]:not(:state(-no-animate)))::backdrop,\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop {\r\n transition: none;\r\n }\r\n .base {\r\n border-style: solid;\r\n border-width: 1px;\r\n border-color: CanvasText;\r\n }\r\n .handle {\r\n background-color: ButtonText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __openSheet?: M3eBottomSheetElement;\r\n\r\n /** @private */ readonly #documentClickHandler = (e: Event) => this.#handleDocumentClick(e);\r\n /** @private */ readonly #documentKeyDownHandler = (e: KeyboardEvent) => this.#handleDocumentKeyDown(e);\r\n /** @private */ readonly #windowResizeHandler = () => this.#handleWindowResize();\r\n /** @private */ readonly #velocityTracker = new VelocityTracker();\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n /** @private */ readonly #inertController = new InertController(this);\r\n\r\n /** @private */\r\n readonly #resizeController = new ResizeController(this, {\r\n target: null,\r\n skipInitial: true,\r\n callback: (x) => this.#handleSectionResize(x),\r\n });\r\n\r\n /** @private */ #trigger: Element | null = null;\r\n /** @private */ #dragState?: { startY: number; startHeight: number; maxHeight: number; minHeight: number };\r\n /** @private */ #dragged = false;\r\n /** @private */ #activeDetent = 0;\r\n /** @private */ #requestDetent?: number;\r\n /** @private */ #cachedContentHeight = 0;\r\n /** @private */ #cachedHeaderHeight = 0;\r\n /** @private */ #snapAnimation?: Animation;\r\n\r\n /**\r\n * Whether the bottom sheet behaves as modal.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) modal = false;\r\n\r\n /**\r\n * Whether the bottom sheet is open.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) open = false;\r\n\r\n /**\r\n * Whether to display a drag handle and enable the top region of the sheet as a gesture\r\n * surface for dragging between detents.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) handle = false;\r\n\r\n /**\r\n * The accessible label given to the drag handle.\r\n * @default \"Drag handle\"\r\n */\r\n @property({ attribute: \"handle-label\" }) handleLabel = \"Drag handle\";\r\n\r\n /**\r\n * Detents (discrete height states) the sheet can snap to.\r\n * @default []\r\n */\r\n @property({ attribute: \"detents\", converter: spaceSeparatedStringConverter }) detents: string[] = [];\r\n\r\n /**\r\n * The zero‑based index of the detent the sheet should open to.\r\n * @default 0\r\n */\r\n @property({ type: Number }) detent = 0;\r\n\r\n /**\r\n * Whether the bottom sheet can hide when its swiped down.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) hideable = false;\r\n\r\n /**\r\n * The friction coefficient to hide the sheet, or set it to the next closest expanded detent.\r\n * @default 0.5\r\n */\r\n @property({ attribute: \"hide-friction\", type: Number }) hideFriction = 0.5;\r\n\r\n /**\r\n * Shows the sheet.\r\n * @param {number} detent The zero‑based index of the detent the sheet should open to.\r\n */\r\n show(detent: number = this.detent): void {\r\n if (!this.open) {\r\n this.#requestDetent = detent;\r\n this.open = true;\r\n } else if (detent !== undefined && this.#activeDetent !== detent) {\r\n this.#snapToDetent(detent);\r\n }\r\n }\r\n\r\n /** Hides the sheet. */\r\n hide(): void {\r\n this.open = false;\r\n }\r\n\r\n /**\r\n * Toggles the opened state of the sheet.\r\n * @param {number} detent The zero‑based index of the detent the sheet should open to.\r\n */\r\n toggle(detent?: number): void {\r\n if (this.open) {\r\n this.hide();\r\n } else {\r\n this.show(detent);\r\n }\r\n }\r\n\r\n /** Moves the sheet to the next detent. */\r\n cycle(): void {\r\n if (!this.open) {\r\n this.show();\r\n } else if (this.detents.length > 0) {\r\n if (this.#activeDetent < this.detents.length - 1) {\r\n this.#activeDetent++;\r\n this.#snapToDetent(this.#activeDetent);\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"modal\")) {\r\n this.role = this.modal ? \"dialog\" : \"region\";\r\n this.ariaModal = this.modal ? \"true\" : null;\r\n this.popover = this.modal ? \"manual\" : null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n this.#initialize();\r\n }\r\n\r\n /** @inheritdoc */\r\n override firstUpdated(_changedProperties: PropertyValues): void {\r\n super.firstUpdated(_changedProperties);\r\n this.#initialize();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues): void {\r\n super.updated(_changedProperties);\r\n\r\n if (_changedProperties.has(\"open\")) {\r\n if (this.open) {\r\n if (!this.dispatchEvent(new Event(\"opening\", { cancelable: true }))) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n // Only one sheet can be open at a time.\r\n if (M3eBottomSheetElement.__openSheet !== this) {\r\n M3eBottomSheetElement.__openSheet?.hide();\r\n }\r\n M3eBottomSheetElement.__openSheet = this;\r\n\r\n this.inert = false;\r\n\r\n window.addEventListener(\"resize\", this.#windowResizeHandler);\r\n\r\n // If there are detents (regardless of handle) open to the requested, default (or first) detent.\r\n // Otherwise, open to fit unless its greater than half.\r\n\r\n if (this.detents.length > 0) {\r\n this.#activeDetent = Math.min(Math.max(0, this.#requestDetent ?? this.detent), this.detents.length - 1);\r\n this.#updateHeight(this.#computeDetentHeight(this.detents[this.#activeDetent]));\r\n } else {\r\n this.#updateHeight(Math.min(this.#computeDetentHeight(\"fit\"), this.#computeDetentHeight(\"half\")));\r\n }\r\n this.#requestDetent = undefined;\r\n } else {\r\n if (!this.dispatchEvent(new Event(\"closing\", { cancelable: true }))) {\r\n this.open = true;\r\n return;\r\n }\r\n\r\n // The following ensures layout is stable so that first tab isn't \"skipped\"\r\n requestAnimationFrame(() => (this.inert = true));\r\n\r\n window.removeEventListener(\"resize\", this.#windowResizeHandler);\r\n\r\n if (M3eBottomSheetElement.__openSheet === this) {\r\n M3eBottomSheetElement.__openSheet = undefined;\r\n }\r\n }\r\n\r\n if (this.modal) {\r\n if (this.open) {\r\n this.#trigger = document.activeElement;\r\n this.#inertController.lock();\r\n this.#scrollLockController.lock();\r\n this.showPopover();\r\n requestAnimationFrame(() => {\r\n document.addEventListener(\"click\", this.#documentClickHandler);\r\n document.addEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n });\r\n\r\n let focusable: HTMLElement | null | undefined = this.querySelector<HTMLElement>(\"[autofocus]\");\r\n if (!focusable || !M3eInteractivityChecker.isFocusable(focusable)) {\r\n focusable = this.shadowRoot?.querySelector(\".handle\");\r\n }\r\n if (focusable) {\r\n focusWhenReady(focusable);\r\n }\r\n } else {\r\n this.#snapToHeight(0).then(() => {\r\n this.#inertController.unlock();\r\n this.#scrollLockController.unlock();\r\n document.removeEventListener(\"click\", this.#documentClickHandler);\r\n document.removeEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n this.hidePopover();\r\n if (this.#trigger instanceof HTMLElement) {\r\n this.#trigger.focus();\r\n }\r\n this.#trigger = null;\r\n });\r\n }\r\n }\r\n\r\n this.dispatchEvent(new Event(this.open ? \"opened\" : \"closed\"));\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<m3e-focus-trap ?disabled=\"${!this.modal}\">\r\n <div class=\"base\">\r\n <m3e-elevation class=\"elevation\"></m3e-elevation>\r\n <div\r\n class=\"header\"\r\n @pointerdown=\"${this.#handleHeaderPointerDown}\"\r\n @pointermove=\"${this.#handleHeaderPointerMove}\"\r\n @pointerup=\"${this.#handleHeaderPointerUp}\"\r\n >\r\n ${this.handle\r\n ? html`<div class=\"handle-row\">\r\n <div\r\n id=\"handle\"\r\n class=\"handle\"\r\n role=\"button\"\r\n aria-label=\"${this.handleLabel}\"\r\n tabindex=\"0\"\r\n @click=\"${this.#handleDragHandleClick}\"\r\n @keydown=\"${this.#handleDragHandleKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"handle\"></m3e-focus-ring>\r\n <div class=\"handle-touch\" aria-hidden=\"true\"></div>\r\n </div>\r\n </div>`\r\n : nothing}\r\n <slot name=\"header\" @slotchange=\"${this.#handleHeaderSlotChange}\"></slot>\r\n </div>\r\n <div class=\"body\">\r\n <div class=\"content\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n </div>\r\n </m3e-focus-trap>`;\r\n }\r\n\r\n /** @private */\r\n #initialize(): void {\r\n const content = this.shadowRoot?.querySelector<HTMLElement>(\".content\");\r\n if (content) {\r\n this.#cachedContentHeight = content.clientHeight;\r\n this.#resizeController.observe(content);\r\n }\r\n\r\n const header = this.shadowRoot?.querySelector<HTMLElement>(\".header\");\r\n if (header) {\r\n this.#cachedHeaderHeight = header.clientHeight;\r\n this.#resizeController.observe(header);\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleHeaderSlotChange(e: Event): void {\r\n setCustomState(this, \"has-header\", hasAssignedNodes(e.target as HTMLSlotElement));\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerDown(e: PointerEvent): void {\r\n if (e.target instanceof HTMLElement && M3eInteractivityChecker.isFocusable(e.target)) {\r\n return;\r\n }\r\n\r\n (<HTMLElement>e.target).setPointerCapture(e.pointerId);\r\n (<HTMLElement>e.target).style.cursor = \"grabbing\";\r\n\r\n this.#velocityTracker.reset();\r\n this.#velocityTracker.add(e.clientY);\r\n\r\n this.#dragState = {\r\n startY: e.clientY,\r\n startHeight: this.clientHeight,\r\n maxHeight: this.#computeMaxHeight(),\r\n minHeight: this.#computeMinHeight(),\r\n };\r\n this.#dragged = false;\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerMove(e: PointerEvent): void {\r\n if (!this.#dragState) {\r\n return;\r\n }\r\n\r\n const minDragThreshold = 8;\r\n if (Math.abs(e.clientY - this.#dragState.startY) <= minDragThreshold) {\r\n // Ignore movement under threshold\r\n return;\r\n }\r\n\r\n (e.getCoalescedEvents?.() ?? [e]).forEach((x) => this.#velocityTracker.add(x.clientY, e.timeStamp));\r\n\r\n let newHeight = this.#dragState.startHeight - (e.clientY - this.#dragState.startY);\r\n if (newHeight < this.#dragState.minHeight) {\r\n const overshoot = (this.#dragState.minHeight - newHeight) * this.hideFriction;\r\n newHeight = this.#dragState.minHeight - overshoot;\r\n }\r\n\r\n this.#updateHeight(Math.min(this.#dragState.maxHeight, newHeight));\r\n this.#dragged = true;\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerUp(e: PointerEvent): void {\r\n if (!this.#dragState) return;\r\n\r\n try {\r\n (<HTMLElement>e.target).releasePointerCapture(e.pointerId);\r\n (<HTMLElement>e.target).style.cursor = \"\";\r\n\r\n if (!this.#dragged) return;\r\n\r\n const significantVelocityThreshold = e.pointerType === \"touch\" ? 1200 : 500;\r\n const velocity = this.#velocityTracker.getVelocity();\r\n\r\n this.#velocityTracker.reset();\r\n\r\n if (this.hideable && velocity >= significantVelocityThreshold) {\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n } else if (Math.abs(velocity) >= significantVelocityThreshold) {\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextHigherDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n }\r\n } else {\r\n this.#snapToHeight(this.#computeDetentHeight(\"full\"));\r\n }\r\n } else {\r\n const hideDistanceThreshold = 20;\r\n if (this.hideable) {\r\n const collapsed = this.#dragState.minHeight;\r\n if (this.clientHeight < collapsed - hideDistanceThreshold) {\r\n this.hide();\r\n return;\r\n }\r\n }\r\n\r\n if (this.detents.length > 0) {\r\n this.#snapToDetent(this.#getClosestDetent());\r\n } else if (this.clientHeight < this.#dragState.minHeight) {\r\n this.#snapToHeight(this.#dragState.minHeight);\r\n }\r\n }\r\n } finally {\r\n this.#dragState = undefined;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDocumentClick(e: Event): void {\r\n if (\r\n this.open &&\r\n this.modal &&\r\n !e.composedPath().includes(this) &&\r\n this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))\r\n ) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDocumentKeyDown(e: KeyboardEvent): void {\r\n if (this.open && this.modal && e.key === \"Escape\" && !e.shiftKey && !e.ctrlKey) {\r\n e.preventDefault();\r\n\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleWindowResize(): void {\r\n if (this.detents.length > 0 && this.detents[this.#activeDetent] === \"half\") {\r\n this.#updateHeight(this.#computeDetentHeight(\"half\"));\r\n return;\r\n }\r\n\r\n const maxHeight = this.#computeMaxHeight();\r\n if (hasCustomState(this, \"-full\")) {\r\n this.#updateHeight(maxHeight);\r\n } else if (this.clientHeight > maxHeight) {\r\n this.#updateHeight(maxHeight);\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDragHandleClick(): void {\r\n if (!this.#dragged) {\r\n this.cycle();\r\n }\r\n this.#dragged = false;\r\n }\r\n\r\n /** @private */\r\n #handleDragHandleKeyDown(e: KeyboardEvent): void {\r\n if (e.defaultPrevented || !isModifierAllowed(e)) return;\r\n\r\n switch (e.key) {\r\n case \"Up\":\r\n case \"ArrowUp\":\r\n e.preventDefault();\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextHigherDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n }\r\n } else {\r\n this.#snapToHeight(this.#computeDetentHeight(\"full\"));\r\n }\r\n break;\r\n\r\n case \"Down\":\r\n case \"ArrowDown\":\r\n e.preventDefault();\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextLowerDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n\r\n break;\r\n }\r\n }\r\n\r\n /** @private */\r\n #getNextHigherDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let nextHeight = Infinity;\r\n let nextDetent = this.#activeDetent;\r\n for (let i = 0; i < this.detents.length; i++) {\r\n if (i === this.#activeDetent) continue;\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n if (detentHeight > currentHeight && detentHeight < nextHeight) {\r\n nextHeight = detentHeight;\r\n nextDetent = i;\r\n }\r\n }\r\n return nextDetent;\r\n }\r\n\r\n /** @private */\r\n #getNextLowerDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let nextHeight = -Infinity;\r\n let nextDetent = this.#activeDetent;\r\n for (let i = 0; i < this.detents.length; i++) {\r\n if (i === this.#activeDetent) continue;\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n if (detentHeight < currentHeight && detentHeight > nextHeight) {\r\n nextHeight = detentHeight;\r\n nextDetent = i;\r\n }\r\n }\r\n return nextDetent;\r\n }\r\n\r\n /** @private */\r\n #getClosestDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let closestDetent = this.#activeDetent;\r\n let closestDistance = Infinity;\r\n\r\n for (let i = 0; i < this.detents.length; i++) {\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n const distance = Math.abs(currentHeight - detentHeight);\r\n\r\n if (distance < closestDistance) {\r\n closestDistance = distance;\r\n closestDetent = i;\r\n }\r\n }\r\n return closestDetent;\r\n }\r\n\r\n /** @private */\r\n #computeDetentHeight(detent: string): number {\r\n switch (detent) {\r\n case \"collapsed\":\r\n return this.#computeMinHeight();\r\n case \"half\":\r\n return this.#computeMaxHeight() * 0.5;\r\n case \"full\":\r\n return this.#computeMaxHeight();\r\n case \"fit\":\r\n return this.#computeFitHeight();\r\n }\r\n\r\n if (detent.endsWith(\"%\")) {\r\n return this.#computeMaxHeight() * (parseFloat(detent) / 100);\r\n }\r\n\r\n if (detent.endsWith(\"px\")) {\r\n return parseFloat(detent);\r\n }\r\n\r\n return this.#computeMinHeight();\r\n }\r\n\r\n /** @private */\r\n #computeMaxHeight(): number {\r\n const base = this.shadowRoot?.querySelector<HTMLElement>(\".base\");\r\n return window.innerHeight - (base ? computeCssSize(base, \"var(--_bottom-sheet-top-space)\") : 0);\r\n }\r\n\r\n /** @private */\r\n #computeMinHeight(): number {\r\n return this.detents.includes(\"fit\") && !this.detents.includes(\"collapsed\")\r\n ? this.#computeFitHeight()\r\n : this.#computePeekHeight();\r\n }\r\n\r\n /** @private */\r\n #computePeekHeight(): number {\r\n const base = this.shadowRoot?.querySelector<HTMLElement>(\".base\");\r\n return this.#cachedHeaderHeight + (base ? computeCssSize(base, \"var(--_bottom-sheet-peek-height)\") : 0);\r\n }\r\n\r\n /** @private */\r\n #computeFitHeight(): number {\r\n const body = this.shadowRoot?.querySelector<HTMLElement>(\".body\");\r\n if (!body) {\r\n return 0;\r\n }\r\n\r\n const bodyStyle = getComputedStyle(body);\r\n return (\r\n this.#cachedHeaderHeight +\r\n this.#cachedContentHeight +\r\n parseFloat(bodyStyle.paddingBlockStart) +\r\n parseFloat(bodyStyle.paddingBlockEnd)\r\n );\r\n }\r\n\r\n /** @private */\r\n #handleSectionResize(entries: ResizeObserverEntry[]): void {\r\n const oldCachedContentHeight = this.#cachedContentHeight;\r\n const oldCachedHeaderHeight = this.#cachedHeaderHeight;\r\n\r\n for (const entry of entries) {\r\n if (entry.target.classList.contains(\"content\")) {\r\n this.#cachedContentHeight = (<ResizeObserverSize>(\r\n (Array.isArray(entry.borderBoxSize) ? entry.borderBoxSize[0] : entry.borderBoxSize)\r\n )).blockSize;\r\n } else if (entry.target.classList.contains(\"header\")) {\r\n this.#cachedHeaderHeight = (<ResizeObserverSize>(\r\n (Array.isArray(entry.borderBoxSize) ? entry.borderBoxSize[0] : entry.borderBoxSize)\r\n )).blockSize;\r\n }\r\n }\r\n\r\n if (\r\n this.open &&\r\n this.detents.length > 0 &&\r\n (oldCachedContentHeight !== this.#cachedContentHeight || oldCachedHeaderHeight !== this.#cachedHeaderHeight)\r\n ) {\r\n switch (this.detents[this.#activeDetent]) {\r\n case \"fit\":\r\n this.#updateHeight(this.#computeFitHeight());\r\n break;\r\n\r\n case \"collapsed\":\r\n this.#updateHeight(this.#computeMinHeight());\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #snapToDetent(detent: number): void {\r\n if (detent >= 0 && detent < this.detents.length) {\r\n this.#activeDetent = detent;\r\n this.#snapToHeight(this.#computeDetentHeight(this.detents[detent]));\r\n }\r\n }\r\n\r\n /** @private */\r\n async #snapToHeight(height: number): Promise<void> {\r\n if (this.#snapAnimation) {\r\n this.#updateHeight(this.clientHeight);\r\n this.#snapAnimation?.cancel();\r\n this.#snapAnimation = undefined;\r\n }\r\n\r\n if (!prefersReducedMotion()) {\r\n this.#snapAnimation = this.animate(\r\n [{ \"--_bottom-sheet-height\": `${this.clientHeight}px` }, { \"--_bottom-sheet-height\": `${height}px` }],\r\n {\r\n duration: 250,\r\n easing: \"cubic-bezier(0.2, 0.0, 0, 1.0)\",\r\n },\r\n );\r\n this.#snapAnimation.onfinish = () => {\r\n this.#updateHeight(height);\r\n this.#snapAnimation = undefined;\r\n };\r\n await this.#snapAnimation.finished;\r\n } else {\r\n this.#updateHeight(height);\r\n }\r\n }\r\n\r\n /** @private */\r\n #updateHeight(height: number): void {\r\n this.style.setProperty(\"--_bottom-sheet-height\", `${height}px`);\r\n setCustomState(this, \"-full\", height === this.#computeMaxHeight());\r\n const content = this.shadowRoot?.querySelector<HTMLElement>(\".content\");\r\n if (content) {\r\n content.inert = height <= this.#computePeekHeight();\r\n }\r\n }\r\n}\r\n\r\ninterface M3eBottomSheetElementEventMap extends HTMLElementEventMap {\r\n opening: Event;\r\n opened: Event;\r\n closing: Event;\r\n closed: Event;\r\n cancel: Event;\r\n}\r\n\r\nexport interface M3eBottomSheetElement {\r\n addEventListener<K extends keyof M3eBottomSheetElementEventMap>(\r\n type: K,\r\n listener: (this: M3eBottomSheetElement, ev: M3eBottomSheetElementEventMap[K]) => void,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n addEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener<K extends keyof M3eBottomSheetElementEventMap>(\r\n type: K,\r\n listener: (this: M3eBottomSheetElement, ev: M3eBottomSheetElementEventMap[K]) => void,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-bottom-sheet\": M3eBottomSheetElement;\r\n }\r\n}\r\n","import { property } from \"lit/decorators.js\";\r\n\r\nimport { ActionElementBase, customElement, HtmlFor } from \"@m3e/web/core\";\r\nimport { addAriaReferencedId, removeAriaReferencedId } from \"@m3e/web/core/a11y\";\r\n\r\nimport { M3eBottomSheetElement } from \"./BottomSheetElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to trigger a bottom sheet.\r\n * @tag m3e-bottom-sheet-trigger\r\n *\r\n * @slot - Renders the content of the trigger.\r\n *\r\n * @attr detent - The zero‑based index of the detent the sheet should open to.\r\n * @attr secondary - Marks this trigger as a secondary trigger for accessibility. Secondary triggers do not receive ARIA ownership.\r\n */\r\n@customElement(\"m3e-bottom-sheet-trigger\")\r\nexport class M3eBottomSheetTriggerElement extends HtmlFor(ActionElementBase) {\r\n /**\r\n * The zero‑based index of the detent the sheet should open to.\r\n * @default undefined\r\n */\r\n @property({ type: Number }) detent?: number;\r\n\r\n /**\r\n * Marks this trigger as a secondary trigger for accessibility. Secondary triggers do not receive ARIA ownership.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) secondary = false;\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n if (control instanceof M3eBottomSheetElement) {\r\n super.attach(control);\r\n\r\n if (this.parentElement) {\r\n if (!control.modal) {\r\n if (!this.secondary) {\r\n this.parentElement.ariaExpanded = \"false\";\r\n addAriaReferencedId(this.parentElement, \"aria-controls\", control.id);\r\n if (this.parentElement.id) {\r\n addAriaReferencedId(control, \"aria-labelledby\", this.parentElement.id);\r\n }\r\n }\r\n } else {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control && this.parentElement && !this.secondary) {\r\n removeAriaReferencedId(this.parentElement, \"aria-controls\", this.control.id);\r\n }\r\n super.detach();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n if (this.control instanceof M3eBottomSheetElement) {\r\n if (this.control.modal) {\r\n this.control.show(this.detent);\r\n } else {\r\n this.control.toggle(this.detent);\r\n if (!this.secondary && this.parentElement) {\r\n this.parentElement.ariaExpanded = `${this.control.open}`;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-bottom-sheet-trigger\": M3eBottomSheetTriggerElement;\r\n }\r\n}\r\n"],"names":["M3eBottomSheetActionElement","ActionElementBase","_onClick","this","closest","hide","__decorate","customElement","M3eBottomSheetElement","M3eBottomSheetElement_1","EventAttribute","ReconnectedCallback","SuppressInitialAnimation","AttachInternals","LitElement","constructor","_M3eBottomSheetElement_documentClickHandler","set","e","__classPrivateFieldGet","call","_M3eBottomSheetElement_documentKeyDownHandler","_M3eBottomSheetElement_windowResizeHandler","_M3eBottomSheetElement_instances","_M3eBottomSheetElement_handleWindowResize","_M3eBottomSheetElement_velocityTracker","VelocityTracker","_M3eBottomSheetElement_scrollLockController","ScrollLockController","_M3eBottomSheetElement_inertController","InertController","_M3eBottomSheetElement_resizeController","ResizeController","target","skipInitial","callback","x","_M3eBottomSheetElement_handleSectionResize","_M3eBottomSheetElement_trigger","_M3eBottomSheetElement_dragState","_M3eBottomSheetElement_dragged","_M3eBottomSheetElement_activeDetent","_M3eBottomSheetElement_requestDetent","_M3eBottomSheetElement_cachedContentHeight","_M3eBottomSheetElement_cachedHeaderHeight","_M3eBottomSheetElement_snapAnimation","modal","open","handle","handleLabel","detents","detent","hideable","hideFriction","show","undefined","_M3eBottomSheetElement_snapToDetent","__classPrivateFieldSet","toggle","cycle","length","_a","update","changedProperties","super","has","role","ariaModal","popover","reconnectedCallback","_M3eBottomSheetElement_initialize","firstUpdated","_changedProperties","updated","dispatchEvent","Event","cancelable","__openSheet","inert","window","addEventListener","Math","min","max","_M3eBottomSheetElement_updateHeight","_M3eBottomSheetElement_computeDetentHeight","requestAnimationFrame","removeEventListener","document","activeElement","lock","showPopover","focusable","querySelector","M3eInteractivityChecker","isFocusable","shadowRoot","focusWhenReady","_M3eBottomSheetElement_snapToHeight","then","unlock","hidePopover","HTMLElement","focus","render","html","_M3eBottomSheetElement_handleHeaderPointerDown","_M3eBottomSheetElement_handleHeaderPointerMove","_M3eBottomSheetElement_handleHeaderPointerUp","_M3eBottomSheetElement_handleDragHandleClick","_M3eBottomSheetElement_handleDragHandleKeyDown","nothing","_M3eBottomSheetElement_handleHeaderSlotChange","content","clientHeight","observe","header","setCustomState","hasAssignedNodes","setPointerCapture","pointerId","style","cursor","reset","add","clientY","startY","startHeight","maxHeight","_M3eBottomSheetElement_computeMaxHeight","minHeight","_M3eBottomSheetElement_computeMinHeight","abs","getCoalescedEvents","forEach","timeStamp","newHeight","overshoot","releasePointerCapture","significantVelocityThreshold","pointerType","velocity","getVelocity","nextDetent","hideDistanceThreshold","collapsed","_M3eBottomSheetElement_getClosestDetent","composedPath","includes","key","shiftKey","ctrlKey","preventDefault","hasCustomState","defaultPrevented","isModifierAllowed","currentHeight","nextHeight","Infinity","i","detentHeight","closestDetent","closestDistance","distance","_M3eBottomSheetElement_computeFitHeight","endsWith","parseFloat","base","innerHeight","computeCssSize","body","bodyStyle","getComputedStyle","paddingBlockStart","paddingBlockEnd","entries","oldCachedContentHeight","oldCachedHeaderHeight","entry","classList","contains","Array","isArray","borderBoxSize","blockSize","async","height","cancel","prefersReducedMotion","animate","duration","easing","onfinish","finished","setProperty","_M3eBottomSheetElement_computePeekHeight","registerStyleSheet","css","styles","DesignToken","color","onSurface","surfaceContainerLow","unsafeCSS","motion","medium2","standardDecelerate","standard","elevation","level1","shape","corner","none","extraLargeTop","short3","scrim","long2","scrollbar","thinWidth","typescale","medium","fontSize","fontWeight","lineHeight","tracking","title","large","full","onSurfaceVariant","property","type","Boolean","reflect","prototype","attribute","converter","spaceSeparatedStringConverter","Number","M3eBottomSheetTriggerElement","HtmlFor","secondary","attach","control","parentElement","ariaHasPopup","ariaExpanded","addAriaReferencedId","id","detach","removeAriaReferencedId"],"mappings":";;;;;yzBASO,IAAMA,EAAN,cAA0CC,EAE5BC,QAAAA,GACjBC,KAAKC,QAAQ,qBAAqBC,MACpC,wGAJWL,EAA2BM,EAAA,CADvCC,EAAc,4BACFP,GCqHN,IAAMQ,GAAqBC,GAA3B,cAAoCC,EACzCC,EAAoBC,EAAyBC,EAAgBC,KAC7D,UACA,SACA,SACA,UACA,WANKC,WAAAA,mCAuOoBC,EAAAC,IAAAd,KAAyBe,GAAaC,EAAAhB,eAAyBiB,KAAzBjB,KAA0Be,IAChEG,EAAAJ,IAAAd,KAA2Be,GAAqBC,EAAAhB,eAA2BiB,KAA3BjB,KAA4Be,IAC5EI,EAAAL,IAAAd,KAAuB,IAAMgB,EAAAhB,KAAIoB,EAAA,IAAAC,IAAoBJ,KAAxBjB,OAC7BsB,EAAAR,IAAAd,KAAmB,IAAIuB,GACvBC,EAAAV,IAAAd,KAAwB,IAAIyB,EAAqBzB,OACjD0B,EAAAZ,IAAAd,KAAmB,IAAI2B,EAAgB3B,OAGvD4B,EAAAd,IAAAd,KAAoB,IAAI6B,EAAiB7B,KAAM,CACtD8B,OAAQ,KACRC,aAAa,EACbC,SAAWC,GAAMjB,EAAAhB,KAAIoB,EAAA,IAAAc,IAAqBjB,KAAzBjB,KAA0BiC,MAG7BE,EAAArB,IAAAd,KAA2B,MAC3BoC,EAAAtB,IAAAd,aACAqC,EAAAvB,IAAAd,MAAW,GACXsC,EAAAxB,IAAAd,KAAgB,GAChBuC,EAAAzB,IAAAd,aACAwC,EAAA1B,IAAAd,KAAuB,GACvByC,EAAA3B,IAAAd,KAAsB,GACtB0C,EAAA5B,IAAAd,aAM4BA,KAAA2C,OAAQ,EAMR3C,KAAA4C,MAAO,EAOtB5C,KAAA6C,QAAS,E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AA6O,WAAY,CA4C3C,CAzCWC,MAAAA,CAAOC,GACVA,aAAmB1O,KACrBwD,MAAMiL,OAAOC,GAET/O,KAAKgP,gBACFD,EAAQpM,MASX3C,KAAKgP,cAAcC,aAAe,SAR7BjP,KAAK6O,YACR7O,KAAKgP,cAAcE,aAAe,QAClCC,EAAoBnP,KAAKgP,cAAe,gBAAiBD,EAAQK,IAC7DpP,KAAKgP,cAAcI,IACrBD,EAAoBJ,EAAS,kBAAmB/O,KAAKgP,cAAcI,MAQ/E,CAGSC,MAAAA,GACHrP,KAAK+O,SAAW/O,KAAKgP,gBAAkBhP,KAAK6O,WAC9CS,EAAuBtP,KAAKgP,cAAe,gBAAiBhP,KAAK+O,QAAQK,IAE3EvL,MAAMwL,QACR,CAGmBtP,QAAAA,GACbC,KAAK+O,mBAAmB1O,KACtBL,KAAK+O,QAAQpM,MACf3C,KAAK+O,QAAQ5L,KAAKnD,KAAKgD,SAEvBhD,KAAK+O,QAAQxL,OAAOvD,KAAKgD,SACpBhD,KAAK6O,WAAa7O,KAAKgP,gBAC1BhP,KAAKgP,cAAcE,aAAe,GAAGlP,KAAK+O,QAAQnM,SAI1D,GAjD4BzC,EAAA,CAA3B+N,EAAS,CAAEC,KAAMO,UAA0BC,GAAAL,UAAA,cAAA,GAMfnO,EAAA,CAA5B+N,EAAS,CAAEC,KAAMC,WAA6BO,GAAAL,UAAA,iBAAA,GAXpCK,GAA4BxO,EAAA,CADxCC,EAAc,6BACFuO"}
1
+ {"version":3,"file":"bottom-sheet.min.js","sources":["../../src/bottom-sheet/BottomSheetActionElement.ts","../../src/bottom-sheet/BottomSheetElement.ts","../../src/bottom-sheet/BottomSheetTriggerElement.ts"],"sourcesContent":["import { ActionElementBase, customElement } from \"@m3e/web/core\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to close a parenting bottom sheet.\r\n * @tag m3e-bottom-sheet-action\r\n *\r\n * @slot - Renders the content of the action.\r\n */\r\n@customElement(\"m3e-bottom-sheet-action\")\r\nexport class M3eBottomSheetActionElement extends ActionElementBase {\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n this.closest(\"m3e-bottom-sheet\")?.hide();\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-bottom-sheet-action\": M3eBottomSheetActionElement;\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, nothing, PropertyValues, unsafeCSS } from \"lit\";\r\nimport { property } from \"lit/decorators.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n computeCssSize,\r\n DesignToken,\r\n EventAttribute,\r\n focusWhenReady,\r\n hasAssignedNodes,\r\n hasCustomState,\r\n prefersReducedMotion,\r\n ResizeController,\r\n ScrollLockController,\r\n setCustomState,\r\n spaceSeparatedStringConverter,\r\n VelocityTracker,\r\n SuppressInitialAnimation,\r\n ReconnectedCallback,\r\n registerStyleSheet,\r\n InertController,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { isModifierAllowed, M3eInteractivityChecker } from \"@m3e/web/core/a11y\";\r\nimport \"@m3e/web/core/a11y\";\r\n\r\n/**\r\n * A sheet used to show secondary content anchored to the bottom of the screen.\r\n *\r\n * @description\r\n * The `m3e-bottom-sheet` component implements a Material 3 bottom sheet with\r\n * gesture‑driven resizing, detent snapping, and adaptive motion. It behaves as\r\n * a heavy surface: transitions use non‑bouncy, decelerating motion.\r\n *\r\n * The sheet supports direct manipulation through vertical drag gestures.\r\n * Movement below an 8px threshold is ignored to ensure reliable tap‑to‑cycle\r\n * behavior on the handle. Once activated, dragging updates the sheet height\r\n * with friction near the minimum height to prevent abrupt collapse.\r\n *\r\n * When detents are defined, the sheet snaps to the nearest detent on release.\r\n * If hideable, downward gestures may dismiss the sheet using either velocity\r\n * or a small distance threshold below the collapsed detent. When no detents\r\n * are present, the sheet behaves as a simple open/hidden surface with a\r\n * bottom‑measured hide threshold.\r\n *\r\n * @example\r\n * The following example shows a modal bottom sheet with a drag handle,\r\n * three detents (`fit`, `half`, and `full`), and an action list. The sheet\r\n * is opened using a dedicated `m3e-bottom-sheet-trigger` associated by ID.\r\n * ```html\r\n * <m3e-button>\r\n * <m3e-bottom-sheet-trigger for=\"bottomSheet\">\r\n * Open Bottom sheet\r\n * </m3e-bottom-sheet-trigger>\r\n * </m3e-button>\r\n *\r\n * <m3e-bottom-sheet id=\"bottomSheet\" modal handle hideable detents=\"fit half full\">\r\n * <m3e-action-list>\r\n * <m3e-list-action autofocus>\r\n * <m3e-bottom-sheet-action>Google Keep</m3e-bottom-sheet-action>\r\n * <span slot=\"supporting-text\">Add to a note</span>\r\n * </m3e-list-action>\r\n * <m3e-list-action>\r\n * <m3e-bottom-sheet-action>Google Docs</m3e-bottom-sheet-action>\r\n * <span slot=\"supporting-text\">Embed in a document</span>\r\n * </m3e-list-action>\r\n * </m3e-action-list>\r\n * </m3e-bottom-sheet>\r\n * ```\r\n *\r\n * @tag m3e-bottom-sheet\r\n *\r\n * @slot - Renders the content of the sheet.\r\n * @slot header - Renders the header of the sheet.\r\n *\r\n * @attr detent - The zero‑based index of the detent the sheet should open to.\r\n * @attr detents - Detents (discrete height states) the sheet can snap to.\r\n * @attr handle - Whether to display a drag handle and enable the top region of the sheet as a gesture surface for dragging between detents.\r\n * @attr handle-label - The accessible label given to the drag handle.\r\n * @attr hideable - Whether the bottom sheet can hide when its swiped down.\r\n * @attr hide-friction - The friction coefficient to hide the sheet.\r\n * @attr modal - Whether the bottom sheet behaves as modal.\r\n * @attr open - Whether the bottom sheet is open.\r\n * @attr overshoot-limit - A fractional value, between 0 and 100, indicating the maximum visual overshoot allowed when dragging past the minimum or maximum size.\r\n *\r\n * @fires opening - Emitted when the sheet begins to open.\r\n * @fires opened - Emitted when the sheet has opened.\r\n * @fires cancel - Emitted when the sheet is cancelled.\r\n * @fires closing - Emitted when the sheet begins to close.\r\n * @fires closed - Emitted when the sheet has closed.\r\n *\r\n * @cssprop --m3e-bottom-sheet-width - The width of the sheet.\r\n * @cssprop --m3e-bottom-sheet-max-width - The maximum width of the sheet.\r\n * @cssprop --m3e-bottom-sheet-container-color - The background color of the sheet container.\r\n * @cssprop --m3e-bottom-sheet-elevation - The elevation level when not modal.\r\n * @cssprop --m3e-bottom-sheet-modal-elevation - The elevation level when modal.\r\n * @cssprop --m3e-bottom-sheet-full-elevation - The elevation level when full height.\r\n * @cssprop --m3e-bottom-sheet-z-index - The z-index of the non-modal sheet.\r\n * @cssprop --m3e-bottom-sheet-minimized-container-shape - The border radius when minimized.\r\n * @cssprop --m3e-bottom-sheet-container-shape - The border radius of the sheet container.\r\n * @cssprop --m3e-bottom-sheet-full-container-shape - The border radius when full height.\r\n * @cssprop --m3e-bottom-sheet-scrim-color - The color of the scrim overlay.\r\n * @cssprop --m3e-bottom-sheet-scrim-opacity - The opacity of the scrim overlay.\r\n * @cssprop --m3e-bottom-sheet-peek-height - The visible height when minimized.\r\n * @cssprop --m3e-bottom-sheet-compact-top-space - The top space in compact mode.\r\n * @cssprop --m3e-bottom-sheet-top-space - The top space in standard mode.\r\n * @cssprop --m3e-bottom-sheet-padding-block - The vertical padding.\r\n * @cssprop --m3e-bottom-sheet-padding-inline - The horizontal padding.\r\n * @cssprop --m3e-bottom-sheet-handle-container-height - The height of the drag handle container.\r\n * @cssprop --m3e-bottom-sheet-handle-width - The width of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-height - The height of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-shape - The border radius of the handle.\r\n * @cssprop --m3e-bottom-sheet-handle-color - The color of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-focus-ring-offset - The offset of the focus ring around the handle.\r\n * @cssprop --m3e-bottom-sheet-color - The foreground (text) color of the sheet.\r\n * @cssprop --m3e-bottom-sheet-content-font-size - Font size for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-font-weight - Font weight for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-line-height - Line height for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-tracking - Letter spacing (tracking) for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-header-font-size - Font size for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-font-weight - Font weight for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-line-height - Line height for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-tracking - Letter spacing (tracking) for the sheet header.\r\n */\r\n@customElement(\"m3e-bottom-sheet\")\r\nexport class M3eBottomSheetElement extends EventAttribute(\r\n ReconnectedCallback(SuppressInitialAnimation(AttachInternals(LitElement))),\r\n \"opening\",\r\n \"opened\",\r\n \"cancel\",\r\n \"closing\",\r\n \"closed\",\r\n) {\r\n static {\r\n registerStyleSheet(css`\r\n @property --_bottom-sheet-height {\r\n syntax: \"<length>\";\r\n inherits: false;\r\n initial-value: 50vh;\r\n }\r\n m3e-bottom-sheet > [slot=\"header\"] {\r\n margin-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n margin-inline: var(--m3e-bottom-sheet-padding-inline, 1rem);\r\n }\r\n `);\r\n }\r\n\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: block;\r\n position: fixed;\r\n left: 50%;\r\n top: calc(100vh - var(--_bottom-sheet-height));\r\n margin: 0;\r\n padding: 0;\r\n outline: none;\r\n overflow: hidden;\r\n border: none;\r\n box-sizing: border-box;\r\n width: var(--m3e-bottom-sheet-width, 100%);\r\n max-width: var(--m3e-bottom-sheet-max-width, 40rem);\r\n height: var(--_bottom-sheet-height);\r\n color: var(--m3e-bottom-sheet-color, ${DesignToken.color.onSurface});\r\n background-color: var(--m3e-bottom-sheet-container-color, ${DesignToken.color.surfaceContainerLow});\r\n }\r\n :host(:not(:state(-no-animate))) {\r\n transition: ${unsafeCSS(\r\n `transform ${DesignToken.motion.duration.medium2} ${DesignToken.motion.easing.standardDecelerate},\r\n border-radius ${DesignToken.motion.duration.medium2} ${DesignToken.motion.easing.standard}`,\r\n )};\r\n }\r\n :host(:not([modal]):not(:state(-full))) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host([modal]:not(:state(-full))) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-modal-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host(:state(-full)) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-full-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host(:not([modal])) {\r\n z-index: var(--m3e-bottom-sheet-z-index, 10);\r\n }\r\n :host(:not([modal]):not([open])),\r\n :host([modal]:not(:popover-open)) {\r\n border-radius: var(--m3e-bottom-sheet-minimized-container-shape, ${DesignToken.shape.corner.none});\r\n transform: translateX(-50%) translateY(100%);\r\n }\r\n :host(:not([modal])[open]:not(:state(-full))),\r\n :host([modal]:not(:state(-full)):popover-open) {\r\n border-radius: var(--m3e-bottom-sheet-container-shape, ${DesignToken.shape.corner.extraLargeTop});\r\n }\r\n :host(:not([modal])[open]:state(-full)),\r\n :host([modal]:state(-full):popover-open) {\r\n border-radius: var(--m3e-bottom-sheet-full-container-shape, ${DesignToken.shape.corner.extraLargeTop});\r\n }\r\n :host(:not([modal])[open]),\r\n :host([modal]:popover-open) {\r\n transform: translateX(-50%) translateY(0);\r\n }\r\n :host([modal]:not(:state(-no-animate)))::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host([modal]:popover-open)::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-bottom-sheet-scrim-color, ${DesignToken.color.scrim}) var(--m3e-bottom-sheet-scrim-opacity, 32%),\r\n transparent\r\n );\r\n }\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n @starting-style {\r\n :host([modal]:popover-open)::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-bottom-sheet-scrim-color, ${DesignToken.color.scrim}) 0%,\r\n transparent\r\n );\r\n }\r\n }\r\n .base {\r\n display: flex;\r\n border-radius: inherit;\r\n flex-direction: column;\r\n height: 100%;\r\n --_bottom-sheet-peek-height: var(--m3e-bottom-sheet-peek-height, 0);\r\n --_bottom-sheet-top-space: var(--m3e-bottom-sheet-compact-top-space, 4.5rem);\r\n }\r\n @media (max-height: 640px) {\r\n .base {\r\n --_bottom-sheet-top-space: var(--m3e-bottom-sheet-top-space, 3.5rem);\r\n }\r\n }\r\n .body {\r\n flex: 1 1 auto;\r\n overflow-y: auto;\r\n scrollbar-width: ${DesignToken.scrollbar.thinWidth};\r\n scrollbar-color: ${DesignToken.scrollbar.color};\r\n padding-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n padding-inline: var(--m3e-bottom-sheet-padding-inline, 1rem);\r\n font-size: var(--m3e-bottom-sheet-content-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(\r\n --m3e-bottom-sheet-content-font-weight,\r\n ${DesignToken.typescale.standard.body.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-bottom-sheet-content-line-height,\r\n ${DesignToken.typescale.standard.body.medium.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-bottom-sheet-content-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n .content {\r\n height: fit-content;\r\n }\r\n :host(:not([handle])) .header {\r\n display: none;\r\n }\r\n :host(:not([handle])) .body,\r\n .header {\r\n border-top-left-radius: inherit;\r\n border-top-right-radius: inherit;\r\n padding-block-start: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n font-size: var(--m3e-bottom-sheet-header-font-size, ${DesignToken.typescale.standard.title.large.fontSize});\r\n font-weight: var(--m3e-bottom-sheet-header-font-weight, ${DesignToken.typescale.standard.title.large.fontWeight});\r\n line-height: var(--m3e-bottom-sheet-header-line-height, ${DesignToken.typescale.standard.title.large.lineHeight});\r\n letter-spacing: var(--m3e-bottom-sheet-header-tracking, ${DesignToken.typescale.standard.title.large.tracking});\r\n }\r\n .header {\r\n cursor: grab;\r\n touch-action: none;\r\n outline: none;\r\n user-select: none;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n box-sizing: border-box;\r\n flex: none;\r\n display: flex;\r\n flex-direction: column;\r\n min-height: 3rem;\r\n --m3e-app-bar-container-color: var(--m3e-bottom-sheet-container-color, ${DesignToken.color.surfaceContainerLow});\r\n }\r\n .handle-row {\r\n position: relative;\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n opacity: 1;\r\n visibility: visible;\r\n height: var(--m3e-bottom-sheet-handle-container-height, 1.5rem);\r\n }\r\n :host(:not(:state(-no-animate))) .handle-row {\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n padding ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n height ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .handle {\r\n position: relative;\r\n width: var(--m3e-bottom-sheet-handle-width, 2rem);\r\n height: var(--m3e-bottom-sheet-handle-height, 4px);\r\n border-radius: var(--m3e-bottom-sheet-handle-shape, ${DesignToken.shape.corner.full});\r\n background-color: var(--m3e-bottom-sheet-handle-color, ${DesignToken.color.onSurfaceVariant});\r\n }\r\n .handle-touch {\r\n position: absolute;\r\n aspect-ratio: 1 / 1;\r\n height: 3rem;\r\n left: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2));\r\n right: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2));\r\n top: calc(\r\n 0px - calc(\r\n calc(3rem - var(--m3e-bottom-sheet-handle-container-height, 1.5rem)) - calc(\r\n var(--m3e-bottom-sheet-handle-height, 4px) / 2\r\n )\r\n )\r\n );\r\n }\r\n @media (prefers-reduced-motion) {\r\n :host(:not(:state(-no-animate))),\r\n :host([modal]:not(:state(-no-animate)))::backdrop,\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop,\r\n :host(:not(:state(-no-animate))) .handle-row {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n :host([modal]:not(:state(-no-animate)))::backdrop,\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop {\r\n transition: none;\r\n }\r\n .base {\r\n border-style: solid;\r\n border-width: 1px;\r\n border-color: CanvasText;\r\n }\r\n .handle {\r\n background-color: ButtonText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __openSheet?: M3eBottomSheetElement;\r\n\r\n /** @private */ readonly #documentClickHandler = (e: Event) => this.#handleDocumentClick(e);\r\n /** @private */ readonly #documentKeyDownHandler = (e: KeyboardEvent) => this.#handleDocumentKeyDown(e);\r\n /** @private */ readonly #windowResizeHandler = () => this.#handleWindowResize();\r\n /** @private */ readonly #velocityTracker = new VelocityTracker();\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n /** @private */ readonly #inertController = new InertController(this);\r\n\r\n /** @private */\r\n readonly #resizeController = new ResizeController(this, {\r\n target: null,\r\n skipInitial: true,\r\n callback: (x) => this.#handleSectionResize(x),\r\n });\r\n\r\n /** @private */ #trigger: Element | null = null;\r\n /** @private */ #dragState?: {\r\n startY: number;\r\n startHeight: number;\r\n effectiveMaxHeight: number;\r\n maxHeight: number;\r\n minHeight: number;\r\n };\r\n /** @private */ #dragged = false;\r\n /** @private */ #activeDetent = 0;\r\n /** @private */ #requestDetent?: number;\r\n /** @private */ #cachedContentHeight = 0;\r\n /** @private */ #cachedHeaderHeight = 0;\r\n /** @private */ #snapAnimation?: Animation;\r\n\r\n /**\r\n * Whether the bottom sheet behaves as modal.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) modal = false;\r\n\r\n /**\r\n * Whether the bottom sheet is open.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) open = false;\r\n\r\n /**\r\n * Whether to display a drag handle and enable the top region of the sheet as a gesture\r\n * surface for dragging between detents.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) handle = false;\r\n\r\n /**\r\n * The accessible label given to the drag handle.\r\n * @default \"Drag handle\"\r\n */\r\n @property({ attribute: \"handle-label\" }) handleLabel = \"Drag handle\";\r\n\r\n /**\r\n * Detents (discrete height states) the sheet can snap to.\r\n * @default []\r\n */\r\n @property({ attribute: \"detents\", converter: spaceSeparatedStringConverter }) detents: string[] = [];\r\n\r\n /**\r\n * The zero‑based index of the detent the sheet should open to.\r\n * @default 0\r\n */\r\n @property({ type: Number }) detent = 0;\r\n\r\n /**\r\n * Whether the bottom sheet can hide when its swiped down.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) hideable = false;\r\n\r\n /**\r\n * The friction coefficient to hide the sheet.\r\n * @default 0.5\r\n */\r\n @property({ attribute: \"hide-friction\", type: Number }) hideFriction = 0.5;\r\n\r\n /**\r\n * A fractional value, between 0 and 100, indicating the maximum visual overshoot allowed when dragging past the minimum or maximum size.\r\n * @default 4\r\n */\r\n @property({ attribute: \"overshoot-limit\", type: Number }) overshootLimit = 4;\r\n\r\n /**\r\n * Shows the sheet.\r\n * @param {number} detent The zero‑based index of the detent the sheet should open to.\r\n */\r\n show(detent: number = this.detent): void {\r\n if (!this.open) {\r\n this.#requestDetent = detent;\r\n this.open = true;\r\n } else if (detent !== undefined && this.#activeDetent !== detent) {\r\n this.#snapToDetent(detent);\r\n }\r\n }\r\n\r\n /** Hides the sheet. */\r\n hide(): void {\r\n this.open = false;\r\n }\r\n\r\n /**\r\n * Toggles the opened state of the sheet.\r\n * @param {number} detent The zero‑based index of the detent the sheet should open to.\r\n */\r\n toggle(detent?: number): void {\r\n if (this.open) {\r\n this.hide();\r\n } else {\r\n this.show(detent);\r\n }\r\n }\r\n\r\n /** Moves the sheet to the next detent. */\r\n cycle(): void {\r\n if (!this.open) {\r\n this.show();\r\n } else if (this.detents.length > 0) {\r\n if (this.#activeDetent < this.detents.length - 1) {\r\n this.#activeDetent++;\r\n this.#snapToDetent(this.#activeDetent);\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"modal\")) {\r\n this.role = this.modal ? \"dialog\" : \"region\";\r\n this.ariaModal = this.modal ? \"true\" : null;\r\n this.popover = this.modal ? \"manual\" : null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n this.#initialize();\r\n }\r\n\r\n /** @inheritdoc */\r\n override firstUpdated(_changedProperties: PropertyValues): void {\r\n super.firstUpdated(_changedProperties);\r\n this.#initialize();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues): void {\r\n super.updated(_changedProperties);\r\n\r\n if (_changedProperties.has(\"open\")) {\r\n if (this.open) {\r\n if (!this.dispatchEvent(new Event(\"opening\", { cancelable: true }))) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n // Only one sheet can be open at a time.\r\n if (M3eBottomSheetElement.__openSheet !== this) {\r\n M3eBottomSheetElement.__openSheet?.hide();\r\n }\r\n M3eBottomSheetElement.__openSheet = this;\r\n\r\n this.inert = false;\r\n\r\n window.addEventListener(\"resize\", this.#windowResizeHandler);\r\n\r\n // If there are detents (regardless of handle) open to the requested, default (or first) detent.\r\n // Otherwise, open to fit unless its greater than half.\r\n\r\n if (this.detents.length > 0) {\r\n this.#activeDetent = Math.min(Math.max(0, this.#requestDetent ?? this.detent), this.detents.length - 1);\r\n this.#updateHeight(this.#computeDetentHeight(this.detents[this.#activeDetent]));\r\n } else {\r\n this.#updateHeight(Math.min(this.#computeDetentHeight(\"fit\"), this.#computeDetentHeight(\"half\")));\r\n }\r\n this.#requestDetent = undefined;\r\n } else {\r\n if (!this.dispatchEvent(new Event(\"closing\", { cancelable: true }))) {\r\n this.open = true;\r\n return;\r\n }\r\n\r\n // The following ensures layout is stable so that first tab isn't \"skipped\"\r\n requestAnimationFrame(() => (this.inert = true));\r\n\r\n window.removeEventListener(\"resize\", this.#windowResizeHandler);\r\n\r\n if (M3eBottomSheetElement.__openSheet === this) {\r\n M3eBottomSheetElement.__openSheet = undefined;\r\n }\r\n }\r\n\r\n if (this.modal) {\r\n if (this.open) {\r\n this.#trigger = document.activeElement;\r\n this.#inertController.lock();\r\n this.#scrollLockController.lock();\r\n this.showPopover();\r\n requestAnimationFrame(() => {\r\n document.addEventListener(\"click\", this.#documentClickHandler);\r\n document.addEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n });\r\n\r\n let focusable: HTMLElement | null | undefined = this.querySelector<HTMLElement>(\"[autofocus]\");\r\n if (!focusable || !M3eInteractivityChecker.isFocusable(focusable)) {\r\n focusable = this.shadowRoot?.querySelector(\".handle\");\r\n }\r\n if (focusable) {\r\n focusWhenReady(focusable);\r\n }\r\n } else {\r\n this.#snapToHeight(0).then(() => {\r\n this.#inertController.unlock();\r\n this.#scrollLockController.unlock();\r\n document.removeEventListener(\"click\", this.#documentClickHandler);\r\n document.removeEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n this.hidePopover();\r\n if (this.#trigger instanceof HTMLElement) {\r\n this.#trigger.focus();\r\n }\r\n this.#trigger = null;\r\n });\r\n }\r\n }\r\n\r\n this.dispatchEvent(new Event(this.open ? \"opened\" : \"closed\"));\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<m3e-focus-trap ?disabled=\"${!this.modal}\">\r\n <div class=\"base\">\r\n <m3e-elevation class=\"elevation\"></m3e-elevation>\r\n <div\r\n class=\"header\"\r\n @pointerdown=\"${this.#handleHeaderPointerDown}\"\r\n @pointermove=\"${this.#handleHeaderPointerMove}\"\r\n @pointerup=\"${this.#handleHeaderPointerUp}\"\r\n >\r\n ${this.handle\r\n ? html`<div class=\"handle-row\">\r\n <div\r\n id=\"handle\"\r\n class=\"handle\"\r\n role=\"button\"\r\n aria-label=\"${this.handleLabel}\"\r\n tabindex=\"0\"\r\n @click=\"${this.#handleDragHandleClick}\"\r\n @keydown=\"${this.#handleDragHandleKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"handle\"></m3e-focus-ring>\r\n <div class=\"handle-touch\" aria-hidden=\"true\"></div>\r\n </div>\r\n </div>`\r\n : nothing}\r\n <slot name=\"header\" @slotchange=\"${this.#handleHeaderSlotChange}\"></slot>\r\n </div>\r\n <div class=\"body\">\r\n <div class=\"content\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n </div>\r\n </m3e-focus-trap>`;\r\n }\r\n\r\n /** @private */\r\n #initialize(): void {\r\n const content = this.shadowRoot?.querySelector<HTMLElement>(\".content\");\r\n if (content) {\r\n this.#cachedContentHeight = content.clientHeight;\r\n this.#resizeController.observe(content);\r\n }\r\n\r\n const header = this.shadowRoot?.querySelector<HTMLElement>(\".header\");\r\n if (header) {\r\n this.#cachedHeaderHeight = header.clientHeight;\r\n this.#resizeController.observe(header);\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleHeaderSlotChange(e: Event): void {\r\n setCustomState(this, \"has-header\", hasAssignedNodes(e.target as HTMLSlotElement));\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerDown(e: PointerEvent): void {\r\n if (e.target instanceof HTMLElement && M3eInteractivityChecker.isFocusable(e.target)) {\r\n return;\r\n }\r\n\r\n (<HTMLElement>e.target).setPointerCapture(e.pointerId);\r\n (<HTMLElement>e.target).style.cursor = \"grabbing\";\r\n\r\n this.#velocityTracker.reset();\r\n this.#velocityTracker.add(e.clientY);\r\n\r\n const maxHeight = this.#computeMaxHeight();\r\n const effectiveMaxHeight =\r\n this.detents.length > 0 ? Math.max(...this.detents.map((x) => this.#computeDetentHeight(x))) : maxHeight;\r\n\r\n this.#dragState = {\r\n startY: e.clientY,\r\n startHeight: this.clientHeight,\r\n effectiveMaxHeight,\r\n maxHeight,\r\n minHeight: this.#computeMinHeight(),\r\n };\r\n this.#dragged = false;\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerMove(e: PointerEvent): void {\r\n if (!this.#dragState) {\r\n return;\r\n }\r\n\r\n const minDragThreshold = 8;\r\n if (Math.abs(e.clientY - this.#dragState.startY) <= minDragThreshold) {\r\n // Ignore movement under threshold\r\n return;\r\n }\r\n\r\n (e.getCoalescedEvents?.() ?? [e]).forEach((x) => this.#velocityTracker.add(x.clientY, e.timeStamp));\r\n\r\n let newHeight = this.#dragState.startHeight - (e.clientY - this.#dragState.startY);\r\n if (newHeight < this.#dragState.minHeight) {\r\n if (this.hideable) {\r\n const overshoot = (this.#dragState.minHeight - newHeight) * this.hideFriction;\r\n newHeight = this.#dragState.minHeight - overshoot;\r\n } else {\r\n const overshoot = this.#dragState.minHeight - newHeight;\r\n const overshootLimit = this.#dragState.maxHeight * (this.overshootLimit / 100);\r\n const compressed = (overshootLimit * overshoot) / (overshoot + overshootLimit);\r\n newHeight = this.#dragState.minHeight - compressed;\r\n }\r\n } else if (newHeight > this.#dragState.effectiveMaxHeight) {\r\n const overshoot = newHeight - this.#dragState.effectiveMaxHeight;\r\n const overshootLimit = this.#dragState.maxHeight * (this.overshootLimit / 100);\r\n const compressed = (overshootLimit * overshoot) / (overshoot + overshootLimit);\r\n newHeight = this.#dragState.effectiveMaxHeight + compressed;\r\n }\r\n\r\n this.#updateHeight(newHeight);\r\n this.#dragged = true;\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerUp(e: PointerEvent): void {\r\n if (!this.#dragState) return;\r\n\r\n try {\r\n (<HTMLElement>e.target).releasePointerCapture(e.pointerId);\r\n (<HTMLElement>e.target).style.cursor = \"\";\r\n\r\n if (!this.#dragged) return;\r\n\r\n const significantVelocityThreshold = e.pointerType === \"touch\" ? 1200 : 500;\r\n const velocity = this.#velocityTracker.getVelocity();\r\n\r\n this.#velocityTracker.reset();\r\n\r\n if (this.hideable && velocity >= significantVelocityThreshold) {\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n } else if (Math.abs(velocity) >= significantVelocityThreshold) {\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextHigherDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n }\r\n } else {\r\n this.#snapToHeight(this.#computeDetentHeight(\"full\"));\r\n }\r\n } else {\r\n const hideDistanceThreshold = 20;\r\n if (this.hideable) {\r\n const collapsed = this.#dragState.minHeight;\r\n if (this.clientHeight < collapsed - hideDistanceThreshold) {\r\n this.hide();\r\n return;\r\n }\r\n }\r\n\r\n if (this.detents.length > 0) {\r\n this.#snapToDetent(this.#getClosestDetent());\r\n } else if (this.clientHeight < this.#dragState.minHeight) {\r\n this.#snapToHeight(this.#dragState.minHeight);\r\n } else if (this.clientHeight > this.#dragState.effectiveMaxHeight) {\r\n this.#snapToHeight(this.#dragState.effectiveMaxHeight);\r\n }\r\n }\r\n } finally {\r\n this.#dragState = undefined;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDocumentClick(e: Event): void {\r\n if (\r\n this.open &&\r\n this.modal &&\r\n !e.composedPath().includes(this) &&\r\n this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))\r\n ) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDocumentKeyDown(e: KeyboardEvent): void {\r\n if (this.open && this.modal && e.key === \"Escape\" && !e.shiftKey && !e.ctrlKey) {\r\n e.preventDefault();\r\n\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleWindowResize(): void {\r\n if (this.detents.length > 0 && this.detents[this.#activeDetent] === \"half\") {\r\n this.#updateHeight(this.#computeDetentHeight(\"half\"));\r\n return;\r\n }\r\n\r\n const maxHeight = this.#computeMaxHeight();\r\n if (hasCustomState(this, \"-full\")) {\r\n this.#updateHeight(maxHeight);\r\n } else if (this.clientHeight > maxHeight) {\r\n this.#updateHeight(maxHeight);\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDragHandleClick(): void {\r\n if (!this.#dragged) {\r\n this.cycle();\r\n }\r\n this.#dragged = false;\r\n }\r\n\r\n /** @private */\r\n #handleDragHandleKeyDown(e: KeyboardEvent): void {\r\n if (e.defaultPrevented || !isModifierAllowed(e)) return;\r\n\r\n switch (e.key) {\r\n case \"Up\":\r\n case \"ArrowUp\":\r\n e.preventDefault();\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextHigherDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n }\r\n } else {\r\n this.#snapToHeight(this.#computeDetentHeight(\"full\"));\r\n }\r\n break;\r\n\r\n case \"Down\":\r\n case \"ArrowDown\":\r\n e.preventDefault();\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextLowerDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n\r\n break;\r\n }\r\n }\r\n\r\n /** @private */\r\n #getNextHigherDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let nextHeight = Infinity;\r\n let nextDetent = this.#activeDetent;\r\n for (let i = 0; i < this.detents.length; i++) {\r\n if (i === this.#activeDetent) continue;\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n if (detentHeight > currentHeight && detentHeight < nextHeight) {\r\n nextHeight = detentHeight;\r\n nextDetent = i;\r\n }\r\n }\r\n return nextDetent;\r\n }\r\n\r\n /** @private */\r\n #getNextLowerDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let nextHeight = -Infinity;\r\n let nextDetent = this.#activeDetent;\r\n for (let i = 0; i < this.detents.length; i++) {\r\n if (i === this.#activeDetent) continue;\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n if (detentHeight < currentHeight && detentHeight > nextHeight) {\r\n nextHeight = detentHeight;\r\n nextDetent = i;\r\n }\r\n }\r\n return nextDetent;\r\n }\r\n\r\n /** @private */\r\n #getClosestDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let closestDetent = this.#activeDetent;\r\n let closestDistance = Infinity;\r\n\r\n for (let i = 0; i < this.detents.length; i++) {\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n const distance = Math.abs(currentHeight - detentHeight);\r\n\r\n if (distance < closestDistance) {\r\n closestDistance = distance;\r\n closestDetent = i;\r\n }\r\n }\r\n return closestDetent;\r\n }\r\n\r\n /** @private */\r\n #computeDetentHeight(detent: string): number {\r\n switch (detent) {\r\n case \"collapsed\":\r\n return this.#computeMinHeight();\r\n case \"half\":\r\n return this.#computeMaxHeight() * 0.5;\r\n case \"full\":\r\n return this.#computeMaxHeight();\r\n case \"fit\":\r\n return this.#computeFitHeight();\r\n }\r\n\r\n if (detent.endsWith(\"%\")) {\r\n return this.#computeMaxHeight() * (parseFloat(detent) / 100);\r\n }\r\n\r\n if (detent.endsWith(\"px\")) {\r\n return parseFloat(detent);\r\n }\r\n\r\n return this.#computeMinHeight();\r\n }\r\n\r\n /** @private */\r\n #computeMaxHeight(): number {\r\n const base = this.shadowRoot?.querySelector<HTMLElement>(\".base\");\r\n return window.innerHeight - (base ? computeCssSize(base, \"var(--_bottom-sheet-top-space)\") : 0);\r\n }\r\n\r\n /** @private */\r\n #computeMinHeight(): number {\r\n return this.detents.includes(\"fit\") && !this.detents.includes(\"collapsed\")\r\n ? this.#computeFitHeight()\r\n : this.#computePeekHeight();\r\n }\r\n\r\n /** @private */\r\n #computePeekHeight(): number {\r\n const base = this.shadowRoot?.querySelector<HTMLElement>(\".base\");\r\n return this.#cachedHeaderHeight + (base ? computeCssSize(base, \"var(--_bottom-sheet-peek-height)\") : 0);\r\n }\r\n\r\n /** @private */\r\n #computeFitHeight(): number {\r\n const body = this.shadowRoot?.querySelector<HTMLElement>(\".body\");\r\n if (!body) {\r\n return 0;\r\n }\r\n\r\n const bodyStyle = getComputedStyle(body);\r\n return (\r\n this.#cachedHeaderHeight +\r\n this.#cachedContentHeight +\r\n parseFloat(bodyStyle.paddingBlockStart) +\r\n parseFloat(bodyStyle.paddingBlockEnd)\r\n );\r\n }\r\n\r\n /** @private */\r\n #handleSectionResize(entries: ResizeObserverEntry[]): void {\r\n const oldCachedContentHeight = this.#cachedContentHeight;\r\n const oldCachedHeaderHeight = this.#cachedHeaderHeight;\r\n\r\n for (const entry of entries) {\r\n if (entry.target.classList.contains(\"content\")) {\r\n this.#cachedContentHeight = (<ResizeObserverSize>(\r\n (Array.isArray(entry.borderBoxSize) ? entry.borderBoxSize[0] : entry.borderBoxSize)\r\n )).blockSize;\r\n } else if (entry.target.classList.contains(\"header\")) {\r\n this.#cachedHeaderHeight = (<ResizeObserverSize>(\r\n (Array.isArray(entry.borderBoxSize) ? entry.borderBoxSize[0] : entry.borderBoxSize)\r\n )).blockSize;\r\n }\r\n }\r\n\r\n if (\r\n this.open &&\r\n this.detents.length > 0 &&\r\n (oldCachedContentHeight !== this.#cachedContentHeight || oldCachedHeaderHeight !== this.#cachedHeaderHeight)\r\n ) {\r\n switch (this.detents[this.#activeDetent]) {\r\n case \"fit\":\r\n this.#updateHeight(this.#computeFitHeight());\r\n break;\r\n\r\n case \"collapsed\":\r\n this.#updateHeight(this.#computeMinHeight());\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #snapToDetent(detent: number): void {\r\n if (detent >= 0 && detent < this.detents.length) {\r\n this.#activeDetent = detent;\r\n this.#snapToHeight(this.#computeDetentHeight(this.detents[detent]));\r\n }\r\n }\r\n\r\n /** @private */\r\n async #snapToHeight(height: number): Promise<void> {\r\n if (this.#snapAnimation) {\r\n this.#updateHeight(this.clientHeight);\r\n this.#snapAnimation?.cancel();\r\n this.#snapAnimation = undefined;\r\n }\r\n\r\n if (!prefersReducedMotion()) {\r\n this.#snapAnimation = this.animate(\r\n [{ \"--_bottom-sheet-height\": `${this.clientHeight}px` }, { \"--_bottom-sheet-height\": `${height}px` }],\r\n {\r\n duration: 250,\r\n easing: \"cubic-bezier(0.2, 0.0, 0, 1.0)\",\r\n },\r\n );\r\n this.#snapAnimation.onfinish = () => {\r\n this.#updateHeight(height);\r\n this.#snapAnimation = undefined;\r\n };\r\n await this.#snapAnimation.finished;\r\n } else {\r\n this.#updateHeight(height);\r\n }\r\n }\r\n\r\n /** @private */\r\n #updateHeight(height: number): void {\r\n this.style.setProperty(\"--_bottom-sheet-height\", `${height}px`);\r\n setCustomState(this, \"-full\", height === this.#computeMaxHeight());\r\n const content = this.shadowRoot?.querySelector<HTMLElement>(\".content\");\r\n if (content) {\r\n content.inert = height <= this.#computePeekHeight();\r\n }\r\n }\r\n}\r\n\r\ninterface M3eBottomSheetElementEventMap extends HTMLElementEventMap {\r\n opening: Event;\r\n opened: Event;\r\n closing: Event;\r\n closed: Event;\r\n cancel: Event;\r\n}\r\n\r\nexport interface M3eBottomSheetElement {\r\n addEventListener<K extends keyof M3eBottomSheetElementEventMap>(\r\n type: K,\r\n listener: (this: M3eBottomSheetElement, ev: M3eBottomSheetElementEventMap[K]) => void,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n addEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener<K extends keyof M3eBottomSheetElementEventMap>(\r\n type: K,\r\n listener: (this: M3eBottomSheetElement, ev: M3eBottomSheetElementEventMap[K]) => void,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-bottom-sheet\": M3eBottomSheetElement;\r\n }\r\n}\r\n","import { property } from \"lit/decorators.js\";\r\n\r\nimport { ActionElementBase, customElement, HtmlFor } from \"@m3e/web/core\";\r\nimport { addAriaReferencedId, removeAriaReferencedId } from \"@m3e/web/core/a11y\";\r\n\r\nimport { M3eBottomSheetElement } from \"./BottomSheetElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to trigger a bottom sheet.\r\n * @tag m3e-bottom-sheet-trigger\r\n *\r\n * @slot - Renders the content of the trigger.\r\n *\r\n * @attr detent - The zero‑based index of the detent the sheet should open to.\r\n * @attr secondary - Marks this trigger as a secondary trigger for accessibility. Secondary triggers do not receive ARIA ownership.\r\n */\r\n@customElement(\"m3e-bottom-sheet-trigger\")\r\nexport class M3eBottomSheetTriggerElement extends HtmlFor(ActionElementBase) {\r\n /**\r\n * The zero‑based index of the detent the sheet should open to.\r\n * @default undefined\r\n */\r\n @property({ type: Number }) detent?: number;\r\n\r\n /**\r\n * Marks this trigger as a secondary trigger for accessibility. Secondary triggers do not receive ARIA ownership.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) secondary = false;\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n if (control instanceof M3eBottomSheetElement) {\r\n super.attach(control);\r\n\r\n if (this.parentElement) {\r\n if (!control.modal) {\r\n if (!this.secondary) {\r\n this.parentElement.ariaExpanded = \"false\";\r\n addAriaReferencedId(this.parentElement, \"aria-controls\", control.id);\r\n if (this.parentElement.id) {\r\n addAriaReferencedId(control, \"aria-labelledby\", this.parentElement.id);\r\n }\r\n }\r\n } else {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control && this.parentElement && !this.secondary) {\r\n removeAriaReferencedId(this.parentElement, \"aria-controls\", this.control.id);\r\n }\r\n super.detach();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n if (this.control instanceof M3eBottomSheetElement) {\r\n if (this.control.modal) {\r\n this.control.show(this.detent);\r\n } else {\r\n this.control.toggle(this.detent);\r\n if (!this.secondary && this.parentElement) {\r\n this.parentElement.ariaExpanded = `${this.control.open}`;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-bottom-sheet-trigger\": M3eBottomSheetTriggerElement;\r\n }\r\n}\r\n"],"names":["M3eBottomSheetActionElement","ActionElementBase","_onClick","this","closest","hide","__decorate","customElement","M3eBottomSheetElement","M3eBottomSheetElement_1","EventAttribute","ReconnectedCallback","SuppressInitialAnimation","AttachInternals","LitElement","constructor","_M3eBottomSheetElement_documentClickHandler","set","e","__classPrivateFieldGet","call","_M3eBottomSheetElement_documentKeyDownHandler","_M3eBottomSheetElement_windowResizeHandler","_M3eBottomSheetElement_instances","_M3eBottomSheetElement_handleWindowResize","_M3eBottomSheetElement_velocityTracker","VelocityTracker","_M3eBottomSheetElement_scrollLockController","ScrollLockController","_M3eBottomSheetElement_inertController","InertController","_M3eBottomSheetElement_resizeController","ResizeController","target","skipInitial","callback","x","_M3eBottomSheetElement_handleSectionResize","_M3eBottomSheetElement_trigger","_M3eBottomSheetElement_dragState","_M3eBottomSheetElement_dragged","_M3eBottomSheetElement_activeDetent","_M3eBottomSheetElement_requestDetent","_M3eBottomSheetElement_cachedContentHeight","_M3eBottomSheetElement_cachedHeaderHeight","_M3eBottomSheetElement_snapAnimation","modal","open","handle","handleLabel","detents","detent","hideable","hideFriction","overshootLimit","show","undefined","_M3eBottomSheetElement_snapToDetent","__classPrivateFieldSet","toggle","cycle","length","_a","update","changedProperties","super","has","role","ariaModal","popover","reconnectedCallback","_M3eBottomSheetElement_initialize","firstUpdated","_changedProperties","updated","dispatchEvent","Event","cancelable","__openSheet","inert","window","addEventListener","Math","min","max","_M3eBottomSheetElement_updateHeight","_M3eBottomSheetElement_computeDetentHeight","requestAnimationFrame","removeEventListener","document","activeElement","lock","showPopover","focusable","querySelector","M3eInteractivityChecker","isFocusable","shadowRoot","focusWhenReady","_M3eBottomSheetElement_snapToHeight","then","unlock","hidePopover","HTMLElement","focus","render","html","_M3eBottomSheetElement_handleHeaderPointerDown","_M3eBottomSheetElement_handleHeaderPointerMove","_M3eBottomSheetElement_handleHeaderPointerUp","_M3eBottomSheetElement_handleDragHandleClick","_M3eBottomSheetElement_handleDragHandleKeyDown","nothing","_M3eBottomSheetElement_handleHeaderSlotChange","content","clientHeight","observe","header","setCustomState","hasAssignedNodes","setPointerCapture","pointerId","style","cursor","reset","add","clientY","maxHeight","effectiveMaxHeight","map","startY","startHeight","minHeight","_M3eBottomSheetElement_computeMinHeight","abs","getCoalescedEvents","forEach","timeStamp","newHeight","overshoot","compressed","releasePointerCapture","significantVelocityThreshold","pointerType","velocity","getVelocity","nextDetent","hideDistanceThreshold","collapsed","_M3eBottomSheetElement_getClosestDetent","composedPath","includes","key","shiftKey","ctrlKey","preventDefault","hasCustomState","defaultPrevented","isModifierAllowed","currentHeight","nextHeight","Infinity","i","detentHeight","closestDetent","closestDistance","distance","_M3eBottomSheetElement_computeMaxHeight","_M3eBottomSheetElement_computeFitHeight","endsWith","parseFloat","base","innerHeight","computeCssSize","body","bodyStyle","getComputedStyle","paddingBlockStart","paddingBlockEnd","entries","oldCachedContentHeight","oldCachedHeaderHeight","entry","classList","contains","Array","isArray","borderBoxSize","blockSize","async","height","cancel","prefersReducedMotion","animate","duration","easing","onfinish","finished","setProperty","_M3eBottomSheetElement_computePeekHeight","registerStyleSheet","css","styles","DesignToken","color","onSurface","surfaceContainerLow","unsafeCSS","motion","medium2","standardDecelerate","standard","elevation","level1","shape","corner","none","extraLargeTop","short3","scrim","long2","scrollbar","thinWidth","typescale","medium","fontSize","fontWeight","lineHeight","tracking","title","large","full","onSurfaceVariant","property","type","Boolean","reflect","prototype","attribute","converter","spaceSeparatedStringConverter","Number","M3eBottomSheetTriggerElement","HtmlFor","secondary","attach","control","parentElement","ariaHasPopup","ariaExpanded","addAriaReferencedId","id","detach","removeAriaReferencedId"],"mappings":";;;;;yzBASO,IAAMA,EAAN,cAA0CC,EAE5BC,QAAAA,GACjBC,KAAKC,QAAQ,qBAAqBC,MACpC,wGAJWL,EAA2BM,EAAA,CADvCC,EAAc,4BACFP,GCsHN,IAAMQ,GAAqBC,GAA3B,cAAoCC,EACzCC,EAAoBC,EAAyBC,EAAgBC,KAC7D,UACA,SACA,SACA,UACA,WANKC,WAAAA,mCAuOoBC,EAAAC,IAAAd,KAAyBe,GAAaC,EAAAhB,eAAyBiB,KAAzBjB,KAA0Be,IAChEG,EAAAJ,IAAAd,KAA2Be,GAAqBC,EAAAhB,eAA2BiB,KAA3BjB,KAA4Be,IAC5EI,EAAAL,IAAAd,KAAuB,IAAMgB,EAAAhB,KAAIoB,EAAA,IAAAC,IAAoBJ,KAAxBjB,OAC7BsB,EAAAR,IAAAd,KAAmB,IAAIuB,GACvBC,EAAAV,IAAAd,KAAwB,IAAIyB,EAAqBzB,OACjD0B,EAAAZ,IAAAd,KAAmB,IAAI2B,EAAgB3B,OAGvD4B,EAAAd,IAAAd,KAAoB,IAAI6B,EAAiB7B,KAAM,CACtD8B,OAAQ,KACRC,aAAa,EACbC,SAAWC,GAAMjB,EAAAhB,KAAIoB,EAAA,IAAAc,IAAqBjB,KAAzBjB,KAA0BiC,MAG7BE,EAAArB,IAAAd,KAA2B,MAC3BoC,EAAAtB,IAAAd,aAOAq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