@m3e/web 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/dist/all.js +525 -65
- package/dist/all.js.map +1 -1
- package/dist/all.min.js +45 -45
- package/dist/all.min.js.map +1 -1
- package/dist/bottom-sheet.js +33 -6
- package/dist/bottom-sheet.js.map +1 -1
- package/dist/bottom-sheet.min.js +1 -1
- package/dist/bottom-sheet.min.js.map +1 -1
- package/dist/breadcrumb.js +303 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/breadcrumb.min.js +7 -0
- package/dist/breadcrumb.min.js.map +1 -0
- package/dist/content-pane.js +69 -0
- package/dist/content-pane.js.map +1 -0
- package/dist/content-pane.min.js +7 -0
- package/dist/content-pane.min.js.map +1 -0
- package/dist/core-a11y.js +12 -9
- package/dist/core-a11y.js.map +1 -1
- package/dist/core-a11y.min.js +2 -2
- package/dist/core-a11y.min.js.map +1 -1
- package/dist/core.js +48 -4
- package/dist/core.js.map +1 -1
- package/dist/core.min.js +1 -1
- package/dist/core.min.js.map +1 -1
- package/dist/css-custom-data.json +293 -173
- package/dist/custom-elements.json +2823 -1378
- package/dist/html-custom-data.json +195 -88
- package/dist/list.js +37 -37
- package/dist/list.js.map +1 -1
- package/dist/list.min.js +1 -1
- package/dist/list.min.js.map +1 -1
- package/dist/split-pane.js +56 -15
- package/dist/split-pane.js.map +1 -1
- package/dist/split-pane.min.js +1 -1
- package/dist/split-pane.min.js.map +1 -1
- package/dist/src/all.d.ts +2 -0
- package/dist/src/all.d.ts.map +1 -1
- package/dist/src/bottom-sheet/BottomSheetElement.d.ts +8 -2
- package/dist/src/bottom-sheet/BottomSheetElement.d.ts.map +1 -1
- package/dist/src/breadcrumb/BreadcrumbElement.d.ts +47 -0
- package/dist/src/breadcrumb/BreadcrumbElement.d.ts.map +1 -0
- package/dist/src/breadcrumb/BreadcrumbItemButtonElement.d.ts +37 -0
- package/dist/src/breadcrumb/BreadcrumbItemButtonElement.d.ts.map +1 -0
- package/dist/src/breadcrumb/BreadcrumbItemCurrent.d.ts +3 -0
- package/dist/src/breadcrumb/BreadcrumbItemCurrent.d.ts.map +1 -0
- package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts +88 -0
- package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts.map +1 -0
- package/dist/src/breadcrumb/index.d.ts +4 -0
- package/dist/src/breadcrumb/index.d.ts.map +1 -0
- package/dist/src/breadcrumb/isIconOnly.d.ts +3 -0
- package/dist/src/breadcrumb/isIconOnly.d.ts.map +1 -0
- package/dist/src/content-pane/ContentPaneElement.d.ts +44 -0
- package/dist/src/content-pane/ContentPaneElement.d.ts.map +1 -0
- package/dist/src/content-pane/index.d.ts +2 -0
- package/dist/src/content-pane/index.d.ts.map +1 -0
- package/dist/src/core/a11y/InteractivityChecker.d.ts +4 -2
- package/dist/src/core/a11y/InteractivityChecker.d.ts.map +1 -1
- package/dist/src/core/shared/mixins/LinkButton.d.ts +2 -1
- package/dist/src/core/shared/mixins/LinkButton.d.ts.map +1 -1
- package/dist/src/core/shared/utils/getScrollbarWidth.d.ts +7 -0
- package/dist/src/core/shared/utils/getScrollbarWidth.d.ts.map +1 -0
- package/dist/src/core/shared/utils/index.d.ts +1 -0
- package/dist/src/core/shared/utils/index.d.ts.map +1 -1
- package/dist/src/list/ListActionElement.d.ts +1 -0
- package/dist/src/list/ListActionElement.d.ts.map +1 -1
- package/dist/src/list/index.d.ts +0 -1
- package/dist/src/list/index.d.ts.map +1 -1
- package/dist/src/split-pane/SplitPaneElement.d.ts +6 -0
- package/dist/src/split-pane/SplitPaneElement.d.ts.map +1 -1
- package/dist/tooltip.js +2 -2
- package/dist/tooltip.js.map +1 -1
- package/dist/tooltip.min.js +1 -1
- package/dist/tooltip.min.js.map +1 -1
- package/package.json +11 -1
package/dist/bottom-sheet.js
CHANGED
|
@@ -79,9 +79,10 @@ var M3eBottomSheetElement_1;
|
|
|
79
79
|
* @attr handle - Whether to display a drag handle and enable the top region of the sheet as a gesture surface for dragging between detents.
|
|
80
80
|
* @attr handle-label - The accessible label given to the drag handle.
|
|
81
81
|
* @attr hideable - Whether the bottom sheet can hide when its swiped down.
|
|
82
|
-
* @attr hide-friction - The friction coefficient to hide the sheet
|
|
82
|
+
* @attr hide-friction - The friction coefficient to hide the sheet.
|
|
83
83
|
* @attr modal - Whether the bottom sheet behaves as modal.
|
|
84
84
|
* @attr open - Whether the bottom sheet is open.
|
|
85
|
+
* @attr overshoot-limit - A fractional value, between 0 and 100, indicating the maximum visual overshoot allowed when dragging past the minimum or maximum size.
|
|
85
86
|
*
|
|
86
87
|
* @fires opening - Emitted when the sheet begins to open.
|
|
87
88
|
* @fires opened - Emitted when the sheet has opened.
|
|
@@ -197,10 +198,15 @@ let M3eBottomSheetElement = M3eBottomSheetElement_1 = class M3eBottomSheetElemen
|
|
|
197
198
|
*/
|
|
198
199
|
this.hideable = false;
|
|
199
200
|
/**
|
|
200
|
-
* The friction coefficient to hide the sheet
|
|
201
|
+
* The friction coefficient to hide the sheet.
|
|
201
202
|
* @default 0.5
|
|
202
203
|
*/
|
|
203
204
|
this.hideFriction = 0.5;
|
|
205
|
+
/**
|
|
206
|
+
* A fractional value, between 0 and 100, indicating the maximum visual overshoot allowed when dragging past the minimum or maximum size.
|
|
207
|
+
* @default 4
|
|
208
|
+
*/
|
|
209
|
+
this.overshootLimit = 4;
|
|
204
210
|
}
|
|
205
211
|
/**
|
|
206
212
|
* Shows the sheet.
|
|
@@ -383,10 +389,13 @@ _M3eBottomSheetElement_handleHeaderPointerDown = function _M3eBottomSheetElement
|
|
|
383
389
|
e.target.style.cursor = "grabbing";
|
|
384
390
|
__classPrivateFieldGet(this, _M3eBottomSheetElement_velocityTracker, "f").reset();
|
|
385
391
|
__classPrivateFieldGet(this, _M3eBottomSheetElement_velocityTracker, "f").add(e.clientY);
|
|
392
|
+
const maxHeight = __classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_computeMaxHeight).call(this);
|
|
393
|
+
const effectiveMaxHeight = this.detents.length > 0 ? Math.max(...this.detents.map(x => __classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_computeDetentHeight).call(this, x))) : maxHeight;
|
|
386
394
|
__classPrivateFieldSet(this, _M3eBottomSheetElement_dragState, {
|
|
387
395
|
startY: e.clientY,
|
|
388
396
|
startHeight: this.clientHeight,
|
|
389
|
-
|
|
397
|
+
effectiveMaxHeight,
|
|
398
|
+
maxHeight,
|
|
390
399
|
minHeight: __classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_computeMinHeight).call(this)
|
|
391
400
|
}, "f");
|
|
392
401
|
__classPrivateFieldSet(this, _M3eBottomSheetElement_dragged, false, "f");
|
|
@@ -403,10 +412,22 @@ _M3eBottomSheetElement_handleHeaderPointerMove = function _M3eBottomSheetElement
|
|
|
403
412
|
(e.getCoalescedEvents?.() ?? [e]).forEach(x => __classPrivateFieldGet(this, _M3eBottomSheetElement_velocityTracker, "f").add(x.clientY, e.timeStamp));
|
|
404
413
|
let newHeight = __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").startHeight - (e.clientY - __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").startY);
|
|
405
414
|
if (newHeight < __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").minHeight) {
|
|
406
|
-
|
|
407
|
-
|
|
415
|
+
if (this.hideable) {
|
|
416
|
+
const overshoot = (__classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").minHeight - newHeight) * this.hideFriction;
|
|
417
|
+
newHeight = __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").minHeight - overshoot;
|
|
418
|
+
} else {
|
|
419
|
+
const overshoot = __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").minHeight - newHeight;
|
|
420
|
+
const overshootLimit = __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").maxHeight * (this.overshootLimit / 100);
|
|
421
|
+
const compressed = overshootLimit * overshoot / (overshoot + overshootLimit);
|
|
422
|
+
newHeight = __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").minHeight - compressed;
|
|
423
|
+
}
|
|
424
|
+
} else if (newHeight > __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").effectiveMaxHeight) {
|
|
425
|
+
const overshoot = newHeight - __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").effectiveMaxHeight;
|
|
426
|
+
const overshootLimit = __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").maxHeight * (this.overshootLimit / 100);
|
|
427
|
+
const compressed = overshootLimit * overshoot / (overshoot + overshootLimit);
|
|
428
|
+
newHeight = __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").effectiveMaxHeight + compressed;
|
|
408
429
|
}
|
|
409
|
-
__classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_updateHeight).call(this,
|
|
430
|
+
__classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_updateHeight).call(this, newHeight);
|
|
410
431
|
__classPrivateFieldSet(this, _M3eBottomSheetElement_dragged, true, "f");
|
|
411
432
|
};
|
|
412
433
|
_M3eBottomSheetElement_handleHeaderPointerUp = function _M3eBottomSheetElement_handleHeaderPointerUp(e) {
|
|
@@ -446,6 +467,8 @@ _M3eBottomSheetElement_handleHeaderPointerUp = function _M3eBottomSheetElement_h
|
|
|
446
467
|
__classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_snapToDetent).call(this, __classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_getClosestDetent).call(this));
|
|
447
468
|
} else if (this.clientHeight < __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").minHeight) {
|
|
448
469
|
__classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_snapToHeight).call(this, __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").minHeight);
|
|
470
|
+
} else if (this.clientHeight > __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").effectiveMaxHeight) {
|
|
471
|
+
__classPrivateFieldGet(this, _M3eBottomSheetElement_instances, "m", _M3eBottomSheetElement_snapToHeight).call(this, __classPrivateFieldGet(this, _M3eBottomSheetElement_dragState, "f").effectiveMaxHeight);
|
|
449
472
|
}
|
|
450
473
|
}
|
|
451
474
|
} finally {
|
|
@@ -700,6 +723,10 @@ __decorate([property({
|
|
|
700
723
|
attribute: "hide-friction",
|
|
701
724
|
type: Number
|
|
702
725
|
})], M3eBottomSheetElement.prototype, "hideFriction", void 0);
|
|
726
|
+
__decorate([property({
|
|
727
|
+
attribute: "overshoot-limit",
|
|
728
|
+
type: Number
|
|
729
|
+
})], M3eBottomSheetElement.prototype, "overshootLimit", void 0);
|
|
703
730
|
M3eBottomSheetElement = M3eBottomSheetElement_1 = __decorate([customElement("m3e-bottom-sheet")], M3eBottomSheetElement);
|
|
704
731
|
|
|
705
732
|
/**
|
package/dist/bottom-sheet.js.map
CHANGED
|
@@ -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, or set it to the next closest expanded detent.\r\n * @attr modal - Whether the bottom sheet behaves as modal.\r\n * @attr open - Whether the bottom sheet is open.\r\n *\r\n * @fires opening - Emitted when the sheet begins to open.\r\n * @fires opened - Emitted when the sheet has opened.\r\n * @fires cancel - Emitted when the sheet is cancelled.\r\n * @fires closing - Emitted when the sheet begins to close.\r\n * @fires closed - Emitted when the sheet has closed.\r\n *\r\n * @cssprop --m3e-bottom-sheet-width - The width of the sheet.\r\n * @cssprop --m3e-bottom-sheet-max-width - The maximum width of the sheet.\r\n * @cssprop --m3e-bottom-sheet-container-color - The background color of the sheet container.\r\n * @cssprop --m3e-bottom-sheet-elevation - The elevation level when not modal.\r\n * @cssprop --m3e-bottom-sheet-modal-elevation - The elevation level when modal.\r\n * @cssprop --m3e-bottom-sheet-full-elevation - The elevation level when full height.\r\n * @cssprop --m3e-bottom-sheet-z-index - The z-index of the non-modal sheet.\r\n * @cssprop --m3e-bottom-sheet-minimized-container-shape - The border radius when minimized.\r\n * @cssprop --m3e-bottom-sheet-container-shape - The border radius of the sheet container.\r\n * @cssprop --m3e-bottom-sheet-full-container-shape - The border radius when full height.\r\n * @cssprop --m3e-bottom-sheet-scrim-color - The color of the scrim overlay.\r\n * @cssprop --m3e-bottom-sheet-scrim-opacity - The opacity of the scrim overlay.\r\n * @cssprop --m3e-bottom-sheet-peek-height - The visible height when minimized.\r\n * @cssprop --m3e-bottom-sheet-compact-top-space - The top space in compact mode.\r\n * @cssprop --m3e-bottom-sheet-top-space - The top space in standard mode.\r\n * @cssprop --m3e-bottom-sheet-padding-block - The vertical padding.\r\n * @cssprop --m3e-bottom-sheet-padding-inline - The horizontal padding.\r\n * @cssprop --m3e-bottom-sheet-handle-container-height - The height of the drag handle container.\r\n * @cssprop --m3e-bottom-sheet-handle-width - The width of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-height - The height of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-shape - The border radius of the handle.\r\n * @cssprop --m3e-bottom-sheet-handle-color - The color of the drag handle.\r\n * @cssprop --m3e-bottom-sheet-handle-focus-ring-offset - The offset of the focus ring around the handle.\r\n * @cssprop --m3e-bottom-sheet-color - The foreground (text) color of the sheet.\r\n * @cssprop --m3e-bottom-sheet-content-font-size - Font size for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-font-weight - Font weight for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-line-height - Line height for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-content-tracking - Letter spacing (tracking) for the sheet content.\r\n * @cssprop --m3e-bottom-sheet-header-font-size - Font size for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-font-weight - Font weight for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-line-height - Line height for the sheet header.\r\n * @cssprop --m3e-bottom-sheet-header-tracking - Letter spacing (tracking) for the sheet header.\r\n */\r\n@customElement(\"m3e-bottom-sheet\")\r\nexport class M3eBottomSheetElement extends EventAttribute(\r\n ReconnectedCallback(SuppressInitialAnimation(AttachInternals(LitElement))),\r\n \"opening\",\r\n \"opened\",\r\n \"cancel\",\r\n \"closing\",\r\n \"closed\",\r\n) {\r\n static {\r\n registerStyleSheet(css`\r\n @property --_bottom-sheet-height {\r\n syntax: \"<length>\";\r\n inherits: false;\r\n initial-value: 50vh;\r\n }\r\n m3e-bottom-sheet > [slot=\"header\"] {\r\n margin-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n margin-inline: var(--m3e-bottom-sheet-padding-inline, 1rem);\r\n }\r\n `);\r\n }\r\n\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: block;\r\n position: fixed;\r\n left: 50%;\r\n top: calc(100vh - var(--_bottom-sheet-height));\r\n margin: 0;\r\n padding: 0;\r\n outline: none;\r\n overflow: hidden;\r\n border: none;\r\n box-sizing: border-box;\r\n width: var(--m3e-bottom-sheet-width, 100%);\r\n max-width: var(--m3e-bottom-sheet-max-width, 40rem);\r\n height: var(--_bottom-sheet-height);\r\n color: var(--m3e-bottom-sheet-color, ${DesignToken.color.onSurface});\r\n background-color: var(--m3e-bottom-sheet-container-color, ${DesignToken.color.surfaceContainerLow});\r\n }\r\n :host(:not(:state(-no-animate))) {\r\n transition: ${unsafeCSS(\r\n `transform ${DesignToken.motion.duration.medium2} ${DesignToken.motion.easing.standardDecelerate},\r\n border-radius ${DesignToken.motion.duration.medium2} ${DesignToken.motion.easing.standard}`,\r\n )};\r\n }\r\n :host(:not([modal]):not(:state(-full))) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host([modal]:not(:state(-full))) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-modal-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host(:state(-full)) .elevation {\r\n --m3e-elevation-level: var(--m3e-bottom-sheet-full-elevation, ${DesignToken.elevation.level1});\r\n }\r\n :host(:not([modal])) {\r\n z-index: var(--m3e-bottom-sheet-z-index, 10);\r\n }\r\n :host(:not([modal]):not([open])),\r\n :host([modal]:not(:popover-open)) {\r\n border-radius: var(--m3e-bottom-sheet-minimized-container-shape, ${DesignToken.shape.corner.none});\r\n transform: translateX(-50%) translateY(100%);\r\n }\r\n :host(:not([modal])[open]:not(:state(-full))),\r\n :host([modal]:not(:state(-full)):popover-open) {\r\n border-radius: var(--m3e-bottom-sheet-container-shape, ${DesignToken.shape.corner.extraLargeTop});\r\n }\r\n :host(:not([modal])[open]:state(-full)),\r\n :host([modal]:state(-full):popover-open) {\r\n border-radius: var(--m3e-bottom-sheet-full-container-shape, ${DesignToken.shape.corner.extraLargeTop});\r\n }\r\n :host(:not([modal])[open]),\r\n :host([modal]:popover-open) {\r\n transform: translateX(-50%) translateY(0);\r\n }\r\n :host([modal]:not(:state(-no-animate)))::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host([modal]:popover-open)::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-bottom-sheet-scrim-color, ${DesignToken.color.scrim}) var(--m3e-bottom-sheet-scrim-opacity, 32%),\r\n transparent\r\n );\r\n }\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n @starting-style {\r\n :host([modal]:popover-open)::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-bottom-sheet-scrim-color, ${DesignToken.color.scrim}) 0%,\r\n transparent\r\n );\r\n }\r\n }\r\n .base {\r\n display: flex;\r\n border-radius: inherit;\r\n flex-direction: column;\r\n height: 100%;\r\n --_bottom-sheet-peek-height: var(--m3e-bottom-sheet-peek-height, 0);\r\n --_bottom-sheet-top-space: var(--m3e-bottom-sheet-compact-top-space, 4.5rem);\r\n }\r\n @media (max-height: 640px) {\r\n .base {\r\n --_bottom-sheet-top-space: var(--m3e-bottom-sheet-top-space, 3.5rem);\r\n }\r\n }\r\n .body {\r\n flex: 1 1 auto;\r\n overflow-y: auto;\r\n scrollbar-width: ${DesignToken.scrollbar.thinWidth};\r\n scrollbar-color: ${DesignToken.scrollbar.color};\r\n padding-block-end: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n padding-inline: var(--m3e-bottom-sheet-padding-inline, 1rem);\r\n font-size: var(--m3e-bottom-sheet-content-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(\r\n --m3e-bottom-sheet-content-font-weight,\r\n ${DesignToken.typescale.standard.body.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-bottom-sheet-content-line-height,\r\n ${DesignToken.typescale.standard.body.medium.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-bottom-sheet-content-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n .content {\r\n height: fit-content;\r\n }\r\n :host(:not([handle])) .header {\r\n display: none;\r\n }\r\n :host(:not([handle])) .body,\r\n .header {\r\n border-top-left-radius: inherit;\r\n border-top-right-radius: inherit;\r\n padding-block-start: var(--m3e-bottom-sheet-padding-block, 0.5rem);\r\n font-size: var(--m3e-bottom-sheet-header-font-size, ${DesignToken.typescale.standard.title.large.fontSize});\r\n font-weight: var(--m3e-bottom-sheet-header-font-weight, ${DesignToken.typescale.standard.title.large.fontWeight});\r\n line-height: var(--m3e-bottom-sheet-header-line-height, ${DesignToken.typescale.standard.title.large.lineHeight});\r\n letter-spacing: var(--m3e-bottom-sheet-header-tracking, ${DesignToken.typescale.standard.title.large.tracking});\r\n }\r\n .header {\r\n cursor: grab;\r\n touch-action: none;\r\n outline: none;\r\n user-select: none;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n box-sizing: border-box;\r\n flex: none;\r\n display: flex;\r\n flex-direction: column;\r\n min-height: 3rem;\r\n --m3e-app-bar-container-color: var(--m3e-bottom-sheet-container-color, ${DesignToken.color.surfaceContainerLow});\r\n }\r\n .handle-row {\r\n position: relative;\r\n flex: none;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n opacity: 1;\r\n visibility: visible;\r\n height: var(--m3e-bottom-sheet-handle-container-height, 1.5rem);\r\n }\r\n :host(:not(:state(-no-animate))) .handle-row {\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n padding ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n height ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard},\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .handle {\r\n position: relative;\r\n width: var(--m3e-bottom-sheet-handle-width, 2rem);\r\n height: var(--m3e-bottom-sheet-handle-height, 4px);\r\n border-radius: var(--m3e-bottom-sheet-handle-shape, ${DesignToken.shape.corner.full});\r\n background-color: var(--m3e-bottom-sheet-handle-color, ${DesignToken.color.onSurfaceVariant});\r\n }\r\n .handle-touch {\r\n position: absolute;\r\n aspect-ratio: 1 / 1;\r\n height: 3rem;\r\n left: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2));\r\n right: calc(0px - calc(calc(3rem - var(--m3e-bottom-sheet-handle-width, 2rem)) / 2));\r\n top: calc(\r\n 0px - calc(\r\n calc(3rem - var(--m3e-bottom-sheet-handle-container-height, 1.5rem)) - calc(\r\n var(--m3e-bottom-sheet-handle-height, 4px) / 2\r\n )\r\n )\r\n );\r\n }\r\n @media (prefers-reduced-motion) {\r\n :host(:not(:state(-no-animate))),\r\n :host([modal]:not(:state(-no-animate)))::backdrop,\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop,\r\n :host(:not(:state(-no-animate))) .handle-row {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n :host([modal]:not(:state(-no-animate)))::backdrop,\r\n :host([modal]:popover-open:not(:state(-no-animate)))::backdrop {\r\n transition: none;\r\n }\r\n .base {\r\n border-style: solid;\r\n border-width: 1px;\r\n border-color: CanvasText;\r\n }\r\n .handle {\r\n background-color: ButtonText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ private static __openSheet?: M3eBottomSheetElement;\r\n\r\n /** @private */ readonly #documentClickHandler = (e: Event) => this.#handleDocumentClick(e);\r\n /** @private */ readonly #documentKeyDownHandler = (e: KeyboardEvent) => this.#handleDocumentKeyDown(e);\r\n /** @private */ readonly #windowResizeHandler = () => this.#handleWindowResize();\r\n /** @private */ readonly #velocityTracker = new VelocityTracker();\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n /** @private */ readonly #inertController = new InertController(this);\r\n\r\n /** @private */\r\n readonly #resizeController = new ResizeController(this, {\r\n target: null,\r\n skipInitial: true,\r\n callback: (x) => this.#handleSectionResize(x),\r\n });\r\n\r\n /** @private */ #trigger: Element | null = null;\r\n /** @private */ #dragState?: { startY: number; startHeight: number; maxHeight: number; minHeight: number };\r\n /** @private */ #dragged = false;\r\n /** @private */ #activeDetent = 0;\r\n /** @private */ #requestDetent?: number;\r\n /** @private */ #cachedContentHeight = 0;\r\n /** @private */ #cachedHeaderHeight = 0;\r\n /** @private */ #snapAnimation?: Animation;\r\n\r\n /**\r\n * Whether the bottom sheet behaves as modal.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) modal = false;\r\n\r\n /**\r\n * Whether the bottom sheet is open.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) open = false;\r\n\r\n /**\r\n * Whether to display a drag handle and enable the top region of the sheet as a gesture\r\n * surface for dragging between detents.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) handle = false;\r\n\r\n /**\r\n * The accessible label given to the drag handle.\r\n * @default \"Drag handle\"\r\n */\r\n @property({ attribute: \"handle-label\" }) handleLabel = \"Drag handle\";\r\n\r\n /**\r\n * Detents (discrete height states) the sheet can snap to.\r\n * @default []\r\n */\r\n @property({ attribute: \"detents\", converter: spaceSeparatedStringConverter }) detents: string[] = [];\r\n\r\n /**\r\n * The zero‑based index of the detent the sheet should open to.\r\n * @default 0\r\n */\r\n @property({ type: Number }) detent = 0;\r\n\r\n /**\r\n * Whether the bottom sheet can hide when its swiped down.\r\n * @default false\r\n */\r\n @property({ type: Boolean, reflect: true }) hideable = false;\r\n\r\n /**\r\n * The friction coefficient to hide the sheet, or set it to the next closest expanded detent.\r\n * @default 0.5\r\n */\r\n @property({ attribute: \"hide-friction\", type: Number }) hideFriction = 0.5;\r\n\r\n /**\r\n * Shows the sheet.\r\n * @param {number} detent The zero‑based index of the detent the sheet should open to.\r\n */\r\n show(detent: number = this.detent): void {\r\n if (!this.open) {\r\n this.#requestDetent = detent;\r\n this.open = true;\r\n } else if (detent !== undefined && this.#activeDetent !== detent) {\r\n this.#snapToDetent(detent);\r\n }\r\n }\r\n\r\n /** Hides the sheet. */\r\n hide(): void {\r\n this.open = false;\r\n }\r\n\r\n /**\r\n * Toggles the opened state of the sheet.\r\n * @param {number} detent The zero‑based index of the detent the sheet should open to.\r\n */\r\n toggle(detent?: number): void {\r\n if (this.open) {\r\n this.hide();\r\n } else {\r\n this.show(detent);\r\n }\r\n }\r\n\r\n /** Moves the sheet to the next detent. */\r\n cycle(): void {\r\n if (!this.open) {\r\n this.show();\r\n } else if (this.detents.length > 0) {\r\n if (this.#activeDetent < this.detents.length - 1) {\r\n this.#activeDetent++;\r\n this.#snapToDetent(this.#activeDetent);\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"modal\")) {\r\n this.role = this.modal ? \"dialog\" : \"region\";\r\n this.ariaModal = this.modal ? \"true\" : null;\r\n this.popover = this.modal ? \"manual\" : null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n this.#initialize();\r\n }\r\n\r\n /** @inheritdoc */\r\n override firstUpdated(_changedProperties: PropertyValues): void {\r\n super.firstUpdated(_changedProperties);\r\n this.#initialize();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues): void {\r\n super.updated(_changedProperties);\r\n\r\n if (_changedProperties.has(\"open\")) {\r\n if (this.open) {\r\n if (!this.dispatchEvent(new Event(\"opening\", { cancelable: true }))) {\r\n this.open = false;\r\n return;\r\n }\r\n\r\n // Only one sheet can be open at a time.\r\n if (M3eBottomSheetElement.__openSheet !== this) {\r\n M3eBottomSheetElement.__openSheet?.hide();\r\n }\r\n M3eBottomSheetElement.__openSheet = this;\r\n\r\n this.inert = false;\r\n\r\n window.addEventListener(\"resize\", this.#windowResizeHandler);\r\n\r\n // If there are detents (regardless of handle) open to the requested, default (or first) detent.\r\n // Otherwise, open to fit unless its greater than half.\r\n\r\n if (this.detents.length > 0) {\r\n this.#activeDetent = Math.min(Math.max(0, this.#requestDetent ?? this.detent), this.detents.length - 1);\r\n this.#updateHeight(this.#computeDetentHeight(this.detents[this.#activeDetent]));\r\n } else {\r\n this.#updateHeight(Math.min(this.#computeDetentHeight(\"fit\"), this.#computeDetentHeight(\"half\")));\r\n }\r\n this.#requestDetent = undefined;\r\n } else {\r\n if (!this.dispatchEvent(new Event(\"closing\", { cancelable: true }))) {\r\n this.open = true;\r\n return;\r\n }\r\n\r\n // The following ensures layout is stable so that first tab isn't \"skipped\"\r\n requestAnimationFrame(() => (this.inert = true));\r\n\r\n window.removeEventListener(\"resize\", this.#windowResizeHandler);\r\n\r\n if (M3eBottomSheetElement.__openSheet === this) {\r\n M3eBottomSheetElement.__openSheet = undefined;\r\n }\r\n }\r\n\r\n if (this.modal) {\r\n if (this.open) {\r\n this.#trigger = document.activeElement;\r\n this.#inertController.lock();\r\n this.#scrollLockController.lock();\r\n this.showPopover();\r\n requestAnimationFrame(() => {\r\n document.addEventListener(\"click\", this.#documentClickHandler);\r\n document.addEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n });\r\n\r\n let focusable: HTMLElement | null | undefined = this.querySelector<HTMLElement>(\"[autofocus]\");\r\n if (!focusable || !M3eInteractivityChecker.isFocusable(focusable)) {\r\n focusable = this.shadowRoot?.querySelector(\".handle\");\r\n }\r\n if (focusable) {\r\n focusWhenReady(focusable);\r\n }\r\n } else {\r\n this.#snapToHeight(0).then(() => {\r\n this.#inertController.unlock();\r\n this.#scrollLockController.unlock();\r\n document.removeEventListener(\"click\", this.#documentClickHandler);\r\n document.removeEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n this.hidePopover();\r\n if (this.#trigger instanceof HTMLElement) {\r\n this.#trigger.focus();\r\n }\r\n this.#trigger = null;\r\n });\r\n }\r\n }\r\n\r\n this.dispatchEvent(new Event(this.open ? \"opened\" : \"closed\"));\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<m3e-focus-trap ?disabled=\"${!this.modal}\">\r\n <div class=\"base\">\r\n <m3e-elevation class=\"elevation\"></m3e-elevation>\r\n <div\r\n class=\"header\"\r\n @pointerdown=\"${this.#handleHeaderPointerDown}\"\r\n @pointermove=\"${this.#handleHeaderPointerMove}\"\r\n @pointerup=\"${this.#handleHeaderPointerUp}\"\r\n >\r\n ${this.handle\r\n ? html`<div class=\"handle-row\">\r\n <div\r\n id=\"handle\"\r\n class=\"handle\"\r\n role=\"button\"\r\n aria-label=\"${this.handleLabel}\"\r\n tabindex=\"0\"\r\n @click=\"${this.#handleDragHandleClick}\"\r\n @keydown=\"${this.#handleDragHandleKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"handle\"></m3e-focus-ring>\r\n <div class=\"handle-touch\" aria-hidden=\"true\"></div>\r\n </div>\r\n </div>`\r\n : nothing}\r\n <slot name=\"header\" @slotchange=\"${this.#handleHeaderSlotChange}\"></slot>\r\n </div>\r\n <div class=\"body\">\r\n <div class=\"content\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n </div>\r\n </m3e-focus-trap>`;\r\n }\r\n\r\n /** @private */\r\n #initialize(): void {\r\n const content = this.shadowRoot?.querySelector<HTMLElement>(\".content\");\r\n if (content) {\r\n this.#cachedContentHeight = content.clientHeight;\r\n this.#resizeController.observe(content);\r\n }\r\n\r\n const header = this.shadowRoot?.querySelector<HTMLElement>(\".header\");\r\n if (header) {\r\n this.#cachedHeaderHeight = header.clientHeight;\r\n this.#resizeController.observe(header);\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleHeaderSlotChange(e: Event): void {\r\n setCustomState(this, \"has-header\", hasAssignedNodes(e.target as HTMLSlotElement));\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerDown(e: PointerEvent): void {\r\n if (e.target instanceof HTMLElement && M3eInteractivityChecker.isFocusable(e.target)) {\r\n return;\r\n }\r\n\r\n (<HTMLElement>e.target).setPointerCapture(e.pointerId);\r\n (<HTMLElement>e.target).style.cursor = \"grabbing\";\r\n\r\n this.#velocityTracker.reset();\r\n this.#velocityTracker.add(e.clientY);\r\n\r\n this.#dragState = {\r\n startY: e.clientY,\r\n startHeight: this.clientHeight,\r\n maxHeight: this.#computeMaxHeight(),\r\n minHeight: this.#computeMinHeight(),\r\n };\r\n this.#dragged = false;\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerMove(e: PointerEvent): void {\r\n if (!this.#dragState) {\r\n return;\r\n }\r\n\r\n const minDragThreshold = 8;\r\n if (Math.abs(e.clientY - this.#dragState.startY) <= minDragThreshold) {\r\n // Ignore movement under threshold\r\n return;\r\n }\r\n\r\n (e.getCoalescedEvents?.() ?? [e]).forEach((x) => this.#velocityTracker.add(x.clientY, e.timeStamp));\r\n\r\n let newHeight = this.#dragState.startHeight - (e.clientY - this.#dragState.startY);\r\n if (newHeight < this.#dragState.minHeight) {\r\n const overshoot = (this.#dragState.minHeight - newHeight) * this.hideFriction;\r\n newHeight = this.#dragState.minHeight - overshoot;\r\n }\r\n\r\n this.#updateHeight(Math.min(this.#dragState.maxHeight, newHeight));\r\n this.#dragged = true;\r\n }\r\n\r\n /** @private */\r\n #handleHeaderPointerUp(e: PointerEvent): void {\r\n if (!this.#dragState) return;\r\n\r\n try {\r\n (<HTMLElement>e.target).releasePointerCapture(e.pointerId);\r\n (<HTMLElement>e.target).style.cursor = \"\";\r\n\r\n if (!this.#dragged) return;\r\n\r\n const significantVelocityThreshold = e.pointerType === \"touch\" ? 1200 : 500;\r\n const velocity = this.#velocityTracker.getVelocity();\r\n\r\n this.#velocityTracker.reset();\r\n\r\n if (this.hideable && velocity >= significantVelocityThreshold) {\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n } else if (Math.abs(velocity) >= significantVelocityThreshold) {\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextHigherDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n }\r\n } else {\r\n this.#snapToHeight(this.#computeDetentHeight(\"full\"));\r\n }\r\n } else {\r\n const hideDistanceThreshold = 20;\r\n if (this.hideable) {\r\n const collapsed = this.#dragState.minHeight;\r\n if (this.clientHeight < collapsed - hideDistanceThreshold) {\r\n this.hide();\r\n return;\r\n }\r\n }\r\n\r\n if (this.detents.length > 0) {\r\n this.#snapToDetent(this.#getClosestDetent());\r\n } else if (this.clientHeight < this.#dragState.minHeight) {\r\n this.#snapToHeight(this.#dragState.minHeight);\r\n }\r\n }\r\n } finally {\r\n this.#dragState = undefined;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDocumentClick(e: Event): void {\r\n if (\r\n this.open &&\r\n this.modal &&\r\n !e.composedPath().includes(this) &&\r\n this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))\r\n ) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDocumentKeyDown(e: KeyboardEvent): void {\r\n if (this.open && this.modal && e.key === \"Escape\" && !e.shiftKey && !e.ctrlKey) {\r\n e.preventDefault();\r\n\r\n if (this.dispatchEvent(new Event(\"cancel\", { cancelable: true }))) {\r\n this.hide();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleWindowResize(): void {\r\n if (this.detents.length > 0 && this.detents[this.#activeDetent] === \"half\") {\r\n this.#updateHeight(this.#computeDetentHeight(\"half\"));\r\n return;\r\n }\r\n\r\n const maxHeight = this.#computeMaxHeight();\r\n if (hasCustomState(this, \"-full\")) {\r\n this.#updateHeight(maxHeight);\r\n } else if (this.clientHeight > maxHeight) {\r\n this.#updateHeight(maxHeight);\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDragHandleClick(): void {\r\n if (!this.#dragged) {\r\n this.cycle();\r\n }\r\n this.#dragged = false;\r\n }\r\n\r\n /** @private */\r\n #handleDragHandleKeyDown(e: KeyboardEvent): void {\r\n if (e.defaultPrevented || !isModifierAllowed(e)) return;\r\n\r\n switch (e.key) {\r\n case \"Up\":\r\n case \"ArrowUp\":\r\n e.preventDefault();\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextHigherDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n }\r\n } else {\r\n this.#snapToHeight(this.#computeDetentHeight(\"full\"));\r\n }\r\n break;\r\n\r\n case \"Down\":\r\n case \"ArrowDown\":\r\n e.preventDefault();\r\n if (this.detents.length > 0) {\r\n const nextDetent = this.#getNextLowerDetent();\r\n if (nextDetent !== this.#activeDetent) {\r\n this.#snapToDetent(nextDetent);\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n } else if (this.hideable) {\r\n this.hide();\r\n }\r\n\r\n break;\r\n }\r\n }\r\n\r\n /** @private */\r\n #getNextHigherDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let nextHeight = Infinity;\r\n let nextDetent = this.#activeDetent;\r\n for (let i = 0; i < this.detents.length; i++) {\r\n if (i === this.#activeDetent) continue;\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n if (detentHeight > currentHeight && detentHeight < nextHeight) {\r\n nextHeight = detentHeight;\r\n nextDetent = i;\r\n }\r\n }\r\n return nextDetent;\r\n }\r\n\r\n /** @private */\r\n #getNextLowerDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let nextHeight = -Infinity;\r\n let nextDetent = this.#activeDetent;\r\n for (let i = 0; i < this.detents.length; i++) {\r\n if (i === this.#activeDetent) continue;\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n if (detentHeight < currentHeight && detentHeight > nextHeight) {\r\n nextHeight = detentHeight;\r\n nextDetent = i;\r\n }\r\n }\r\n return nextDetent;\r\n }\r\n\r\n /** @private */\r\n #getClosestDetent(): number {\r\n const currentHeight = this.clientHeight;\r\n let closestDetent = this.#activeDetent;\r\n let closestDistance = Infinity;\r\n\r\n for (let i = 0; i < this.detents.length; i++) {\r\n const detentHeight = this.#computeDetentHeight(this.detents[i]);\r\n const distance = Math.abs(currentHeight - detentHeight);\r\n\r\n if (distance < closestDistance) {\r\n closestDistance = distance;\r\n closestDetent = i;\r\n }\r\n }\r\n return closestDetent;\r\n }\r\n\r\n /** @private */\r\n #computeDetentHeight(detent: string): number {\r\n switch (detent) {\r\n case \"collapsed\":\r\n return this.#computeMinHeight();\r\n case \"half\":\r\n return this.#computeMaxHeight() * 0.5;\r\n case \"full\":\r\n return this.#computeMaxHeight();\r\n case \"fit\":\r\n return this.#computeFitHeight();\r\n }\r\n\r\n if (detent.endsWith(\"%\")) {\r\n return this.#computeMaxHeight() * (parseFloat(detent) / 100);\r\n }\r\n\r\n if (detent.endsWith(\"px\")) {\r\n return parseFloat(detent);\r\n }\r\n\r\n return this.#computeMinHeight();\r\n }\r\n\r\n /** @private */\r\n #computeMaxHeight(): number {\r\n const base = this.shadowRoot?.querySelector<HTMLElement>(\".base\");\r\n return window.innerHeight - (base ? computeCssSize(base, \"var(--_bottom-sheet-top-space)\") : 0);\r\n }\r\n\r\n /** @private */\r\n #computeMinHeight(): number {\r\n return this.detents.includes(\"fit\") && !this.detents.includes(\"collapsed\")\r\n ? this.#computeFitHeight()\r\n : this.#computePeekHeight();\r\n }\r\n\r\n /** @private */\r\n #computePeekHeight(): number {\r\n const base = this.shadowRoot?.querySelector<HTMLElement>(\".base\");\r\n return this.#cachedHeaderHeight + (base ? computeCssSize(base, \"var(--_bottom-sheet-peek-height)\") : 0);\r\n }\r\n\r\n /** @private */\r\n #computeFitHeight(): number {\r\n const body = this.shadowRoot?.querySelector<HTMLElement>(\".body\");\r\n if (!body) {\r\n return 0;\r\n }\r\n\r\n const bodyStyle = getComputedStyle(body);\r\n return (\r\n this.#cachedHeaderHeight +\r\n this.#cachedContentHeight +\r\n parseFloat(bodyStyle.paddingBlockStart) +\r\n parseFloat(bodyStyle.paddingBlockEnd)\r\n );\r\n }\r\n\r\n /** @private */\r\n #handleSectionResize(entries: ResizeObserverEntry[]): void {\r\n const oldCachedContentHeight = this.#cachedContentHeight;\r\n const oldCachedHeaderHeight = this.#cachedHeaderHeight;\r\n\r\n for (const entry of entries) {\r\n if (entry.target.classList.contains(\"content\")) {\r\n this.#cachedContentHeight = (<ResizeObserverSize>(\r\n (Array.isArray(entry.borderBoxSize) ? entry.borderBoxSize[0] : entry.borderBoxSize)\r\n )).blockSize;\r\n } else if (entry.target.classList.contains(\"header\")) {\r\n this.#cachedHeaderHeight = (<ResizeObserverSize>(\r\n (Array.isArray(entry.borderBoxSize) ? entry.borderBoxSize[0] : entry.borderBoxSize)\r\n )).blockSize;\r\n }\r\n }\r\n\r\n if (\r\n this.open &&\r\n this.detents.length > 0 &&\r\n (oldCachedContentHeight !== this.#cachedContentHeight || oldCachedHeaderHeight !== this.#cachedHeaderHeight)\r\n ) {\r\n switch (this.detents[this.#activeDetent]) {\r\n case \"fit\":\r\n this.#updateHeight(this.#computeFitHeight());\r\n break;\r\n\r\n case \"collapsed\":\r\n this.#updateHeight(this.#computeMinHeight());\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #snapToDetent(detent: number): void {\r\n if (detent >= 0 && detent < this.detents.length) {\r\n this.#activeDetent = detent;\r\n this.#snapToHeight(this.#computeDetentHeight(this.detents[detent]));\r\n }\r\n }\r\n\r\n /** @private */\r\n async #snapToHeight(height: number): Promise<void> {\r\n if (this.#snapAnimation) {\r\n this.#updateHeight(this.clientHeight);\r\n this.#snapAnimation?.cancel();\r\n this.#snapAnimation = undefined;\r\n }\r\n\r\n if (!prefersReducedMotion()) {\r\n this.#snapAnimation = this.animate(\r\n [{ \"--_bottom-sheet-height\": `${this.clientHeight}px` }, { \"--_bottom-sheet-height\": `${height}px` }],\r\n {\r\n duration: 250,\r\n easing: \"cubic-bezier(0.2, 0.0, 0, 1.0)\",\r\n },\r\n );\r\n this.#snapAnimation.onfinish = () => {\r\n this.#updateHeight(height);\r\n this.#snapAnimation = undefined;\r\n };\r\n await this.#snapAnimation.finished;\r\n } else {\r\n this.#updateHeight(height);\r\n }\r\n }\r\n\r\n /** @private */\r\n #updateHeight(height: number): void {\r\n this.style.setProperty(\"--_bottom-sheet-height\", `${height}px`);\r\n setCustomState(this, \"-full\", height === this.#computeMaxHeight());\r\n const content = this.shadowRoot?.querySelector<HTMLElement>(\".content\");\r\n if (content) {\r\n content.inert = height <= this.#computePeekHeight();\r\n }\r\n }\r\n}\r\n\r\ninterface M3eBottomSheetElementEventMap extends HTMLElementEventMap {\r\n opening: Event;\r\n opened: Event;\r\n closing: Event;\r\n closed: Event;\r\n cancel: Event;\r\n}\r\n\r\nexport interface M3eBottomSheetElement {\r\n addEventListener<K extends keyof M3eBottomSheetElementEventMap>(\r\n type: K,\r\n listener: (this: M3eBottomSheetElement, ev: M3eBottomSheetElementEventMap[K]) => void,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n addEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | AddEventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener<K extends keyof M3eBottomSheetElementEventMap>(\r\n type: K,\r\n listener: (this: M3eBottomSheetElement, ev: M3eBottomSheetElementEventMap[K]) => void,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n\r\n removeEventListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | EventListenerOptions,\r\n ): void;\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-bottom-sheet\": M3eBottomSheetElement;\r\n }\r\n}\r\n","import { property } from \"lit/decorators.js\";\r\n\r\nimport { ActionElementBase, customElement, HtmlFor } from \"@m3e/web/core\";\r\nimport { addAriaReferencedId, removeAriaReferencedId } from \"@m3e/web/core/a11y\";\r\n\r\nimport { M3eBottomSheetElement } from \"./BottomSheetElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to trigger a bottom sheet.\r\n * @tag m3e-bottom-sheet-trigger\r\n *\r\n * @slot - Renders the content of the trigger.\r\n *\r\n * @attr detent - The zero‑based index of the detent the sheet should open to.\r\n * @attr secondary - Marks this trigger as a secondary trigger for accessibility. Secondary triggers do not receive ARIA ownership.\r\n */\r\n@customElement(\"m3e-bottom-sheet-trigger\")\r\nexport class M3eBottomSheetTriggerElement extends HtmlFor(ActionElementBase) {\r\n /**\r\n * The zero‑based index of the detent the sheet should open to.\r\n * @default undefined\r\n */\r\n @property({ type: Number }) detent?: number;\r\n\r\n /**\r\n * Marks this trigger as a secondary trigger for accessibility. Secondary triggers do not receive ARIA ownership.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) secondary = false;\r\n\r\n /** @inheritdoc */\r\n override attach(control: HTMLElement): void {\r\n if (control instanceof M3eBottomSheetElement) {\r\n super.attach(control);\r\n\r\n if (this.parentElement) {\r\n if (!control.modal) {\r\n if (!this.secondary) {\r\n this.parentElement.ariaExpanded = \"false\";\r\n addAriaReferencedId(this.parentElement, \"aria-controls\", control.id);\r\n if (this.parentElement.id) {\r\n addAriaReferencedId(control, \"aria-labelledby\", this.parentElement.id);\r\n }\r\n }\r\n } else {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override detach(): void {\r\n if (this.control && this.parentElement && !this.secondary) {\r\n removeAriaReferencedId(this.parentElement, \"aria-controls\", this.control.id);\r\n }\r\n super.detach();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override _onClick(): void {\r\n if (this.control instanceof M3eBottomSheetElement) {\r\n if (this.control.modal) {\r\n this.control.show(this.detent);\r\n } else {\r\n this.control.toggle(this.detent);\r\n if (!this.secondary && this.parentElement) {\r\n this.parentElement.ariaExpanded = `${this.control.open}`;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-bottom-sheet-trigger\": M3eBottomSheetTriggerElement;\r\n }\r\n}\r\n"],"names":["M3eBottomSheetActionElement","ActionElementBase","_onClick","closest","hide","__decorate","customElement","M3eBottomSheetElement","M3eBottomSheetElement_1","EventAttribute","ReconnectedCallback","SuppressInitialAnimation","AttachInternals","LitElement","constructor","_M3eBottomSheetElement_documentClickHandler","set","e","__classPrivateFieldGet","call","_M3eBottomSheetElement_documentKeyDownHandler","_M3eBottomSheetElement_windowResizeHandler","_M3eBottomSheetElement_instances","_M3eBottomSheetElement_handleWindowResize","_M3eBottomSheetElement_velocityTracker","VelocityTracker","_M3eBottomSheetElement_scrollLockController","ScrollLockController","_M3eBottomSheetElement_inertController","InertController","_M3eBottomSheetElement_resizeController","ResizeController","target","skipInitial","callback","x","_M3eBottomSheetElement_handleSectionResize","_M3eBottomSheetElement_trigger","_M3eBottomSheetElement_dragState","_M3eBottomSheetElement_dragged","_M3eBottomSheetElement_activeDetent","_M3eBottomSheetElement_requestDetent","_M3eBottomSheetElement_cachedContentHeight","_M3eBottomSheetElement_cachedHeaderHeight","_M3eBottomSheetElement_snapAnimation","modal","open","handle","handleLabel","detents","detent","hideable","hideFriction","show","__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","startY","startHeight","maxHeight","_M3eBottomSheetElement_computeMaxHeight","minHeight","_M3eBottomSheetElement_computeMinHeight","minDragThreshold","abs","getCoalescedEvents","forEach","timeStamp","newHeight","overshoot","releasePointerCapture","significantVelocityThreshold","pointerType","velocity","getVelocity","nextDetent","hideDistanceThreshold","collapsed","_M3eBottomSheetElement_getClosestDetent","composedPath","includes","key","shiftKey","ctrlKey","preventDefault","hasCustomState","defaultPrevented","isModifierAllowed","currentHeight","nextHeight","Infinity","i","detentHeight","closestDetent","closestDistance","distance","_M3eBottomSheetElement_computeFitHeight","endsWith","parseFloat","base","innerHeight","computeCssSize","body","bodyStyle","getComputedStyle","paddingBlockStart","paddingBlockEnd","entries","oldCachedContentHeight","oldCachedHeaderHeight","entry","classList","contains","Array","isArray","borderBoxSize","blockSize","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;;;;ACcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGG;AAEI,IAAMO,qBAAqB,GAAAC,uBAAA,GAA3B,MAAMD,qBAAsB,SAAQE,cAAc,CACvDC,mBAAmB,CAACC,wBAAwB,CAACC,eAAe,CAACC,UAAU,CAAC,CAAC,CAAC,EAC1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CAAC,CAC7B,EAAAsO,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 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","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;;;;ACcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGG;AAEI,IAAMO,qBAAqB,GAAAC,uBAAA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,CAACJ,MAAM,CAAC;AAChC,MAAA,CAAC,MAAM;QACL,IAAI,CAACkM,OAAO,CAAC1L,MAAM,CAAC,IAAI,CAACR,MAAM,CAAC;QAChC,IAAI,CAAC,IAAI,CAACgM,SAAS,IAAI,IAAI,CAACG,aAAa,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;;AAjD4BzC,UAAA,CAAA,CAA3BkO,QAAQ,CAAC;AAAEC,EAAAA,IAAI,EAAEO;CAAQ,CAAC,CAAiB,EAAAC,4BAAA,CAAAL,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAMftO,UAAA,CAAA,CAA5BkO,QAAQ,CAAC;AAAEC,EAAAA,IAAI,EAAEC;CAAS,CAAC,CAAmB,EAAAO,4BAAA,CAAAL,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAXpCK,4BAA4B,GAAA3O,UAAA,CAAA,CADxCC,aAAa,CAAC,0BAA0B,CAAC,CAC7B,EAAA0O,4BAA4B,CAuDxC;;;;"}
|
package/dist/bottom-sheet.min.js
CHANGED
|
@@ -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 d,InertController as c,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 E,html as S,css as H,unsafeCSS as M}from"lit";import{property as _}from"lit/decorators.js";import{M3eInteractivityChecker as z,isModifierAllowed as W,addAriaReferencedId as L,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,U,I,N,j,K,V,X,G,J,O,Q,Z,tt,et,it,ot,st,nt,at,ht,lt,rt,dt,ct,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 d(this)),R.set(this,new c(this)),T.set(this,new m(this,{target:null,skipInitial:!0,callback:t=>e(this,F,"m",ft).call(this,t)})),U.set(this,null),I.set(this,void 0),N.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}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,U,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,U,"f")instanceof HTMLElement&&e(this,U,"f").focus(),i(this,U,null,"f")});this.dispatchEvent(new Event(this.open?"opened":"closed"))}}render(){return S`<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?S`<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>`:E}<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,U=new WeakMap,I=new WeakMap,N=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){t.target instanceof HTMLElement&&z.isFocusable(t.target)||(t.target.setPointerCapture(t.pointerId),t.target.style.cursor="grabbing",e(this,P,"f").reset(),e(this,P,"f").add(t.clientY),i(this,I,{startY:t.clientY,startHeight:this.clientHeight,maxHeight:e(this,F,"m",dt).call(this),minHeight:e(this,F,"m",ct).call(this)},"f"),i(this,N,!1,"f"))},Z=function(t){if(!e(this,I,"f"))return;if(Math.abs(t.clientY-e(this,I,"f").startY)<=8)return;(t.getCoalescedEvents?.()??[t]).forEach(i=>e(this,P,"f").add(i.clientY,t.timeStamp));let o=e(this,I,"f").startHeight-(t.clientY-e(this,I,"f").startY);if(o<e(this,I,"f").minHeight){const t=(e(this,I,"f").minHeight-o)*this.hideFriction;o=e(this,I,"f").minHeight-t}e(this,F,"m",gt).call(this,Math.min(e(this,I,"f").maxHeight,o)),i(this,N,!0,"f")},tt=function(t){if(e(this,I,"f"))try{if(t.target.releasePointerCapture(t.pointerId),t.target.style.cursor="",!e(this,N,"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,I,"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,I,"f").minHeight&&e(this,F,"m",bt).call(this,e(this,I,"f").minHeight)}}finally{i(this,I,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",dt).call(this);(b(this,"-full")||this.clientHeight>t)&&e(this,F,"m",gt).call(this,t)},st=function(){e(this,N,"f")||this.cycle(),i(this,N,!1,"f")},nt=function(t){if(!t.defaultPrevented&&W(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",ct).call(this);case"half":return.5*e(this,F,"m",dt).call(this);case"full":return e(this,F,"m",dt).call(this);case"fit":return e(this,F,"m",pt).call(this)}return t.endsWith("%")?e(this,F,"m",dt).call(this)*(parseFloat(t)/100):t.endsWith("px")?parseFloat(t):e(this,F,"m",ct).call(this)},dt=function(){const t=this.shadowRoot?.querySelector(".base");return window.innerHeight-(t?g(t,"var(--_bottom-sheet-top-space)"):0)},ct=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",ct).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",dt).call(this));const i=this.shadowRoot?.querySelector(".content");i&&(i.inert=t<=e(this,F,"m",mt).call(this))},y(H`@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=H`: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: ${M(`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: ${M(`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: ${M(`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: ${M(`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),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",L(this.parentElement,"aria-controls",t.id),this.parentElement.id&&L(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,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};
|
|
7
7
|
//# sourceMappingURL=bottom-sheet.min.js.map
|