@m3e/web 2.5.2 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/all.js +1039 -40
  2. package/dist/all.js.map +1 -1
  3. package/dist/all.min.js +158 -45
  4. package/dist/all.min.js.map +1 -1
  5. package/dist/autocomplete.js +2 -2
  6. package/dist/autocomplete.js.map +1 -1
  7. package/dist/autocomplete.min.js +1 -1
  8. package/dist/autocomplete.min.js.map +1 -1
  9. package/dist/bottom-sheet.js +2 -2
  10. package/dist/bottom-sheet.js.map +1 -1
  11. package/dist/bottom-sheet.min.js +1 -1
  12. package/dist/bottom-sheet.min.js.map +1 -1
  13. package/dist/calendar.js +12 -0
  14. package/dist/calendar.js.map +1 -1
  15. package/dist/calendar.min.js +5 -5
  16. package/dist/calendar.min.js.map +1 -1
  17. package/dist/chips.js +2 -2
  18. package/dist/chips.js.map +1 -1
  19. package/dist/chips.min.js +1 -1
  20. package/dist/chips.min.js.map +1 -1
  21. package/dist/core.js +2 -25
  22. package/dist/core.js.map +1 -1
  23. package/dist/core.min.js +1 -1
  24. package/dist/core.min.js.map +1 -1
  25. package/dist/css-custom-data.json +262 -262
  26. package/dist/custom-elements.json +1954 -2000
  27. package/dist/datepicker.js +6 -0
  28. package/dist/datepicker.js.map +1 -1
  29. package/dist/datepicker.min.js +1 -1
  30. package/dist/datepicker.min.js.map +1 -1
  31. package/dist/dialog.js +2 -2
  32. package/dist/dialog.js.map +1 -1
  33. package/dist/dialog.min.js +1 -1
  34. package/dist/dialog.min.js.map +1 -1
  35. package/dist/expansion-panel.js +2 -2
  36. package/dist/expansion-panel.js.map +1 -1
  37. package/dist/expansion-panel.min.js +1 -1
  38. package/dist/expansion-panel.min.js.map +1 -1
  39. package/dist/html-custom-data.json +92 -92
  40. package/dist/icon.js +1 -1
  41. package/dist/icon.js.map +1 -1
  42. package/dist/icon.min.js +1 -1
  43. package/dist/icon.min.js.map +1 -1
  44. package/dist/list.js +1 -1
  45. package/dist/list.js.map +1 -1
  46. package/dist/list.min.js +1 -1
  47. package/dist/list.min.js.map +1 -1
  48. package/dist/nav-bar.js +1 -1
  49. package/dist/nav-bar.js.map +1 -1
  50. package/dist/nav-bar.min.js +1 -1
  51. package/dist/nav-bar.min.js.map +1 -1
  52. package/dist/nav-menu.js +2 -2
  53. package/dist/nav-menu.js.map +1 -1
  54. package/dist/nav-menu.min.js +1 -1
  55. package/dist/nav-menu.min.js.map +1 -1
  56. package/dist/paginator.js +2 -2
  57. package/dist/paginator.js.map +1 -1
  58. package/dist/paginator.min.js +2 -2
  59. package/dist/paginator.min.js.map +1 -1
  60. package/dist/search.js +3 -3
  61. package/dist/search.js.map +1 -1
  62. package/dist/search.min.js +1 -1
  63. package/dist/search.min.js.map +1 -1
  64. package/dist/src/autocomplete/AutocompleteElement.d.ts.map +1 -1
  65. package/dist/src/bottom-sheet/BottomSheetElement.d.ts.map +1 -1
  66. package/dist/src/calendar/CalendarElement.d.ts.map +1 -1
  67. package/dist/src/chips/InputChipElement.d.ts.map +1 -1
  68. package/dist/src/core/shared/mixins/index.d.ts +0 -1
  69. package/dist/src/core/shared/mixins/index.d.ts.map +1 -1
  70. package/dist/src/core/shared/primitives/CollapsibleElement.d.ts.map +1 -1
  71. package/dist/src/datepicker/DatepickerElement.d.ts.map +1 -1
  72. package/dist/src/dialog/DialogElement.d.ts.map +1 -1
  73. package/dist/src/expansion-panel/ExpansionPanelElement.d.ts.map +1 -1
  74. package/dist/src/icon/IconElement.d.ts.map +1 -1
  75. package/dist/src/list/ListItemButtonElement.d.ts +0 -5
  76. package/dist/src/list/ListItemButtonElement.d.ts.map +1 -1
  77. package/dist/src/nav-bar/NavItemElement.d.ts.map +1 -1
  78. package/dist/src/nav-menu/NavMenuItemElement.d.ts.map +1 -1
  79. package/dist/src/paginator/PaginatorElement.d.ts.map +1 -1
  80. package/dist/src/search/SearchBarElement.d.ts.map +1 -1
  81. package/dist/src/search/SearchViewElement.d.ts.map +1 -1
  82. package/dist/src/theme/getColorFromImage.d.ts +12 -0
  83. package/dist/src/theme/getColorFromImage.d.ts.map +1 -0
  84. package/dist/src/theme/index.d.ts +1 -0
  85. package/dist/src/theme/index.d.ts.map +1 -1
  86. package/dist/src/tree/TreeItemElement.d.ts.map +1 -1
  87. package/dist/theme.js +1005 -1
  88. package/dist/theme.js.map +1 -1
  89. package/dist/theme.min.js +133 -20
  90. package/dist/theme.min.js.map +1 -1
  91. package/dist/toc.js +1 -1
  92. package/dist/toc.js.map +1 -1
  93. package/dist/toc.min.js +1 -1
  94. package/dist/toc.min.js.map +1 -1
  95. package/dist/tree.js +2 -2
  96. package/dist/tree.js.map +1 -1
  97. package/dist/tree.min.js +1 -1
  98. package/dist/tree.min.js.map +1 -1
  99. package/package.json +1 -1
  100. package/dist/src/core/shared/mixins/EventAttribute.d.ts +0 -11
  101. package/dist/src/core/shared/mixins/EventAttribute.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"bottom-sheet.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","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","__classPrivateFieldSet","undefined","_M3eBottomSheetElement_snapToDetent","toggle","cycle","length","_a","update","changedProperties","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","minDragThreshold","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","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","Html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C,0BAA0B,CAAC,CAC7B,EAAA0O,4BAA4B,CAuDxC;;;;"}
1
+ {"version":3,"file":"bottom-sheet.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 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 ReconnectedCallback(SuppressInitialAnimation(AttachInternals(LitElement))) {\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","closest","hide","__decorate","customElement","M3eBottomSheetElement","M3eBottomSheetElement_1","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","__classPrivateFieldSet","undefined","_M3eBottomSheetElement_snapToDetent","toggle","cycle","length","_a","update","changedProperties","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","minDragThreshold","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","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","ariaExpanded","addAriaReferencedId","id","ariaHasPopup","detach","removeAriaReferencedId"],"mappings":";;;;;;;;;;;AAEA;;;;;AAKG;AAEI,IAAMA,2BAA2B,GAAjC,MAAMA,2BAA4B,SAAQC,iBAAiB,CAAA;AAChE;AACmBC,EAAAA,QAAQA,GAAA;IACzB,IAAI,CAACC,OAAO,CAAC,kBAAkB,CAAC,EAAEC,IAAI,EAAE;AAC1C,EAAA;;AAJWJ,2BAA2B,GAAAK,UAAA,CAAA,CADvCC,aAAa,CAAC,yBAAyB,CAAC,CAC5B,EAAAN,2BAA2B,CAKvC;;;;ACaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGG;AAEI,IAAMO,qBAAqB,GAAAC,uBAAA,GAA3B,MAAMD,qBAAsB,SAAQE,mBAAmB,CAACC,wBAAwB,CAACC,eAAe,CAACC,UAAU,CAAC,CAAC,CAAC,CA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Aa,EAAE;UACzC,IAAI,CAACA,aAAa,CAACC,YAAY,GAAG,CAAA,EAAG,IAAI,CAACF,OAAO,CAACtM,IAAI,CAAA,CAAE;AAC1D,QAAA;AACF,MAAA;AACF,IAAA;AACF,EAAA;;AAjD4BxC,UAAA,CAAA,CAA3BiO,QAAQ,CAAC;AAAEC,EAAAA,IAAI,EAAEO;CAAQ,CAAC,CAAiB,EAAAC,4BAAA,CAAAL,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAMfrO,UAAA,CAAA,CAA5BiO,QAAQ,CAAC;AAAEC,EAAAA,IAAI,EAAEC;CAAS,CAAC,CAAmB,EAAAO,4BAAA,CAAAL,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAXpCK,4BAA4B,GAAA1O,UAAA,CAAA,CADxCC,aAAa,CAAC,0BAA0B,CAAC,CAC7B,EAAAyO,4BAA4B,CAuDxC;;;;"}
@@ -3,5 +3,5 @@
3
3
  * Copyright (c) 2025–2026 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
- import{__decorate as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{customElement as o,ActionElementBase as s,EventAttribute as n,ReconnectedCallback as a,SuppressInitialAnimation as h,AttachInternals as l,VelocityTracker as r,ScrollLockController as c,InertController as d,ResizeController as m,focusWhenReady as p,setCustomState as f,hasAssignedNodes as u,hasCustomState as b,computeCssSize as g,prefersReducedMotion as v,registerStyleSheet as y,DesignToken as w,spaceSeparatedStringConverter as k,HtmlFor as $}from"@m3e/web/core";import{LitElement as x,nothing as H,html as E,css as M,unsafeCSS as S}from"lit";import{property as _}from"lit/decorators.js";import{M3eInteractivityChecker as z,isModifierAllowed as L,addAriaReferencedId as W,removeAriaReferencedId as B}from"@m3e/web/core/a11y";let C=class extends s{_onClick(){this.closest("m3e-bottom-sheet")?.hide()}};var F,q,Y,A,P,D,R,T,N,U,I,j,K,V,X,G,J,O,Q,Z,tt,et,it,ot,st,nt,at,ht,lt,rt,ct,dt,mt,pt,ft,ut,bt,gt,vt;C=t([o("m3e-bottom-sheet-action")],C);let yt=vt=class extends(n(a(h(l(x))),"opening","opened","cancel","closing","closed")){constructor(){super(...arguments),F.add(this),q.set(this,t=>e(this,F,"m",et).call(this,t)),Y.set(this,t=>e(this,F,"m",it).call(this,t)),A.set(this,()=>e(this,F,"m",ot).call(this)),P.set(this,new r),D.set(this,new c(this)),R.set(this,new d(this)),T.set(this,new m(this,{target:null,skipInitial:!0,callback:t=>e(this,F,"m",ft).call(this,t)})),N.set(this,null),U.set(this,void 0),I.set(this,!1),j.set(this,0),K.set(this,void 0),V.set(this,0),X.set(this,0),G.set(this,void 0),this.modal=!1,this.open=!1,this.handle=!1,this.handleLabel="Drag handle",this.detents=[],this.detent=0,this.hideable=!1,this.hideFriction=.5,this.overshootLimit=4}show(t=this.detent){this.open?void 0!==t&&e(this,j,"f")!==t&&e(this,F,"m",ut).call(this,t):(i(this,K,t,"f"),this.open=!0)}hide(){this.open=!1}toggle(t){this.open?this.hide():this.show(t)}cycle(){var t;this.open?this.detents.length>0?e(this,j,"f")<this.detents.length-1?(i(this,j,(t=e(this,j,"f"),++t),"f"),e(this,F,"m",ut).call(this,e(this,j,"f"))):this.hideable&&this.hide():this.hide():this.show()}update(t){super.update(t),t.has("modal")&&(this.role=this.modal?"dialog":"region",this.ariaModal=this.modal?"true":null,this.popover=this.modal?"manual":null)}reconnectedCallback(){super.reconnectedCallback(),e(this,F,"m",J).call(this)}firstUpdated(t){super.firstUpdated(t),e(this,F,"m",J).call(this)}updated(t){if(super.updated(t),t.has("open")){if(this.open){if(!this.dispatchEvent(new Event("opening",{cancelable:!0})))return void(this.open=!1);vt.__openSheet!==this&&vt.__openSheet?.hide(),vt.__openSheet=this,this.inert=!1,window.addEventListener("resize",e(this,A,"f")),this.detents.length>0?(i(this,j,Math.min(Math.max(0,e(this,K,"f")??this.detent),this.detents.length-1),"f"),e(this,F,"m",gt).call(this,e(this,F,"m",rt).call(this,this.detents[e(this,j,"f")]))):e(this,F,"m",gt).call(this,Math.min(e(this,F,"m",rt).call(this,"fit"),e(this,F,"m",rt).call(this,"half"))),i(this,K,void 0,"f")}else{if(!this.dispatchEvent(new Event("closing",{cancelable:!0})))return void(this.open=!0);requestAnimationFrame(()=>this.inert=!0),window.removeEventListener("resize",e(this,A,"f")),vt.__openSheet===this&&(vt.__openSheet=void 0)}if(this.modal)if(this.open){i(this,N,document.activeElement,"f"),e(this,R,"f").lock(),e(this,D,"f").lock(),this.showPopover(),requestAnimationFrame(()=>{document.addEventListener("click",e(this,q,"f")),document.addEventListener("keydown",e(this,Y,"f"))});let t=this.querySelector("[autofocus]");t&&z.isFocusable(t)||(t=this.shadowRoot?.querySelector(".handle")),t&&p(t)}else e(this,F,"m",bt).call(this,0).then(()=>{e(this,R,"f").unlock(),e(this,D,"f").unlock(),document.removeEventListener("click",e(this,q,"f")),document.removeEventListener("keydown",e(this,Y,"f")),this.hidePopover(),e(this,N,"f")instanceof HTMLElement&&e(this,N,"f").focus(),i(this,N,null,"f")});this.dispatchEvent(new Event(this.open?"opened":"closed"))}}render(){return E`<m3e-focus-trap ?disabled="${!this.modal}"><div class="base"><m3e-elevation class="elevation"></m3e-elevation><div class="header" @pointerdown="${e(this,F,"m",Q)}" @pointermove="${e(this,F,"m",Z)}" @pointerup="${e(this,F,"m",tt)}">${this.handle?E`<div class="handle-row"><div id="handle" class="handle" role="button" aria-label="${this.handleLabel}" tabindex="0" @click="${e(this,F,"m",st)}" @keydown="${e(this,F,"m",nt)}"><m3e-focus-ring class="focus-ring" for="handle"></m3e-focus-ring><div class="handle-touch" aria-hidden="true"></div></div></div>`:H}<slot name="header" @slotchange="${e(this,F,"m",O)}"></slot></div><div class="body"><div class="content"><slot></slot></div></div></div></m3e-focus-trap>`}};q=new WeakMap,Y=new WeakMap,A=new WeakMap,P=new WeakMap,D=new WeakMap,R=new WeakMap,T=new WeakMap,N=new WeakMap,U=new WeakMap,I=new WeakMap,j=new WeakMap,K=new WeakMap,V=new WeakMap,X=new WeakMap,G=new WeakMap,F=new WeakSet,J=function(){const t=this.shadowRoot?.querySelector(".content");t&&(i(this,V,t.clientHeight,"f"),e(this,T,"f").observe(t));const o=this.shadowRoot?.querySelector(".header");o&&(i(this,X,o.clientHeight,"f"),e(this,T,"f").observe(o))},O=function(t){f(this,"has-header",u(t.target))},Q=function(t){if(t.target instanceof HTMLElement&&z.isFocusable(t.target))return;t.target.setPointerCapture(t.pointerId),t.target.style.cursor="grabbing",e(this,P,"f").reset(),e(this,P,"f").add(t.clientY);const o=e(this,F,"m",ct).call(this),s=this.detents.length>0?Math.max(...this.detents.map(t=>e(this,F,"m",rt).call(this,t))):o;i(this,U,{startY:t.clientY,startHeight:this.clientHeight,effectiveMaxHeight:s,maxHeight:o,minHeight:e(this,F,"m",dt).call(this)},"f"),i(this,I,!1,"f")},Z=function(t){if(!e(this,U,"f"))return;if(Math.abs(t.clientY-e(this,U,"f").startY)<=8)return;(t.getCoalescedEvents?.()??[t]).forEach(i=>e(this,P,"f").add(i.clientY,t.timeStamp));let o=e(this,U,"f").startHeight-(t.clientY-e(this,U,"f").startY);if(o<e(this,U,"f").minHeight)if(this.hideable){const t=(e(this,U,"f").minHeight-o)*this.hideFriction;o=e(this,U,"f").minHeight-t}else{const t=e(this,U,"f").minHeight-o,i=e(this,U,"f").maxHeight*(this.overshootLimit/100),s=i*t/(t+i);o=e(this,U,"f").minHeight-s}else if(o>e(this,U,"f").effectiveMaxHeight){const t=o-e(this,U,"f").effectiveMaxHeight,i=e(this,U,"f").maxHeight*(this.overshootLimit/100),s=i*t/(t+i);o=e(this,U,"f").effectiveMaxHeight+s}e(this,F,"m",gt).call(this,o),i(this,I,!0,"f")},tt=function(t){if(e(this,U,"f"))try{if(t.target.releasePointerCapture(t.pointerId),t.target.style.cursor="",!e(this,I,"f"))return;const i="touch"===t.pointerType?1200:500,o=e(this,P,"f").getVelocity();if(e(this,P,"f").reset(),this.hideable&&o>=i)this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide();else if(Math.abs(o)>=i)if(this.detents.length>0){const t=e(this,F,"m",at).call(this);t!==e(this,j,"f")&&e(this,F,"m",ut).call(this,t)}else e(this,F,"m",bt).call(this,e(this,F,"m",rt).call(this,"full"));else{const t=20;if(this.hideable){const i=e(this,U,"f").minHeight;if(this.clientHeight<i-t)return void this.hide()}this.detents.length>0?e(this,F,"m",ut).call(this,e(this,F,"m",lt).call(this)):this.clientHeight<e(this,U,"f").minHeight?e(this,F,"m",bt).call(this,e(this,U,"f").minHeight):this.clientHeight>e(this,U,"f").effectiveMaxHeight&&e(this,F,"m",bt).call(this,e(this,U,"f").effectiveMaxHeight)}}finally{i(this,U,void 0,"f")}},et=function(t){this.open&&this.modal&&!t.composedPath().includes(this)&&this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide()},it=function(t){this.open&&this.modal&&"Escape"===t.key&&!t.shiftKey&&!t.ctrlKey&&(t.preventDefault(),this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide())},ot=function(){if(this.detents.length>0&&"half"===this.detents[e(this,j,"f")])return void e(this,F,"m",gt).call(this,e(this,F,"m",rt).call(this,"half"));const t=e(this,F,"m",ct).call(this);(b(this,"-full")||this.clientHeight>t)&&e(this,F,"m",gt).call(this,t)},st=function(){e(this,I,"f")||this.cycle(),i(this,I,!1,"f")},nt=function(t){if(!t.defaultPrevented&&L(t))switch(t.key){case"Up":case"ArrowUp":if(t.preventDefault(),this.detents.length>0){const t=e(this,F,"m",at).call(this);t!==e(this,j,"f")&&e(this,F,"m",ut).call(this,t)}else e(this,F,"m",bt).call(this,e(this,F,"m",rt).call(this,"full"));break;case"Down":case"ArrowDown":if(t.preventDefault(),this.detents.length>0){const t=e(this,F,"m",ht).call(this);t!==e(this,j,"f")?e(this,F,"m",ut).call(this,t):this.hideable&&this.hide()}else this.hideable&&this.hide()}},at=function(){const t=this.clientHeight;let i=1/0,o=e(this,j,"f");for(let s=0;s<this.detents.length;s++){if(s===e(this,j,"f"))continue;const n=e(this,F,"m",rt).call(this,this.detents[s]);n>t&&n<i&&(i=n,o=s)}return o},ht=function(){const t=this.clientHeight;let i=-1/0,o=e(this,j,"f");for(let s=0;s<this.detents.length;s++){if(s===e(this,j,"f"))continue;const n=e(this,F,"m",rt).call(this,this.detents[s]);n<t&&n>i&&(i=n,o=s)}return o},lt=function(){const t=this.clientHeight;let i=e(this,j,"f"),o=1/0;for(let s=0;s<this.detents.length;s++){const n=e(this,F,"m",rt).call(this,this.detents[s]),a=Math.abs(t-n);a<o&&(o=a,i=s)}return i},rt=function(t){switch(t){case"collapsed":return e(this,F,"m",dt).call(this);case"half":return.5*e(this,F,"m",ct).call(this);case"full":return e(this,F,"m",ct).call(this);case"fit":return e(this,F,"m",pt).call(this)}return t.endsWith("%")?e(this,F,"m",ct).call(this)*(parseFloat(t)/100):t.endsWith("px")?parseFloat(t):e(this,F,"m",dt).call(this)},ct=function(){const t=this.shadowRoot?.querySelector(".base");return window.innerHeight-(t?g(t,"var(--_bottom-sheet-top-space)"):0)},dt=function(){return this.detents.includes("fit")&&!this.detents.includes("collapsed")?e(this,F,"m",pt).call(this):e(this,F,"m",mt).call(this)},mt=function(){const t=this.shadowRoot?.querySelector(".base");return e(this,X,"f")+(t?g(t,"var(--_bottom-sheet-peek-height)"):0)},pt=function(){const t=this.shadowRoot?.querySelector(".body");if(!t)return 0;const i=getComputedStyle(t);return e(this,X,"f")+e(this,V,"f")+parseFloat(i.paddingBlockStart)+parseFloat(i.paddingBlockEnd)},ft=function(t){const o=e(this,V,"f"),s=e(this,X,"f");for(const e of t)e.target.classList.contains("content")?i(this,V,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f"):e.target.classList.contains("header")&&i(this,X,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f");if(this.open&&this.detents.length>0&&(o!==e(this,V,"f")||s!==e(this,X,"f")))switch(this.detents[e(this,j,"f")]){case"fit":e(this,F,"m",gt).call(this,e(this,F,"m",pt).call(this));break;case"collapsed":e(this,F,"m",gt).call(this,e(this,F,"m",dt).call(this))}},ut=function(t){t>=0&&t<this.detents.length&&(i(this,j,t,"f"),e(this,F,"m",bt).call(this,e(this,F,"m",rt).call(this,this.detents[t])))},bt=async function(t){e(this,G,"f")&&(e(this,F,"m",gt).call(this,this.clientHeight),e(this,G,"f")?.cancel(),i(this,G,void 0,"f")),v()?e(this,F,"m",gt).call(this,t):(i(this,G,this.animate([{"--_bottom-sheet-height":`${this.clientHeight}px`},{"--_bottom-sheet-height":`${t}px`}],{duration:250,easing:"cubic-bezier(0.2, 0.0, 0, 1.0)"}),"f"),e(this,G,"f").onfinish=()=>{e(this,F,"m",gt).call(this,t),i(this,G,void 0,"f")},await e(this,G,"f").finished)},gt=function(t){this.style.setProperty("--_bottom-sheet-height",`${t}px`),f(this,"-full",t===e(this,F,"m",ct).call(this));const i=this.shadowRoot?.querySelector(".content");i&&(i.inert=t<=e(this,F,"m",mt).call(this))},y(M`@property --_bottom-sheet-height { syntax: "<length>"; inherits: false; initial-value: 50vh; } m3e-bottom-sheet > [slot="header"] { margin-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); margin-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); }</length>`),yt.styles=M`:host { display: block; position: fixed; left: 50%; top: calc(100vh - var(--_bottom-sheet-height)); margin: 0; padding: 0; outline: none; overflow: hidden; border: none; box-sizing: border-box; width: var(--m3e-bottom-sheet-width, 100%); max-width: var(--m3e-bottom-sheet-max-width, 40rem); height: var(--_bottom-sheet-height); color: var(--m3e-bottom-sheet-color, ${w.color.onSurface}); background-color: var(--m3e-bottom-sheet-container-color, ${w.color.surfaceContainerLow}); } :host(:not(:state(-no-animate))) { transition: ${S(`transform ${w.motion.duration.medium2} ${w.motion.easing.standardDecelerate},\n border-radius ${w.motion.duration.medium2} ${w.motion.easing.standard}`)}; } :host(:not([modal]):not(:state(-full))) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-elevation, ${w.elevation.level1}); } :host([modal]:not(:state(-full))) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-modal-elevation, ${w.elevation.level1}); } :host(:state(-full)) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-full-elevation, ${w.elevation.level1}); } :host(:not([modal])) { z-index: var(--m3e-bottom-sheet-z-index, 10); } :host(:not([modal]):not([open])), :host([modal]:not(:popover-open)) { border-radius: var(--m3e-bottom-sheet-minimized-container-shape, ${w.shape.corner.none}); transform: translateX(-50%) translateY(100%); } :host(:not([modal])[open]:not(:state(-full))), :host([modal]:not(:state(-full)):popover-open) { border-radius: var(--m3e-bottom-sheet-container-shape, ${w.shape.corner.extraLargeTop}); } :host(:not([modal])[open]:state(-full)), :host([modal]:state(-full):popover-open) { border-radius: var(--m3e-bottom-sheet-full-container-shape, ${w.shape.corner.extraLargeTop}); } :host(:not([modal])[open]), :host([modal]:popover-open) { transform: translateX(-50%) translateY(0); } :host([modal]:not(:state(-no-animate)))::backdrop { transition: ${S(`background-color ${w.motion.duration.short3} ${w.motion.easing.standard}, \n overlay ${w.motion.duration.short3} ${w.motion.easing.standard} allow-discrete,\n visibility ${w.motion.duration.short3} ${w.motion.easing.standard} allow-discrete`)}; } :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${w.color.scrim}) var(--m3e-bottom-sheet-scrim-opacity, 32%), transparent ); } :host([modal]:popover-open:not(:state(-no-animate)))::backdrop { transition: ${S(`background-color ${w.motion.duration.long2} ${w.motion.easing.standard}, \n overlay ${w.motion.duration.long2} ${w.motion.easing.standard} allow-discrete,\n visibility ${w.motion.duration.long2} ${w.motion.easing.standard} allow-discrete`)}; } @starting-style { :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${w.color.scrim}) 0%, transparent ); } } .base { display: flex; border-radius: inherit; flex-direction: column; height: 100%; --_bottom-sheet-peek-height: var(--m3e-bottom-sheet-peek-height, 0); --_bottom-sheet-top-space: var(--m3e-bottom-sheet-compact-top-space, 4.5rem); } @media (max-height: 640px) { .base { --_bottom-sheet-top-space: var(--m3e-bottom-sheet-top-space, 3.5rem); } } .body { flex: 1 1 auto; overflow-y: auto; scrollbar-width: ${w.scrollbar.thinWidth}; scrollbar-color: ${w.scrollbar.color}; padding-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); padding-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); font-size: var(--m3e-bottom-sheet-content-font-size, ${w.typescale.standard.body.medium.fontSize}); font-weight: var( --m3e-bottom-sheet-content-font-weight, ${w.typescale.standard.body.medium.fontWeight} ); line-height: var( --m3e-bottom-sheet-content-line-height, ${w.typescale.standard.body.medium.lineHeight} ); letter-spacing: var(--m3e-bottom-sheet-content-tracking, ${w.typescale.standard.body.medium.tracking}); } .content { height: fit-content; } :host(:not([handle])) .header { display: none; } :host(:not([handle])) .body, .header { border-top-left-radius: inherit; border-top-right-radius: inherit; padding-block-start: var(--m3e-bottom-sheet-padding-block, 0.5rem); font-size: var(--m3e-bottom-sheet-header-font-size, ${w.typescale.standard.title.large.fontSize}); font-weight: var(--m3e-bottom-sheet-header-font-weight, ${w.typescale.standard.title.large.fontWeight}); line-height: var(--m3e-bottom-sheet-header-line-height, ${w.typescale.standard.title.large.lineHeight}); letter-spacing: var(--m3e-bottom-sheet-header-tracking, ${w.typescale.standard.title.large.tracking}); } .header { cursor: grab; touch-action: none; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); box-sizing: border-box; flex: none; display: flex; flex-direction: column; min-height: 3rem; --m3e-app-bar-container-color: var(--m3e-bottom-sheet-container-color, ${w.color.surfaceContainerLow}); } .handle-row { position: relative; flex: none; display: flex; align-items: center; justify-content: center; opacity: 1; visibility: visible; height: var(--m3e-bottom-sheet-handle-container-height, 1.5rem); } :host(:not(:state(-no-animate))) .handle-row { transition: ${S(`opacity ${w.motion.duration.short3} ${w.motion.easing.standard},\n padding ${w.motion.duration.short3} ${w.motion.easing.standard},\n height ${w.motion.duration.short3} ${w.motion.easing.standard},\n visibility ${w.motion.duration.short3} ${w.motion.easing.standard} allow-discrete`)}; } .handle { position: relative; width: var(--m3e-bottom-sheet-handle-width, 2rem); height: var(--m3e-bottom-sheet-handle-height, 4px); border-radius: var(--m3e-bottom-sheet-handle-shape, ${w.shape.corner.full}); background-color: var(--m3e-bottom-sheet-handle-color, ${w.color.onSurfaceVariant}); } .handle-touch { position: absolute; aspect-ratio: 1 / 1; height: 3rem; left: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); right: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); top: calc( 0px - calc( calc(3rem - var(--m3e-bottom-sheet-handle-container-height, 1.5rem)) - calc( var(--m3e-bottom-sheet-handle-height, 4px) / 2 ) ) ); } @media (prefers-reduced-motion) { :host(:not(:state(-no-animate))), :host([modal]:not(:state(-no-animate)))::backdrop, :host([modal]:popover-open:not(:state(-no-animate)))::backdrop, :host(:not(:state(-no-animate))) .handle-row { transition: none; } } @media (forced-colors: active) { :host([modal]:not(:state(-no-animate)))::backdrop, :host([modal]:popover-open:not(:state(-no-animate)))::backdrop { transition: none; } .base { border-style: solid; border-width: 1px; border-color: CanvasText; } .handle { background-color: ButtonText; } }`,t([_({type:Boolean,reflect:!0})],yt.prototype,"modal",void 0),t([_({type:Boolean,reflect:!0})],yt.prototype,"open",void 0),t([_({type:Boolean})],yt.prototype,"handle",void 0),t([_({attribute:"handle-label"})],yt.prototype,"handleLabel",void 0),t([_({attribute:"detents",converter:k})],yt.prototype,"detents",void 0),t([_({type:Number})],yt.prototype,"detent",void 0),t([_({type:Boolean,reflect:!0})],yt.prototype,"hideable",void 0),t([_({attribute:"hide-friction",type:Number})],yt.prototype,"hideFriction",void 0),t([_({attribute:"overshoot-limit",type:Number})],yt.prototype,"overshootLimit",void 0),yt=vt=t([o("m3e-bottom-sheet")],yt);let wt=class extends($(s)){constructor(){super(...arguments),this.secondary=!1}attach(t){t instanceof yt&&(super.attach(t),this.parentElement&&(t.modal?this.parentElement.ariaHasPopup="dialog":this.secondary||(this.parentElement.ariaExpanded="false",W(this.parentElement,"aria-controls",t.id),this.parentElement.id&&W(t,"aria-labelledby",this.parentElement.id))))}detach(){this.control&&this.parentElement&&!this.secondary&&B(this.parentElement,"aria-controls",this.control.id),super.detach()}_onClick(){this.control instanceof yt&&(this.control.modal?this.control.show(this.detent):(this.control.toggle(this.detent),!this.secondary&&this.parentElement&&(this.parentElement.ariaExpanded=`${this.control.open}`)))}};t([_({type:Number})],wt.prototype,"detent",void 0),t([_({type:Boolean})],wt.prototype,"secondary",void 0),wt=t([o("m3e-bottom-sheet-trigger")],wt);export{C as M3eBottomSheetActionElement,yt as M3eBottomSheetElement,wt as M3eBottomSheetTriggerElement};
6
+ import{__decorate as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{customElement as o,ActionElementBase as s,ReconnectedCallback as n,SuppressInitialAnimation as a,AttachInternals as h,VelocityTracker as l,ScrollLockController as r,InertController as c,ResizeController as d,focusWhenReady as m,setCustomState as p,hasAssignedNodes as f,hasCustomState as u,computeCssSize as b,prefersReducedMotion as g,registerStyleSheet as v,DesignToken as y,spaceSeparatedStringConverter as w,HtmlFor as k}from"@m3e/web/core";import{LitElement as $,nothing as x,html as H,css as E,unsafeCSS as M}from"lit";import{property as S}from"lit/decorators.js";import{M3eInteractivityChecker as _,isModifierAllowed as z,addAriaReferencedId as L,removeAriaReferencedId as W}from"@m3e/web/core/a11y";let B=class extends s{_onClick(){this.closest("m3e-bottom-sheet")?.hide()}};var C,F,q,Y,A,P,D,R,T,N,U,I,j,K,V,X,G,J,O,Q,Z,tt,et,it,ot,st,nt,at,ht,lt,rt,ct,dt,mt,pt,ft,ut,bt,gt;B=t([o("m3e-bottom-sheet-action")],B);let vt=gt=class extends(n(a(h($)))){constructor(){super(...arguments),C.add(this),F.set(this,t=>e(this,C,"m",tt).call(this,t)),q.set(this,t=>e(this,C,"m",et).call(this,t)),Y.set(this,()=>e(this,C,"m",it).call(this)),A.set(this,new l),P.set(this,new r(this)),D.set(this,new c(this)),R.set(this,new d(this,{target:null,skipInitial:!0,callback:t=>e(this,C,"m",pt).call(this,t)})),T.set(this,null),N.set(this,void 0),U.set(this,!1),I.set(this,0),j.set(this,void 0),K.set(this,0),V.set(this,0),X.set(this,void 0),this.modal=!1,this.open=!1,this.handle=!1,this.handleLabel="Drag handle",this.detents=[],this.detent=0,this.hideable=!1,this.hideFriction=.5,this.overshootLimit=4}show(t=this.detent){this.open?void 0!==t&&e(this,I,"f")!==t&&e(this,C,"m",ft).call(this,t):(i(this,j,t,"f"),this.open=!0)}hide(){this.open=!1}toggle(t){this.open?this.hide():this.show(t)}cycle(){var t;this.open?this.detents.length>0?e(this,I,"f")<this.detents.length-1?(i(this,I,(t=e(this,I,"f"),++t),"f"),e(this,C,"m",ft).call(this,e(this,I,"f"))):this.hideable&&this.hide():this.hide():this.show()}update(t){super.update(t),t.has("modal")&&(this.role=this.modal?"dialog":"region",this.ariaModal=this.modal?"true":null,this.popover=this.modal?"manual":null)}reconnectedCallback(){super.reconnectedCallback(),e(this,C,"m",G).call(this)}firstUpdated(t){super.firstUpdated(t),e(this,C,"m",G).call(this)}updated(t){if(super.updated(t),t.has("open")){if(this.open){if(!this.dispatchEvent(new Event("opening",{cancelable:!0})))return void(this.open=!1);gt.__openSheet!==this&&gt.__openSheet?.hide(),gt.__openSheet=this,this.inert=!1,window.addEventListener("resize",e(this,Y,"f")),this.detents.length>0?(i(this,I,Math.min(Math.max(0,e(this,j,"f")??this.detent),this.detents.length-1),"f"),e(this,C,"m",bt).call(this,e(this,C,"m",lt).call(this,this.detents[e(this,I,"f")]))):e(this,C,"m",bt).call(this,Math.min(e(this,C,"m",lt).call(this,"fit"),e(this,C,"m",lt).call(this,"half"))),i(this,j,void 0,"f")}else{if(!this.dispatchEvent(new Event("closing",{cancelable:!0})))return void(this.open=!0);requestAnimationFrame(()=>this.inert=!0),window.removeEventListener("resize",e(this,Y,"f")),gt.__openSheet===this&&(gt.__openSheet=void 0)}if(this.modal)if(this.open){i(this,T,document.activeElement,"f"),e(this,D,"f").lock(),e(this,P,"f").lock(),this.showPopover(),requestAnimationFrame(()=>{document.addEventListener("click",e(this,F,"f")),document.addEventListener("keydown",e(this,q,"f"))});let t=this.querySelector("[autofocus]");t&&_.isFocusable(t)||(t=this.shadowRoot?.querySelector(".handle")),t&&m(t)}else e(this,C,"m",ut).call(this,0).then(()=>{e(this,D,"f").unlock(),e(this,P,"f").unlock(),document.removeEventListener("click",e(this,F,"f")),document.removeEventListener("keydown",e(this,q,"f")),this.hidePopover(),e(this,T,"f")instanceof HTMLElement&&e(this,T,"f").focus(),i(this,T,null,"f")});this.dispatchEvent(new Event(this.open?"opened":"closed"))}}render(){return H`<m3e-focus-trap ?disabled="${!this.modal}"><div class="base"><m3e-elevation class="elevation"></m3e-elevation><div class="header" @pointerdown="${e(this,C,"m",O)}" @pointermove="${e(this,C,"m",Q)}" @pointerup="${e(this,C,"m",Z)}">${this.handle?H`<div class="handle-row"><div id="handle" class="handle" role="button" aria-label="${this.handleLabel}" tabindex="0" @click="${e(this,C,"m",ot)}" @keydown="${e(this,C,"m",st)}"><m3e-focus-ring class="focus-ring" for="handle"></m3e-focus-ring><div class="handle-touch" aria-hidden="true"></div></div></div>`:x}<slot name="header" @slotchange="${e(this,C,"m",J)}"></slot></div><div class="body"><div class="content"><slot></slot></div></div></div></m3e-focus-trap>`}};F=new WeakMap,q=new WeakMap,Y=new WeakMap,A=new WeakMap,P=new WeakMap,D=new WeakMap,R=new WeakMap,T=new WeakMap,N=new WeakMap,U=new WeakMap,I=new WeakMap,j=new WeakMap,K=new WeakMap,V=new WeakMap,X=new WeakMap,C=new WeakSet,G=function(){const t=this.shadowRoot?.querySelector(".content");t&&(i(this,K,t.clientHeight,"f"),e(this,R,"f").observe(t));const o=this.shadowRoot?.querySelector(".header");o&&(i(this,V,o.clientHeight,"f"),e(this,R,"f").observe(o))},J=function(t){p(this,"has-header",f(t.target))},O=function(t){if(t.target instanceof HTMLElement&&_.isFocusable(t.target))return;t.target.setPointerCapture(t.pointerId),t.target.style.cursor="grabbing",e(this,A,"f").reset(),e(this,A,"f").add(t.clientY);const o=e(this,C,"m",rt).call(this),s=this.detents.length>0?Math.max(...this.detents.map(t=>e(this,C,"m",lt).call(this,t))):o;i(this,N,{startY:t.clientY,startHeight:this.clientHeight,effectiveMaxHeight:s,maxHeight:o,minHeight:e(this,C,"m",ct).call(this)},"f"),i(this,U,!1,"f")},Q=function(t){if(!e(this,N,"f"))return;if(Math.abs(t.clientY-e(this,N,"f").startY)<=8)return;(t.getCoalescedEvents?.()??[t]).forEach(i=>e(this,A,"f").add(i.clientY,t.timeStamp));let o=e(this,N,"f").startHeight-(t.clientY-e(this,N,"f").startY);if(o<e(this,N,"f").minHeight)if(this.hideable){const t=(e(this,N,"f").minHeight-o)*this.hideFriction;o=e(this,N,"f").minHeight-t}else{const t=e(this,N,"f").minHeight-o,i=e(this,N,"f").maxHeight*(this.overshootLimit/100),s=i*t/(t+i);o=e(this,N,"f").minHeight-s}else if(o>e(this,N,"f").effectiveMaxHeight){const t=o-e(this,N,"f").effectiveMaxHeight,i=e(this,N,"f").maxHeight*(this.overshootLimit/100),s=i*t/(t+i);o=e(this,N,"f").effectiveMaxHeight+s}e(this,C,"m",bt).call(this,o),i(this,U,!0,"f")},Z=function(t){if(e(this,N,"f"))try{if(t.target.releasePointerCapture(t.pointerId),t.target.style.cursor="",!e(this,U,"f"))return;const i="touch"===t.pointerType?1200:500,o=e(this,A,"f").getVelocity();if(e(this,A,"f").reset(),this.hideable&&o>=i)this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide();else if(Math.abs(o)>=i)if(this.detents.length>0){const t=e(this,C,"m",nt).call(this);t!==e(this,I,"f")&&e(this,C,"m",ft).call(this,t)}else e(this,C,"m",ut).call(this,e(this,C,"m",lt).call(this,"full"));else{const t=20;if(this.hideable){const i=e(this,N,"f").minHeight;if(this.clientHeight<i-t)return void this.hide()}this.detents.length>0?e(this,C,"m",ft).call(this,e(this,C,"m",ht).call(this)):this.clientHeight<e(this,N,"f").minHeight?e(this,C,"m",ut).call(this,e(this,N,"f").minHeight):this.clientHeight>e(this,N,"f").effectiveMaxHeight&&e(this,C,"m",ut).call(this,e(this,N,"f").effectiveMaxHeight)}}finally{i(this,N,void 0,"f")}},tt=function(t){this.open&&this.modal&&!t.composedPath().includes(this)&&this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide()},et=function(t){this.open&&this.modal&&"Escape"===t.key&&!t.shiftKey&&!t.ctrlKey&&(t.preventDefault(),this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.hide())},it=function(){if(this.detents.length>0&&"half"===this.detents[e(this,I,"f")])return void e(this,C,"m",bt).call(this,e(this,C,"m",lt).call(this,"half"));const t=e(this,C,"m",rt).call(this);(u(this,"-full")||this.clientHeight>t)&&e(this,C,"m",bt).call(this,t)},ot=function(){e(this,U,"f")||this.cycle(),i(this,U,!1,"f")},st=function(t){if(!t.defaultPrevented&&z(t))switch(t.key){case"Up":case"ArrowUp":if(t.preventDefault(),this.detents.length>0){const t=e(this,C,"m",nt).call(this);t!==e(this,I,"f")&&e(this,C,"m",ft).call(this,t)}else e(this,C,"m",ut).call(this,e(this,C,"m",lt).call(this,"full"));break;case"Down":case"ArrowDown":if(t.preventDefault(),this.detents.length>0){const t=e(this,C,"m",at).call(this);t!==e(this,I,"f")?e(this,C,"m",ft).call(this,t):this.hideable&&this.hide()}else this.hideable&&this.hide()}},nt=function(){const t=this.clientHeight;let i=1/0,o=e(this,I,"f");for(let s=0;s<this.detents.length;s++){if(s===e(this,I,"f"))continue;const n=e(this,C,"m",lt).call(this,this.detents[s]);n>t&&n<i&&(i=n,o=s)}return o},at=function(){const t=this.clientHeight;let i=-1/0,o=e(this,I,"f");for(let s=0;s<this.detents.length;s++){if(s===e(this,I,"f"))continue;const n=e(this,C,"m",lt).call(this,this.detents[s]);n<t&&n>i&&(i=n,o=s)}return o},ht=function(){const t=this.clientHeight;let i=e(this,I,"f"),o=1/0;for(let s=0;s<this.detents.length;s++){const n=e(this,C,"m",lt).call(this,this.detents[s]),a=Math.abs(t-n);a<o&&(o=a,i=s)}return i},lt=function(t){switch(t){case"collapsed":return e(this,C,"m",ct).call(this);case"half":return.5*e(this,C,"m",rt).call(this);case"full":return e(this,C,"m",rt).call(this);case"fit":return e(this,C,"m",mt).call(this)}return t.endsWith("%")?e(this,C,"m",rt).call(this)*(parseFloat(t)/100):t.endsWith("px")?parseFloat(t):e(this,C,"m",ct).call(this)},rt=function(){const t=this.shadowRoot?.querySelector(".base");return window.innerHeight-(t?b(t,"var(--_bottom-sheet-top-space)"):0)},ct=function(){return this.detents.includes("fit")&&!this.detents.includes("collapsed")?e(this,C,"m",mt).call(this):e(this,C,"m",dt).call(this)},dt=function(){const t=this.shadowRoot?.querySelector(".base");return e(this,V,"f")+(t?b(t,"var(--_bottom-sheet-peek-height)"):0)},mt=function(){const t=this.shadowRoot?.querySelector(".body");if(!t)return 0;const i=getComputedStyle(t);return e(this,V,"f")+e(this,K,"f")+parseFloat(i.paddingBlockStart)+parseFloat(i.paddingBlockEnd)},pt=function(t){const o=e(this,K,"f"),s=e(this,V,"f");for(const e of t)e.target.classList.contains("content")?i(this,K,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f"):e.target.classList.contains("header")&&i(this,V,(Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize).blockSize,"f");if(this.open&&this.detents.length>0&&(o!==e(this,K,"f")||s!==e(this,V,"f")))switch(this.detents[e(this,I,"f")]){case"fit":e(this,C,"m",bt).call(this,e(this,C,"m",mt).call(this));break;case"collapsed":e(this,C,"m",bt).call(this,e(this,C,"m",ct).call(this))}},ft=function(t){t>=0&&t<this.detents.length&&(i(this,I,t,"f"),e(this,C,"m",ut).call(this,e(this,C,"m",lt).call(this,this.detents[t])))},ut=async function(t){e(this,X,"f")&&(e(this,C,"m",bt).call(this,this.clientHeight),e(this,X,"f")?.cancel(),i(this,X,void 0,"f")),g()?e(this,C,"m",bt).call(this,t):(i(this,X,this.animate([{"--_bottom-sheet-height":`${this.clientHeight}px`},{"--_bottom-sheet-height":`${t}px`}],{duration:250,easing:"cubic-bezier(0.2, 0.0, 0, 1.0)"}),"f"),e(this,X,"f").onfinish=()=>{e(this,C,"m",bt).call(this,t),i(this,X,void 0,"f")},await e(this,X,"f").finished)},bt=function(t){this.style.setProperty("--_bottom-sheet-height",`${t}px`),p(this,"-full",t===e(this,C,"m",rt).call(this));const i=this.shadowRoot?.querySelector(".content");i&&(i.inert=t<=e(this,C,"m",dt).call(this))},v(E`@property --_bottom-sheet-height { syntax: "<length>"; inherits: false; initial-value: 50vh; } m3e-bottom-sheet > [slot="header"] { margin-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); margin-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); }</length>`),vt.styles=E`:host { display: block; position: fixed; left: 50%; top: calc(100vh - var(--_bottom-sheet-height)); margin: 0; padding: 0; outline: none; overflow: hidden; border: none; box-sizing: border-box; width: var(--m3e-bottom-sheet-width, 100%); max-width: var(--m3e-bottom-sheet-max-width, 40rem); height: var(--_bottom-sheet-height); color: var(--m3e-bottom-sheet-color, ${y.color.onSurface}); background-color: var(--m3e-bottom-sheet-container-color, ${y.color.surfaceContainerLow}); } :host(:not(:state(-no-animate))) { transition: ${M(`transform ${y.motion.duration.medium2} ${y.motion.easing.standardDecelerate},\n border-radius ${y.motion.duration.medium2} ${y.motion.easing.standard}`)}; } :host(:not([modal]):not(:state(-full))) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-elevation, ${y.elevation.level1}); } :host([modal]:not(:state(-full))) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-modal-elevation, ${y.elevation.level1}); } :host(:state(-full)) .elevation { --m3e-elevation-level: var(--m3e-bottom-sheet-full-elevation, ${y.elevation.level1}); } :host(:not([modal])) { z-index: var(--m3e-bottom-sheet-z-index, 10); } :host(:not([modal]):not([open])), :host([modal]:not(:popover-open)) { border-radius: var(--m3e-bottom-sheet-minimized-container-shape, ${y.shape.corner.none}); transform: translateX(-50%) translateY(100%); } :host(:not([modal])[open]:not(:state(-full))), :host([modal]:not(:state(-full)):popover-open) { border-radius: var(--m3e-bottom-sheet-container-shape, ${y.shape.corner.extraLargeTop}); } :host(:not([modal])[open]:state(-full)), :host([modal]:state(-full):popover-open) { border-radius: var(--m3e-bottom-sheet-full-container-shape, ${y.shape.corner.extraLargeTop}); } :host(:not([modal])[open]), :host([modal]:popover-open) { transform: translateX(-50%) translateY(0); } :host([modal]:not(:state(-no-animate)))::backdrop { transition: ${M(`background-color ${y.motion.duration.short3} ${y.motion.easing.standard}, \n overlay ${y.motion.duration.short3} ${y.motion.easing.standard} allow-discrete,\n visibility ${y.motion.duration.short3} ${y.motion.easing.standard} allow-discrete`)}; } :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${y.color.scrim}) var(--m3e-bottom-sheet-scrim-opacity, 32%), transparent ); } :host([modal]:popover-open:not(:state(-no-animate)))::backdrop { transition: ${M(`background-color ${y.motion.duration.long2} ${y.motion.easing.standard}, \n overlay ${y.motion.duration.long2} ${y.motion.easing.standard} allow-discrete,\n visibility ${y.motion.duration.long2} ${y.motion.easing.standard} allow-discrete`)}; } @starting-style { :host([modal]:popover-open)::backdrop { background-color: color-mix( in srgb, var(--m3e-bottom-sheet-scrim-color, ${y.color.scrim}) 0%, transparent ); } } .base { display: flex; border-radius: inherit; flex-direction: column; height: 100%; --_bottom-sheet-peek-height: var(--m3e-bottom-sheet-peek-height, 0); --_bottom-sheet-top-space: var(--m3e-bottom-sheet-compact-top-space, 4.5rem); } @media (max-height: 640px) { .base { --_bottom-sheet-top-space: var(--m3e-bottom-sheet-top-space, 3.5rem); } } .body { flex: 1 1 auto; overflow-y: auto; scrollbar-width: ${y.scrollbar.thinWidth}; scrollbar-color: ${y.scrollbar.color}; padding-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem); padding-inline: var(--m3e-bottom-sheet-padding-inline, 1rem); font-size: var(--m3e-bottom-sheet-content-font-size, ${y.typescale.standard.body.medium.fontSize}); font-weight: var( --m3e-bottom-sheet-content-font-weight, ${y.typescale.standard.body.medium.fontWeight} ); line-height: var( --m3e-bottom-sheet-content-line-height, ${y.typescale.standard.body.medium.lineHeight} ); letter-spacing: var(--m3e-bottom-sheet-content-tracking, ${y.typescale.standard.body.medium.tracking}); } .content { height: fit-content; } :host(:not([handle])) .header { display: none; } :host(:not([handle])) .body, .header { border-top-left-radius: inherit; border-top-right-radius: inherit; padding-block-start: var(--m3e-bottom-sheet-padding-block, 0.5rem); font-size: var(--m3e-bottom-sheet-header-font-size, ${y.typescale.standard.title.large.fontSize}); font-weight: var(--m3e-bottom-sheet-header-font-weight, ${y.typescale.standard.title.large.fontWeight}); line-height: var(--m3e-bottom-sheet-header-line-height, ${y.typescale.standard.title.large.lineHeight}); letter-spacing: var(--m3e-bottom-sheet-header-tracking, ${y.typescale.standard.title.large.tracking}); } .header { cursor: grab; touch-action: none; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); box-sizing: border-box; flex: none; display: flex; flex-direction: column; min-height: 3rem; --m3e-app-bar-container-color: var(--m3e-bottom-sheet-container-color, ${y.color.surfaceContainerLow}); } .handle-row { position: relative; flex: none; display: flex; align-items: center; justify-content: center; opacity: 1; visibility: visible; height: var(--m3e-bottom-sheet-handle-container-height, 1.5rem); } :host(:not(:state(-no-animate))) .handle-row { transition: ${M(`opacity ${y.motion.duration.short3} ${y.motion.easing.standard},\n padding ${y.motion.duration.short3} ${y.motion.easing.standard},\n height ${y.motion.duration.short3} ${y.motion.easing.standard},\n visibility ${y.motion.duration.short3} ${y.motion.easing.standard} allow-discrete`)}; } .handle { position: relative; width: var(--m3e-bottom-sheet-handle-width, 2rem); height: var(--m3e-bottom-sheet-handle-height, 4px); border-radius: var(--m3e-bottom-sheet-handle-shape, ${y.shape.corner.full}); background-color: var(--m3e-bottom-sheet-handle-color, ${y.color.onSurfaceVariant}); } .handle-touch { position: absolute; aspect-ratio: 1 / 1; height: 3rem; left: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); right: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2)); top: calc( 0px - calc( calc(3rem - var(--m3e-bottom-sheet-handle-container-height, 1.5rem)) - calc( var(--m3e-bottom-sheet-handle-height, 4px) / 2 ) ) ); } @media (prefers-reduced-motion) { :host(:not(:state(-no-animate))), :host([modal]:not(:state(-no-animate)))::backdrop, :host([modal]:popover-open:not(:state(-no-animate)))::backdrop, :host(:not(:state(-no-animate))) .handle-row { transition: none; } } @media (forced-colors: active) { :host([modal]:not(:state(-no-animate)))::backdrop, :host([modal]:popover-open:not(:state(-no-animate)))::backdrop { transition: none; } .base { border-style: solid; border-width: 1px; border-color: CanvasText; } .handle { background-color: ButtonText; } }`,t([S({type:Boolean,reflect:!0})],vt.prototype,"modal",void 0),t([S({type:Boolean,reflect:!0})],vt.prototype,"open",void 0),t([S({type:Boolean})],vt.prototype,"handle",void 0),t([S({attribute:"handle-label"})],vt.prototype,"handleLabel",void 0),t([S({attribute:"detents",converter:w})],vt.prototype,"detents",void 0),t([S({type:Number})],vt.prototype,"detent",void 0),t([S({type:Boolean,reflect:!0})],vt.prototype,"hideable",void 0),t([S({attribute:"hide-friction",type:Number})],vt.prototype,"hideFriction",void 0),t([S({attribute:"overshoot-limit",type:Number})],vt.prototype,"overshootLimit",void 0),vt=gt=t([o("m3e-bottom-sheet")],vt);let yt=class extends(k(s)){constructor(){super(...arguments),this.secondary=!1}attach(t){t instanceof vt&&(super.attach(t),this.parentElement&&(t.modal?this.parentElement.ariaHasPopup="dialog":this.secondary||(this.parentElement.ariaExpanded="false",L(this.parentElement,"aria-controls",t.id),this.parentElement.id&&L(t,"aria-labelledby",this.parentElement.id))))}detach(){this.control&&this.parentElement&&!this.secondary&&W(this.parentElement,"aria-controls",this.control.id),super.detach()}_onClick(){this.control instanceof vt&&(this.control.modal?this.control.show(this.detent):(this.control.toggle(this.detent),!this.secondary&&this.parentElement&&(this.parentElement.ariaExpanded=`${this.control.open}`)))}};t([S({type:Number})],yt.prototype,"detent",void 0),t([S({type:Boolean})],yt.prototype,"secondary",void 0),yt=t([o("m3e-bottom-sheet-trigger")],yt);export{B as M3eBottomSheetActionElement,vt as M3eBottomSheetElement,yt as M3eBottomSheetTriggerElement};
7
7
  //# sourceMappingURL=bottom-sheet.min.js.map