@m3e/web 2.5.12 → 2.5.13
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/dist/all.js +20442 -16034
- package/dist/all.js.map +1 -1
- package/dist/all.min.js +174 -62
- package/dist/all.min.js.map +1 -1
- package/dist/calendar.js +45 -9
- package/dist/calendar.js.map +1 -1
- package/dist/calendar.min.js +5 -5
- package/dist/calendar.min.js.map +1 -1
- package/dist/core-anchoring.js +19 -16
- package/dist/core-anchoring.js.map +1 -1
- package/dist/core-anchoring.min.js +1 -1
- package/dist/core-anchoring.min.js.map +1 -1
- package/dist/core.js +95 -82
- 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 +50 -50
- package/dist/custom-elements.json +1209 -583
- package/dist/datepicker.js +53 -27
- package/dist/datepicker.js.map +1 -1
- package/dist/datepicker.min.js +1 -1
- package/dist/datepicker.min.js.map +1 -1
- package/dist/fab-menu.js +115 -113
- package/dist/fab-menu.js.map +1 -1
- package/dist/fab-menu.min.js +1 -1
- package/dist/fab-menu.min.js.map +1 -1
- package/dist/form-field.js +9 -6
- package/dist/form-field.js.map +1 -1
- package/dist/form-field.min.js +1 -1
- package/dist/form-field.min.js.map +1 -1
- package/dist/html-custom-data.json +29 -14
- package/dist/icon.js +1 -1
- package/dist/icon.js.map +1 -1
- package/dist/icon.min.js +1 -1
- package/dist/icon.min.js.map +1 -1
- package/dist/menu.js +26 -19
- package/dist/menu.js.map +1 -1
- package/dist/menu.min.js +1 -1
- package/dist/menu.min.js.map +1 -1
- package/dist/src/calendar/CalendarElement.d.ts +2 -0
- package/dist/src/calendar/CalendarElement.d.ts.map +1 -1
- package/dist/src/calendar/CalendarViewElementBase.d.ts +2 -0
- package/dist/src/calendar/CalendarViewElementBase.d.ts.map +1 -1
- package/dist/src/calendar/MonthViewElement.d.ts +1 -0
- package/dist/src/calendar/MonthViewElement.d.ts.map +1 -1
- package/dist/src/calendar/MultiYearViewElement.d.ts.map +1 -1
- package/dist/src/calendar/YearViewElement.d.ts.map +1 -1
- package/dist/src/core/anchoring/FloatingPanelElement.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/ClickOutsideController.d.ts +24 -0
- package/dist/src/core/shared/controllers/ClickOutsideController.d.ts.map +1 -0
- package/dist/src/core/shared/controllers/FocusController.d.ts +5 -11
- package/dist/src/core/shared/controllers/FocusController.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/HoverController.d.ts +2 -8
- package/dist/src/core/shared/controllers/HoverController.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/IntersectionController.d.ts +2 -8
- package/dist/src/core/shared/controllers/IntersectionController.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/LongPressController.d.ts +2 -8
- package/dist/src/core/shared/controllers/LongPressController.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/MonitorControllerBase.d.ts +4 -0
- package/dist/src/core/shared/controllers/MonitorControllerBase.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/PressedController.d.ts +6 -8
- package/dist/src/core/shared/controllers/PressedController.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/ResizeController.d.ts +2 -8
- package/dist/src/core/shared/controllers/ResizeController.d.ts.map +1 -1
- package/dist/src/core/shared/controllers/index.d.ts +1 -0
- package/dist/src/core/shared/controllers/index.d.ts.map +1 -1
- package/dist/src/datepicker/DatepickerElement.d.ts +1 -2
- package/dist/src/datepicker/DatepickerElement.d.ts.map +1 -1
- package/dist/src/fab-menu/FabMenuElement.d.ts.map +1 -1
- package/dist/src/form-field/FormFieldElement.d.ts +1 -0
- package/dist/src/form-field/FormFieldElement.d.ts.map +1 -1
- package/dist/src/menu/MenuElement.d.ts.map +1 -1
- package/dist/src/tooltip/RichTooltipElement.d.ts +0 -2
- package/dist/src/tooltip/RichTooltipElement.d.ts.map +1 -1
- package/dist/tooltip.js +24 -25
- 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 +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datepicker.min.js","sources":["../../src/datepicker/DatepickerElement.ts","../../src/datepicker/DatepickerToggleElement.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, nothing, PropertyValues, unsafeCSS } from \"lit\";\r\nimport { property, query, state } from \"lit/decorators.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport {\r\n addCustomState,\r\n customElement,\r\n AttachInternals,\r\n dateConverter,\r\n deleteCustomState,\r\n DesignToken,\r\n Role,\r\n ScrollLockController,\r\n setCustomState,\r\n SuppressInitialAnimation,\r\n InertController,\r\n ReconnectedCallback,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { positionAnchor } from \"@m3e/web/core/anchoring\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\nimport { Breakpoint, M3eBreakpointObserver } from \"@m3e/web/core/layout\";\r\nimport { M3eCalendarElement, CalendarView } from \"@m3e/web/calendar\";\r\n\r\nimport \"@m3e/web/core/a11y\";\r\nimport \"@m3e/web/button\";\r\nimport \"@m3e/web/calendar\";\r\n\r\nimport { DatepickerVariant } from \"./DatepickerVariant\";\r\n\r\n/**\r\n * Presents a date picker on a temporary surface.\r\n *\r\n * @description\r\n * The `m3e-datepicker` component provides a date‑selection experience\r\n * consistent with Material 3 guidance for layout, motion, and accessibility.\r\n * It displays a temporary surface that allows users to select a date or date\r\n * range using calendar-based views. The picker supports month, year, and\r\n * multi‑year views, enabling users to navigate across time efficiently.\r\n *\r\n * While open, the picker uses a focused selection flow. Users review their\r\n * choice and complete the interaction through confirm, dismiss, or clear\r\n * actions, ensuring intentional updates to the field or control that invoked it.\r\n *\r\n * It accepts and emits plain `Date` values, allowing applications to apply their\r\n * own formatting, parsing, and localization.\r\n *\r\n * @tag m3e-datepicker\r\n *\r\n * @attr variant - The appearance variant of the picker.\r\n * @attr clearable - Whether the user can clear the selected date and close the picker.\r\n * @attr date - The selected date.\r\n * @attr max-date - The maximum date that can be selected.\r\n * @attr min-date - The minimum date that can be selected.\r\n * @attr range - Whether a range of dates can be selected.\r\n * @attr range-end - End of a date range.\r\n * @attr range-start - Start of a date range.\r\n * @attr start-at - A date specifying the period (month or year) to start the calendar in.\r\n * @attr start-view - The initial view used to select a date.\r\n * @attr previous-month-label - The accessible label given to the button used to move to the previous month.\r\n * @attr next-month-label - The accessible label given to the button used to move to the next month.\r\n * @attr previous-year-label - The accessible label given to the button used to move to the previous year.\r\n * @attr next-year-label - The accessible label given to the button used to move to the next year.\r\n * @attr previous-multi-year-label - The accessible label given to the button used to move to the previous 24 years.\r\n * @attr next-multi-year-label - The accessible label given to the button used to move to the next 24 years.\r\n * @attr clear-label - The label given to the button used clear the selected date and close the picker.\r\n * @attr confirm-label - The label given to the button used apply the selected date and close the picker.\r\n * @attr dismiss-label - The label given to the button used discard the selected date and close the picker.\r\n * @attr label - The label given to the the picker.\r\n *\r\n * @fires change - Dispatched when the selected date changes.\r\n * @fires beforetoggle - Dispatched before the toggle state changes.\r\n * @fires toggle - Dispatched after the toggle state has changed.\r\n *\r\n * @cssprop --m3e-datepicker-container-padding-block - Block‑axis padding of the date picker container.\r\n * @cssprop --m3e-datepicker-container-padding-inline - Inline‑axis padding of the date picker container.\r\n * @cssprop --m3e-datepicker-container-color - Background color of the standard container surface.\r\n * @cssprop --m3e-datepicker-container-elevation - Elevation shadow applied to the container surface.\r\n * @cssprop --m3e-datepicker-modal-headline-color - Color used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-headline-font-size - Font size used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-headline-font-weight - Font weight used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-headline-line-height - Line height used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-headline-tracking - Letter spacing used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-color - Color used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-font-size - Font size used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-font-weight - Font weight used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-line-height - Line height used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-tracking - Letter spacing used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-actions-padding-inline - Inline‑axis padding of the action row.\r\n * @cssprop --m3e-datepicker-docked-container-color - Background color of the container in docked mode.\r\n * @cssprop --m3e-datepicker-docked-container-shape - Corner radius of the container in docked mode.\r\n * @cssprop --m3e-datepicker-modal-container-color - Background color of the container in modal mode.\r\n * @cssprop --m3e-datepicker-modal-container-shape - Corner radius of the container in modal mode.\r\n * @cssprop --m3e-divider-thickness - Thickness of divider elements within the picker.\r\n * @cssprop --m3e-divider-color - Color of divider rules within the picker.\r\n * @cssprop --m3e-dialog-scrim-color - Base color used for the modal scrim behind the picker.\r\n * @cssprop --m3e-dialog-scrim-opacity - Opacity applied to the scrim color in modal mode.\r\n */\r\n@customElement(\"m3e-datepicker\")\r\nexport class M3eDatepickerElement extends SuppressInitialAnimation(\r\n ReconnectedCallback(AttachInternals(Role(LitElement, \"dialog\"))),\r\n) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n flex-direction: column;\r\n margin: unset;\r\n border: unset;\r\n padding-block: var(--m3e-datepicker-container-padding-block, 0.75rem);\r\n padding-inline: var(--m3e-datepicker-container-padding-inline, 0.25rem);\r\n background-color: var(--m3e-datepicker-container-color, ${DesignToken.color.surfaceContainer});\r\n box-shadow: var(--m3e-datepicker-container-elevation, ${DesignToken.elevation.level3});\r\n opacity: 0;\r\n display: none;\r\n }\r\n .calendar {\r\n --m3e-calendar-container-color: transparent;\r\n --m3e-calendar-container-elevation: ${DesignToken.elevation.level0};\r\n --m3e-calendar-container-shape: ${DesignToken.shape.corner.none};\r\n }\r\n .headline {\r\n color: var(--m3e-datepicker-modal-headline-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(\r\n --m3e-datepicker-modal-headline-font-size,\r\n ${DesignToken.typescale.standard.headline.large.fontSize}\r\n );\r\n font-weight: var(\r\n --m3e-datepicker-modal-headline-font-weight,\r\n ${DesignToken.typescale.standard.headline.large.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-datepicker-modal-headline-line-height,\r\n ${DesignToken.typescale.standard.headline.large.lineHeight}\r\n );\r\n letter-spacing: var(\r\n --m3e-datepicker-modal-headline-tracking,\r\n ${DesignToken.typescale.standard.headline.large.tracking}\r\n );\r\n margin-block-start: 2.25rem;\r\n margin-block-end: 0.75rem;\r\n margin-inline: 1.5rem;\r\n }\r\n .supporting-text {\r\n color: var(--m3e-datepicker-modal-supporting-text-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(\r\n --m3e-datepicker-modal-supporting-text-font-size,\r\n ${DesignToken.typescale.standard.label.large.fontSize}\r\n );\r\n font-weight: var(\r\n --m3e-datepicker-modal-supporting-text-font-weight,\r\n ${DesignToken.typescale.standard.label.large.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-datepicker-modal-supporting-text-line-height,\r\n ${DesignToken.typescale.standard.label.large.lineHeight}\r\n );\r\n letter-spacing: var(\r\n --m3e-datepicker-modal-supporting-text-tracking,\r\n ${DesignToken.typescale.standard.label.large.tracking}\r\n );\r\n margin-block-start: 1rem;\r\n margin-inline: 1.5rem;\r\n }\r\n .divider {\r\n height: var(--m3e-divider-thickness, 1px);\r\n width: 100%;\r\n position: relative;\r\n }\r\n .divider::before {\r\n content: \"\";\r\n box-sizing: border-box;\r\n position: absolute;\r\n border-bottom: var(--m3e-divider-thickness, 1px) solid\r\n var(--m3e-divider-color, ${DesignToken.color.outlineVariant});\r\n height: inherit;\r\n left: -0.25rem;\r\n right: -0.25rem;\r\n }\r\n .actions {\r\n display: flex;\r\n align-items: center;\r\n column-gap: 0.5rem;\r\n padding-inline: var(--m3e-datepicker-actions-padding-inline, 0.5rem);\r\n }\r\n .spacer {\r\n flex: 1 1 auto;\r\n }\r\n :host(:is(:state(--docked), :--docked)) {\r\n position: absolute;\r\n background-color: var(--m3e-datepicker-docked-container-color, ${DesignToken.color.surfaceContainer});\r\n border-radius: var(--m3e-datepicker-docked-container-shape, ${DesignToken.shape.corner.large});\r\n }\r\n :host(:is(:state(--modal), :--modal)) {\r\n position: fixed;\r\n inset: 0;\r\n margin: auto;\r\n transform-origin: top;\r\n background-color: var(--m3e-datepicker-modal-container-color, ${DesignToken.color.surfaceContainerHigh});\r\n border-radius: var(--m3e-datepicker-modal-container-shape, ${DesignToken.shape.corner.extraLarge});\r\n }\r\n :host(:not(:is(:state(--no-animate), :--no-animate))) {\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard}, \r\n transform ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard},\r\n overlay ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n display ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host {\r\n transform: scaleY(0.8);\r\n }\r\n :host(:popover-open) {\r\n transform: scaleY(1);\r\n display: inline-flex;\r\n opacity: 1;\r\n }\r\n :host(:is(:state(--docked), :--docked))::backdrop {\r\n background-color: transparent;\r\n }\r\n :host(:is(:state(--modal), :--modal))::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n margin-inline-end: -20px;\r\n }\r\n :host(:is(:state(--modal), :--modal):not(:popover-open))::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host(:is(:state(--modal), :--modal):popover-open)::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%),\r\n transparent\r\n );\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host(:is(:state(--bottom), :--bottom)) {\r\n transform-origin: top;\r\n }\r\n :host(:is(:state(--top), :--top)) {\r\n transform-origin: bottom;\r\n }\r\n @starting-style {\r\n :host(:popover-open) {\r\n transform: scaleY(0.8);\r\n }\r\n :host(:is(:state(--modal), :--modal):popover-open)::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n :host(:not(:is(:state(--no-animate), :--no-animate))) {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n :host {\r\n background-color: Menu;\r\n color: MenuText;\r\n border: 1px solid CanvasText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ @state() private _date?: Date | null;\r\n /** @private */ @state() private _rangeStart?: Date | null;\r\n /** @private */ @state() private _rangeEnd?: Date | null;\r\n\r\n /** @private */ @query(\"m3e-calendar\") private readonly _calendar!: M3eCalendarElement;\r\n /** @private */ @state() private _variant?: Exclude<DatepickerVariant, \"auto\">;\r\n /** @private */ #breakpointUnobserve?: () => void;\r\n\r\n /** @private */ #trigger?: HTMLElement;\r\n /** @private */ #anchor?: HTMLElement;\r\n /** @private */ #anchorCleanup?: () => void;\r\n\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n /** @private */ readonly #inertController = new InertController(this);\r\n /** @private */ readonly #documentClickHandler = (e: MouseEvent) => this.#handleDocumentClick(e);\r\n /** @private */ readonly #documentKeyDownHandler = (e: KeyboardEvent) => this.#handleDocumentKeyDown(e);\r\n\r\n /** @private */\r\n readonly #toggleHandler = (e: ToggleEvent) => {\r\n if (e.newState === \"closed\") {\r\n this.#clearSelectionState();\r\n this.#anchorCleanup?.();\r\n this.#anchorCleanup = undefined;\r\n }\r\n };\r\n\r\n /**\r\n * The appearance variant of the picker.\r\n * @default \"docked\"\r\n */\r\n @property() variant: DatepickerVariant = \"docked\";\r\n\r\n /**\r\n * The initial view used to select a date.\r\n * @default \"month\"\r\n */\r\n @property({ attribute: \"start-view\" }) startView: CalendarView = \"month\";\r\n\r\n /**\r\n * The selected date.\r\n * @default null\r\n */\r\n @property({ converter: dateConverter }) date: Date | null = null;\r\n\r\n /**\r\n * A date specifying the period (month or year) to start the calendar in.\r\n * @default null\r\n */\r\n @property({ attribute: \"start-at\", converter: dateConverter }) startAt: Date | null = null;\r\n\r\n /**\r\n * The minimum date that can be selected.\r\n * @default null\r\n */\r\n @property({ attribute: \"min-date\", converter: dateConverter }) minDate: Date | null = null;\r\n\r\n /**\r\n * The maximum date that can be selected.\r\n * @default null\r\n */\r\n @property({ attribute: \"max-date\", converter: dateConverter }) maxDate: Date | null = null;\r\n\r\n /**\r\n * Whether a range of dates can be selected.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) range = false;\r\n\r\n /**\r\n * Start of a date range.\r\n * @default null\r\n */\r\n @property({ attribute: \"range-start\", converter: dateConverter }) rangeStart: Date | null = null;\r\n\r\n /**\r\n * End of a date range.\r\n * @default null\r\n */\r\n @property({ attribute: \"range-end\", converter: dateConverter }) rangeEnd: Date | null = null;\r\n\r\n /**\r\n * A function used to determine whether a date cannot be selected.\r\n * @default null\r\n */\r\n @property({ attribute: false }) blackoutDates: ((date: Date) => boolean) | null = null;\r\n\r\n /**\r\n * A function used to determine whether a date is special.\r\n * @default null\r\n */\r\n @property({ attribute: false }) specialDates: ((date: Date) => boolean) | null = null;\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous month.\r\n * @default \"Previous month\"\r\n */\r\n @property({ attribute: \"previous-month-label\" }) previousMonthLabel = \"Previous month\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous year.\r\n * @default \"Previous year\"\r\n */\r\n @property({ attribute: \"previous-year-label\" }) previousYearLabel = \"Previous year\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous 24 years.\r\n * @default \"Previous 24 years\"\r\n */\r\n @property({ attribute: \"previous-multi-year-label\" }) previousMultiYearLabel = \"Previous 24 years\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next month.\r\n * @default \"Next month\"\r\n */\r\n @property({ attribute: \"next-month-label\" }) nextMonthLabel = \"Next month\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next year.\r\n * @default \"Next year\"\r\n */\r\n @property({ attribute: \"next-year-label\" }) nextYearLabel = \"Next year\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next 24 years.\r\n * @default \"Next 24 years\"\r\n */\r\n @property({ attribute: \"next-multi-year-label\" }) nextMultiYearLabel = \"Next 24 years\";\r\n\r\n /**\r\n * Whether the user can clear the selected date and close the picker.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) clearable = false;\r\n\r\n /**\r\n * The label given to the button used clear the selected date and close the picker.\r\n * @default \"Clear\"\r\n */\r\n @property({ attribute: \"clear-label\" }) clearLabel = \"Clear\";\r\n\r\n /**\r\n * The label given to the button used apply the selected date and close the picker.\r\n * @default \"OK\"\r\n */\r\n @property({ attribute: \"confirm-label\" }) confirmLabel = \"OK\";\r\n\r\n /**\r\n * The label given to the button used discard the selected date and close the picker.\r\n * @default \"Cancel\"\r\n */\r\n @property({ attribute: \"dismiss-label\" }) dismissLabel = \"Cancel\";\r\n\r\n /**\r\n * The label given to the the picker.\r\n * @default \"Select date\"\r\n */\r\n @property() label = \"Select date\";\r\n\r\n /** Whether the picker is open. */\r\n get isOpen() {\r\n return this.#trigger !== undefined;\r\n }\r\n\r\n /** The current variant applied to the picker. */\r\n get currentVariant(): Exclude<DatepickerVariant, \"auto\"> {\r\n return this._variant ?? (this.variant !== \"modal\" ? \"docked\" : \"modal\");\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n\r\n this.setAttribute(\"popover\", \"manual\");\r\n this.addEventListener(\"toggle\", this.#toggleHandler);\r\n document.addEventListener(\"click\", this.#documentClickHandler);\r\n document.addEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n this._variant = undefined;\r\n this.#breakpointUnobserve?.();\r\n\r\n this.#clearAnchoring();\r\n\r\n deleteCustomState(this, \"--docked\");\r\n deleteCustomState(this, \"--modal\");\r\n\r\n this.removeEventListener(\"toggle\", this.#toggleHandler);\r\n document.removeEventListener(\"click\", this.#documentClickHandler);\r\n document.removeEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n\r\n if (this.variant === \"auto\") {\r\n this.#initBreakpointMonitoring();\r\n }\r\n }\r\n\r\n /**\r\n * Opens the picker.\r\n * @param {HTMLElement} trigger The element that triggered the picker.\r\n * @param {HTMLElement | undefined} anchor The element used to position the picker.\r\n * @returns {Promise<void>} A `Promise` that resolves when the picker is opened.\r\n */\r\n async show(trigger: HTMLElement, anchor?: HTMLElement): Promise<void> {\r\n if (this.#trigger && this.#trigger !== trigger) {\r\n this.hide();\r\n }\r\n\r\n if (this.currentVariant === \"modal\") {\r\n this.#scrollLockController.lock();\r\n this.#inertController.lock();\r\n }\r\n\r\n const calendar = this._calendar;\r\n\r\n calendar.date = this.date;\r\n calendar.rangeStart = this.rangeStart;\r\n calendar.rangeEnd = this.rangeEnd;\r\n\r\n // Reset the start-view\r\n calendar.requestUpdate(\"startView\");\r\n if (calendar.isUpdatePending) {\r\n await calendar.updateComplete;\r\n }\r\n\r\n this.#trigger = trigger;\r\n this.#trigger.ariaExpanded = \"true\";\r\n this.#anchor = anchor;\r\n\r\n await this.#updatePosition();\r\n this.showPopover();\r\n\r\n await this._calendar.focusActiveCell();\r\n }\r\n\r\n /**\r\n * Hides the picker.\r\n * @param {boolean} [restoreFocus=false] Whether to restore focus to the picker's trigger.\r\n */\r\n hide(restoreFocus: boolean = false): void {\r\n if (this.currentVariant === \"modal\") {\r\n this.#scrollLockController.unlock();\r\n this.#inertController.unlock();\r\n }\r\n\r\n this.hidePopover();\r\n\r\n if (this.#trigger) {\r\n this.#trigger.ariaExpanded = \"false\";\r\n if (restoreFocus) {\r\n this.#trigger.focus();\r\n }\r\n this.#trigger = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Toggles the picker.\r\n * @param {HTMLElement} trigger The element that triggered the picker.\r\n * @param {HTMLElement | undefined} anchor The element used to position the picker.\r\n * @returns {Promise<void>} A `Promise` that resolves when the picker is opened or closed.\r\n */\r\n async toggle(trigger: HTMLElement, anchor?: HTMLElement): Promise<void> {\r\n if (this.#trigger) {\r\n this.hide();\r\n } else {\r\n await this.show(trigger, anchor);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<m3e-focus-trap>\r\n ${this.#renderHeader()}\r\n <m3e-calendar\r\n class=\"calendar\"\r\n start-view=\"${this.startView}\"\r\n start-at=\"${ifDefined(this.startAt?.toISOString())}\"\r\n min-date=\"${ifDefined(this.minDate?.toISOString())}\"\r\n max-date=\"${ifDefined(this.maxDate?.toISOString())}\"\r\n @change=\"${this.#handleCalendarChange}\"\r\n ></m3e-calendar>\r\n <div class=\"actions\">\r\n ${this.clearable\r\n ? html`<m3e-button @click=\"${this.#handleClearClick}\">${this.clearLabel}</m3e-button>`\r\n : nothing}\r\n <div class=\"spacer\" aria-hidden=\"true\"></div>\r\n <m3e-button @click=\"${this.#handleDismissClick}\">${this.dismissLabel}</m3e-button>\r\n <m3e-button @click=\"${this.#handleConfirmClick}\">${this.confirmLabel}</m3e-button>\r\n </div>\r\n </m3e-focus-trap>`;\r\n }\r\n\r\n /** @inheritdoc */\r\n #renderHeader(): unknown {\r\n if (this.currentVariant === \"docked\") return nothing;\r\n\r\n const rangeStart = this._rangeStart ?? this.rangeStart;\r\n const rangeEnd = this._rangeStart ? this._rangeEnd : (this._rangeEnd ?? this.rangeEnd);\r\n const selectedDate = this._date ?? this.date;\r\n\r\n return html`<div class=\"supporting-text\">${this.label}</div>\r\n ${rangeStart\r\n ? html`<div class=\"headline\">\r\n ${new Intl.DateTimeFormat(navigator.language, {\r\n month: \"short\",\r\n day: \"numeric\",\r\n }).format(rangeStart) +\r\n \" – \" +\r\n (rangeEnd\r\n ? new Intl.DateTimeFormat(navigator.language, {\r\n month: \"short\",\r\n day: \"numeric\",\r\n }).format(rangeEnd)\r\n : \"\")}\r\n </div>`\r\n : html`<div class=\"headline\">\r\n ${selectedDate\r\n ? new Intl.DateTimeFormat(navigator.language, {\r\n weekday: \"short\",\r\n month: \"short\",\r\n day: \"numeric\",\r\n }).format(selectedDate)\r\n : \"––\"}\r\n </div>`}\r\n <div class=\"divider\"></div>`;\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\r\n super.willUpdate(changedProperties);\r\n\r\n if ([\"date\", \"rangeStart\", \"rangeEnd\"].some((x) => changedProperties.has(<keyof M3eDatepickerElement>x))) {\r\n this.#clearSelectionState();\r\n }\r\n if (changedProperties.has(\"rangeStart\") && this.rangeStart) {\r\n this.range = true;\r\n }\r\n if (changedProperties.has(\"rangeStart\") && this.rangeStart && !changedProperties.has(\"date\")) {\r\n this.date = new Date(this.rangeStart);\r\n }\r\n if (changedProperties.has(\"rangeEnd\") && this.rangeEnd && !changedProperties.has(\"date\")) {\r\n this.date = new Date(this.rangeEnd);\r\n }\r\n if (changedProperties.has(\"variant\")) {\r\n this.#breakpointUnobserve?.();\r\n\r\n if (this.variant === \"auto\") {\r\n this.#initBreakpointMonitoring();\r\n } else {\r\n this._variant = undefined;\r\n this.#updateVariant();\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues<this>): void {\r\n super.updated(_changedProperties);\r\n\r\n if (_changedProperties.has(\"specialDates\") || _changedProperties.has(\"blackoutDates\")) {\r\n this._calendar.specialDates = this.specialDates;\r\n this._calendar.blackoutDates = this.blackoutDates;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDocumentClick(e: MouseEvent): void {\r\n if (!e.composedPath().some((x) => x instanceof M3eDatepickerElement || x === this.#trigger || x === this.#anchor)) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleCalendarChange(): void {\r\n this._date = this._calendar.date;\r\n this._rangeStart = this._calendar.rangeStart;\r\n this._rangeEnd = this._calendar.rangeEnd;\r\n\r\n if (this.range && !this._rangeStart && this._date) {\r\n this._rangeStart = new Date(this._date);\r\n this._calendar.rangeStart = this._rangeStart;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleClearClick(): void {\r\n this.date = null;\r\n this.rangeStart = null;\r\n this.rangeEnd = null;\r\n\r\n this.hide(true);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @private */\r\n #handleDismissClick(): void {\r\n this.hide(true);\r\n }\r\n\r\n /** @private */\r\n #handleConfirmClick(): void {\r\n this.date = this._date ?? this.date;\r\n this.rangeStart = this._rangeStart === undefined ? this.rangeStart : this._rangeStart;\r\n this.rangeEnd = this._rangeEnd === undefined ? this.rangeEnd : this._rangeEnd;\r\n this.hide(true);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @private */\r\n #handleDocumentKeyDown(e: KeyboardEvent): void {\r\n if (this.isOpen && this.currentVariant === \"modal\" && e.key === \"Escape\" && !e.shiftKey && !e.ctrlKey) {\r\n e.preventDefault();\r\n this.hide(true);\r\n }\r\n }\r\n\r\n /** @private */\r\n #initBreakpointMonitoring(): void {\r\n this.#breakpointUnobserve = M3eBreakpointObserver.observe([Breakpoint.XSmall, Breakpoint.Small], (matches) => {\r\n this._variant = matches.get(Breakpoint.XSmall) || matches.get(Breakpoint.Small) ? \"modal\" : \"docked\";\r\n this.#updateVariant();\r\n });\r\n }\r\n\r\n /** @private */\r\n #updateVariant(): void {\r\n switch (this.currentVariant) {\r\n case \"docked\":\r\n this.ariaModal = null;\r\n deleteCustomState(this, \"--modal\");\r\n addCustomState(this, \"--docked\");\r\n this.#scrollLockController.unlock();\r\n this.#inertController.unlock();\r\n break;\r\n\r\n case \"modal\":\r\n this.ariaModal = \"true\";\r\n deleteCustomState(this, \"--docked\");\r\n addCustomState(this, \"--modal\");\r\n if (this.isOpen) {\r\n this.#scrollLockController.lock();\r\n this.#inertController.lock();\r\n }\r\n\r\n break;\r\n }\r\n\r\n if (this.isOpen) {\r\n this.#updatePosition();\r\n }\r\n }\r\n\r\n /** @private */\r\n async #updatePosition(): Promise<void> {\r\n if (this.currentVariant === \"docked\" && this.#trigger) {\r\n this.#anchorCleanup?.();\r\n this.#anchorCleanup = await positionAnchor(\r\n this,\r\n this.#anchor ?? this.#trigger,\r\n {\r\n position: \"bottom-start\",\r\n inline: true,\r\n flip: true,\r\n shift: \"both\",\r\n },\r\n (x, y, position) => {\r\n setCustomState(this, \"--top\", position.includes(\"top\"));\r\n setCustomState(this, \"--bottom\", position.includes(\"bottom\"));\r\n\r\n if (M3eDirectionality.current === \"rtl\") {\r\n this.style.right = `${window.innerWidth - x - this.clientWidth}px`;\r\n this.style.left = \"\";\r\n } else {\r\n this.style.left = `${x}px`;\r\n this.style.right = \"\";\r\n }\r\n\r\n this.style.top = `${y}px`;\r\n },\r\n );\r\n } else {\r\n this.#clearAnchoring();\r\n }\r\n }\r\n\r\n /** @private */\r\n #clearAnchoring(): void {\r\n this.#anchorCleanup?.();\r\n this.#anchorCleanup = undefined;\r\n this.style.left = \"\";\r\n this.style.right = \"\";\r\n this.style.top = \"\";\r\n }\r\n\r\n /** @private */\r\n #clearSelectionState(): void {\r\n this._date = this._rangeStart = this._rangeEnd = undefined;\r\n }\r\n}\r\n\r\ninterface M3eDatepickerElementEventMap extends HTMLElementEventMap {\r\n beforetoggle: ToggleEvent;\r\n toggle: ToggleEvent;\r\n}\r\n\r\nexport interface M3eDatepickerElement {\r\n addEventListener<K extends keyof M3eDatepickerElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDatepickerElement, ev: M3eDatepickerElementEventMap[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 M3eDatepickerElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDatepickerElement, ev: M3eDatepickerElementEventMap[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-datepicker\": M3eDatepickerElement;\r\n }\r\n}\r\n","import { customElement, ActionElementBase, HtmlFor } from \"@m3e/web/core\";\r\nimport type { M3eFormFieldElement } from \"@m3e/web/form-field\";\r\n\r\nimport { M3eDatepickerElement } from \"./DatepickerElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to toggle a datepicker.\r\n * @tag m3e-datepicker-toggle\r\n */\r\n@customElement(\"m3e-datepicker-toggle\")\r\nexport class M3eDatepickerToggleElement extends HtmlFor(ActionElementBase) {\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override _onClick(): void {\r\n if (this.control instanceof M3eDatepickerElement && this.parentElement) {\r\n this.control.toggle(this.parentElement, this.closest<M3eFormFieldElement>(\"m3e-form-field\") ?? undefined);\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-datepicker-toggle\": M3eDatepickerToggleElement;\r\n }\r\n}\r\n"],"names":["M3eDatepickerElement","M3eDatepickerElement_1","SuppressInitialAnimation","ReconnectedCallback","AttachInternals","Role","LitElement","constructor","_M3eDatepickerElement_breakpointUnobserve","set","this","_M3eDatepickerElement_trigger","_M3eDatepickerElement_anchor","_M3eDatepickerElement_anchorCleanup","_M3eDatepickerElement_scrollLockController","ScrollLockController","_M3eDatepickerElement_inertController","InertController","_M3eDatepickerElement_documentClickHandler","e","__classPrivateFieldGet","call","_M3eDatepickerElement_documentKeyDownHandler","_M3eDatepickerElement_toggleHandler","newState","_M3eDatepickerElement_instances","_M3eDatepickerElement_clearSelectionState","__classPrivateFieldSet","undefined","variant","startView","date","startAt","minDate","maxDate","range","rangeStart","rangeEnd","blackoutDates","specialDates","previousMonthLabel","previousYearLabel","previousMultiYearLabel","nextMonthLabel","nextYearLabel","nextMultiYearLabel","clearable","clearLabel","confirmLabel","dismissLabel","label","isOpen","currentVariant","_variant","connectedCallback","super","setAttribute","addEventListener","document","disconnectedCallback","_M3eDatepickerElement_clearAnchoring","deleteCustomState","removeEventListener","reconnectedCallback","_M3eDatepickerElement_initBreakpointMonitoring","show","trigger","anchor","hide","lock","calendar","_calendar","requestUpdate","isUpdatePending","updateComplete","ariaExpanded","_M3eDatepickerElement_updatePosition","showPopover","focusActiveCell","restoreFocus","unlock","hidePopover","focus","toggle","render","html","_M3eDatepickerElement_renderHeader","ifDefined","toISOString","_M3eDatepickerElement_handleCalendarChange","_M3eDatepickerElement_handleClearClick","nothing","_M3eDatepickerElement_handleDismissClick","_M3eDatepickerElement_handleConfirmClick","willUpdate","changedProperties","some","x","has","Date","_M3eDatepickerElement_updateVariant","updated","_changedProperties","_rangeStart","_rangeEnd","selectedDate","_date","Intl","DateTimeFormat","navigator","language","month","day","format","weekday","composedPath","dispatchEvent","Event","bubbles","key","shiftKey","ctrlKey","preventDefault","M3eBreakpointObserver","observe","Breakpoint","XSmall","Small","matches","get","ariaModal","addCustomState","async","positionAnchor","position","inline","flip","shift","y","setCustomState","includes","M3eDirectionality","current","style","right","window","innerWidth","clientWidth","left","top","styles","css","DesignToken","color","surfaceContainer","elevation","level3","level0","shape","corner","none","onSurfaceVariant","typescale","standard","headline","large","fontSize","fontWeight","lineHeight","tracking","outlineVariant","surfaceContainerHigh","extraLarge","unsafeCSS","motion","duration","short2","easing","scrim","short3","long2","__decorate","state","prototype","query","property","attribute","converter","dateConverter","type","Boolean","customElement","M3eDatepickerToggleElement","HtmlFor","ActionElementBase","parentElement","ariaHasPopup","_onClick","control","closest"],"mappings":";;;;;65BAoGO,IAAMA,EAAoBC,EAA1B,cAAmCC,EACxCC,EAAoBC,EAAgBC,EAAKC,EAAY,cADhDC,WAAAA,mCAiLWC,EAAAC,IAAAC,aAEAC,EAAAF,IAAAC,aACAE,EAAAH,IAAAC,aACAG,EAAAJ,IAAAC,aAESI,EAAAL,IAAAC,KAAwB,IAAIK,EAAqBL,OACjDM,EAAAP,IAAAC,KAAmB,IAAIO,EAAgBP,OACvCQ,EAAAT,IAAAC,KAAyBS,GAAkBC,EAAAV,cAAyBW,KAAzBX,KAA0BS,IACrEG,EAAAb,IAAAC,KAA2BS,GAAqBC,EAAAV,cAA2BW,KAA3BX,KAA4BS,IAG5FI,EAAAd,IAAAC,KAAkBS,IACN,WAAfA,EAAEK,WACJJ,EAAAV,KAAIe,EAAA,IAAAC,GAAqBL,KAAzBX,MACAU,EAAAV,KAAIG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uL,UAAA,sBAAA,GAM/BF,EAAA,CAA3CI,EAAS,CAAEC,UAAW,qBAAiD1L,EAAAuL,UAAA,qBAAA,GAMtBF,EAAA,CAAjDI,EAAS,CAAEC,UAAW,2BAAgE1L,EAAAuL,UAAA,0BAAA,GAM1DF,EAAA,CAA5BI,EAAS,CAAEI,KAAMC,WAA6B9L,EAAAuL,UAAA,iBAAA,GAMPF,EAAA,CAAvCI,EAAS,CAAEC,UAAW,iBAAsC1L,EAAAuL,UAAA,kBAAA,GAMnBF,EAAA,CAAzCI,EAAS,CAAEC,UAAW,mBAAuC1L,EAAAuL,UAAA,oBAAA,GAMpBF,EAAA,CAAzCI,EAAS,CAAEC,UAAW,mBAA2C1L,EAAAuL,UAAA,oBAAA,GAMtDF,EAAA,CAAXI,KAAiCzL,EAAAuL,UAAA,gBAvUvBvL,EAAoBC,EAAAoL,EAAA,CADhCU,EAAc,mBACF/L,GC1FN,IAAMgM,GAAN,cAAyCC,EAAQC,IAE7C5I,iBAAAA,GACPC,MAAMD,oBAEF5C,KAAKyL,gBACPzL,KAAKyL,cAAcC,aAAe,SAEtC,CAGSzI,oBAAAA,GACPJ,MAAMI,uBAEFjD,KAAKyL,gBACPzL,KAAKyL,cAAcC,aAAe,KAEtC,CAGSC,QAAAA,GACH3L,KAAK4L,mBAAmBtM,GAAwBU,KAAKyL,eACvDzL,KAAK4L,QAAQnH,OAAOzE,KAAKyL,cAAezL,KAAK6L,QAA6B,wBAAqB3K,EAEnG,GAxBWoK,GAA0BX,EAAA,CADtCU,EAAc,0BACFC"}
|
|
1
|
+
{"version":3,"file":"datepicker.min.js","sources":["../../src/datepicker/DatepickerElement.ts","../../src/datepicker/DatepickerToggleElement.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\r\nimport { css, CSSResultGroup, html, LitElement, nothing, PropertyValues, unsafeCSS } from \"lit\";\r\nimport { property, query, state } from \"lit/decorators.js\";\r\n\r\nimport {\r\n addCustomState,\r\n customElement,\r\n AttachInternals,\r\n dateConverter,\r\n deleteCustomState,\r\n DesignToken,\r\n Role,\r\n ScrollLockController,\r\n setCustomState,\r\n SuppressInitialAnimation,\r\n InertController,\r\n ReconnectedCallback,\r\n prefersReducedMotion,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { positionAnchor } from \"@m3e/web/core/anchoring\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\nimport { Breakpoint, M3eBreakpointObserver } from \"@m3e/web/core/layout\";\r\nimport { M3eCalendarElement, CalendarView } from \"@m3e/web/calendar\";\r\n\r\nimport \"@m3e/web/core/a11y\";\r\nimport \"@m3e/web/button\";\r\nimport \"@m3e/web/calendar\";\r\n\r\nimport { DatepickerVariant } from \"./DatepickerVariant\";\r\n\r\n/**\r\n * Presents a date picker on a temporary surface.\r\n *\r\n * @description\r\n * The `m3e-datepicker` component provides a date‑selection experience\r\n * consistent with Material 3 guidance for layout, motion, and accessibility.\r\n * It displays a temporary surface that allows users to select a date or date\r\n * range using calendar-based views. The picker supports month, year, and\r\n * multi‑year views, enabling users to navigate across time efficiently.\r\n *\r\n * While open, the picker uses a focused selection flow. Users review their\r\n * choice and complete the interaction through confirm, dismiss, or clear\r\n * actions, ensuring intentional updates to the field or control that invoked it.\r\n *\r\n * It accepts and emits plain `Date` values, allowing applications to apply their\r\n * own formatting, parsing, and localization.\r\n *\r\n * @tag m3e-datepicker\r\n *\r\n * @attr variant - The appearance variant of the picker.\r\n * @attr clearable - Whether the user can clear the selected date and close the picker.\r\n * @attr date - The selected date.\r\n * @attr max-date - The maximum date that can be selected.\r\n * @attr min-date - The minimum date that can be selected.\r\n * @attr range - Whether a range of dates can be selected.\r\n * @attr range-end - End of a date range.\r\n * @attr range-start - Start of a date range.\r\n * @attr start-at - A date specifying the period (month or year) to start the calendar in.\r\n * @attr start-view - The initial view used to select a date.\r\n * @attr previous-month-label - The accessible label given to the button used to move to the previous month.\r\n * @attr next-month-label - The accessible label given to the button used to move to the next month.\r\n * @attr previous-year-label - The accessible label given to the button used to move to the previous year.\r\n * @attr next-year-label - The accessible label given to the button used to move to the next year.\r\n * @attr previous-multi-year-label - The accessible label given to the button used to move to the previous 24 years.\r\n * @attr next-multi-year-label - The accessible label given to the button used to move to the next 24 years.\r\n * @attr clear-label - The label given to the button used clear the selected date and close the picker.\r\n * @attr confirm-label - The label given to the button used apply the selected date and close the picker.\r\n * @attr dismiss-label - The label given to the button used discard the selected date and close the picker.\r\n * @attr label - The label given to the the picker.\r\n *\r\n * @fires change - Dispatched when the selected date changes.\r\n * @fires beforetoggle - Dispatched before the toggle state changes.\r\n * @fires toggle - Dispatched after the toggle state has changed.\r\n *\r\n * @cssprop --m3e-datepicker-container-padding-block - Block‑axis padding of the date picker container.\r\n * @cssprop --m3e-datepicker-container-padding-inline - Inline‑axis padding of the date picker container.\r\n * @cssprop --m3e-datepicker-container-color - Background color of the standard container surface.\r\n * @cssprop --m3e-datepicker-container-elevation - Elevation shadow applied to the container surface.\r\n * @cssprop --m3e-datepicker-modal-headline-color - Color used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-headline-font-size - Font size used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-headline-font-weight - Font weight used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-headline-line-height - Line height used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-headline-tracking - Letter spacing used for the modal headline text.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-color - Color used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-font-size - Font size used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-font-weight - Font weight used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-line-height - Line height used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-modal-supporting-text-tracking - Letter spacing used for supporting text in modal mode.\r\n * @cssprop --m3e-datepicker-actions-padding-inline - Inline‑axis padding of the action row.\r\n * @cssprop --m3e-datepicker-docked-container-color - Background color of the container in docked mode.\r\n * @cssprop --m3e-datepicker-docked-container-shape - Corner radius of the container in docked mode.\r\n * @cssprop --m3e-datepicker-modal-container-color - Background color of the container in modal mode.\r\n * @cssprop --m3e-datepicker-modal-container-shape - Corner radius of the container in modal mode.\r\n * @cssprop --m3e-divider-thickness - Thickness of divider elements within the picker.\r\n * @cssprop --m3e-divider-color - Color of divider rules within the picker.\r\n * @cssprop --m3e-dialog-scrim-color - Base color used for the modal scrim behind the picker.\r\n * @cssprop --m3e-dialog-scrim-opacity - Opacity applied to the scrim color in modal mode.\r\n */\r\n@customElement(\"m3e-datepicker\")\r\nexport class M3eDatepickerElement extends SuppressInitialAnimation(\r\n ReconnectedCallback(AttachInternals(Role(LitElement, \"dialog\"))),\r\n) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n flex-direction: column;\r\n margin: unset;\r\n border: unset;\r\n padding-block: var(--m3e-datepicker-container-padding-block, 0.75rem);\r\n padding-inline: var(--m3e-datepicker-container-padding-inline, 0.25rem);\r\n background-color: var(--m3e-datepicker-container-color, ${DesignToken.color.surfaceContainer});\r\n box-shadow: var(--m3e-datepicker-container-elevation, ${DesignToken.elevation.level3});\r\n opacity: 0;\r\n display: none;\r\n }\r\n .calendar {\r\n --m3e-calendar-container-color: transparent;\r\n --m3e-calendar-container-elevation: ${DesignToken.elevation.level0};\r\n --m3e-calendar-container-shape: ${DesignToken.shape.corner.none};\r\n }\r\n .headline {\r\n color: var(--m3e-datepicker-modal-headline-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(\r\n --m3e-datepicker-modal-headline-font-size,\r\n ${DesignToken.typescale.standard.headline.large.fontSize}\r\n );\r\n font-weight: var(\r\n --m3e-datepicker-modal-headline-font-weight,\r\n ${DesignToken.typescale.standard.headline.large.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-datepicker-modal-headline-line-height,\r\n ${DesignToken.typescale.standard.headline.large.lineHeight}\r\n );\r\n letter-spacing: var(\r\n --m3e-datepicker-modal-headline-tracking,\r\n ${DesignToken.typescale.standard.headline.large.tracking}\r\n );\r\n margin-block-start: 2.25rem;\r\n margin-block-end: 0.75rem;\r\n margin-inline: 1.5rem;\r\n }\r\n .supporting-text {\r\n color: var(--m3e-datepicker-modal-supporting-text-color, ${DesignToken.color.onSurfaceVariant});\r\n font-size: var(\r\n --m3e-datepicker-modal-supporting-text-font-size,\r\n ${DesignToken.typescale.standard.label.large.fontSize}\r\n );\r\n font-weight: var(\r\n --m3e-datepicker-modal-supporting-text-font-weight,\r\n ${DesignToken.typescale.standard.label.large.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-datepicker-modal-supporting-text-line-height,\r\n ${DesignToken.typescale.standard.label.large.lineHeight}\r\n );\r\n letter-spacing: var(\r\n --m3e-datepicker-modal-supporting-text-tracking,\r\n ${DesignToken.typescale.standard.label.large.tracking}\r\n );\r\n margin-block-start: 1rem;\r\n margin-inline: 1.5rem;\r\n }\r\n .divider {\r\n height: var(--m3e-divider-thickness, 1px);\r\n width: 100%;\r\n position: relative;\r\n }\r\n .divider::before {\r\n content: \"\";\r\n box-sizing: border-box;\r\n position: absolute;\r\n border-bottom: var(--m3e-divider-thickness, 1px) solid\r\n var(--m3e-divider-color, ${DesignToken.color.outlineVariant});\r\n height: inherit;\r\n left: -0.25rem;\r\n right: -0.25rem;\r\n }\r\n .actions {\r\n display: flex;\r\n align-items: center;\r\n column-gap: 0.5rem;\r\n padding-inline: var(--m3e-datepicker-actions-padding-inline, 0.5rem);\r\n }\r\n .spacer {\r\n flex: 1 1 auto;\r\n }\r\n :host(:is(:state(--docked), :--docked)) {\r\n position: absolute;\r\n background-color: var(--m3e-datepicker-docked-container-color, ${DesignToken.color.surfaceContainer});\r\n border-radius: var(--m3e-datepicker-docked-container-shape, ${DesignToken.shape.corner.large});\r\n }\r\n :host(:is(:state(--modal), :--modal)) {\r\n position: fixed;\r\n inset: 0;\r\n margin: auto;\r\n transform-origin: top;\r\n background-color: var(--m3e-datepicker-modal-container-color, ${DesignToken.color.surfaceContainerHigh});\r\n border-radius: var(--m3e-datepicker-modal-container-shape, ${DesignToken.shape.corner.extraLarge});\r\n }\r\n :host(:not(:is(:state(--no-animate), :--no-animate))) {\r\n transition: ${unsafeCSS(\r\n `opacity ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard}, \r\n transform ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard},\r\n overlay ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n display ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host {\r\n transform: scaleY(0.8);\r\n }\r\n :host(:popover-open) {\r\n transform: scaleY(1);\r\n display: inline-flex;\r\n opacity: 1;\r\n }\r\n :host(:is(:state(--docked), :--docked))::backdrop {\r\n background-color: transparent;\r\n }\r\n :host(:is(:state(--modal), :--modal))::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n margin-inline-end: -20px;\r\n }\r\n :host(:is(:state(--modal), :--modal):not(:popover-open))::backdrop {\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.short3} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host(:is(:state(--modal), :--modal):popover-open)::backdrop {\r\n background-color: color-mix(\r\n in srgb,\r\n var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%),\r\n transparent\r\n );\r\n transition: ${unsafeCSS(\r\n `background-color ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard}, \r\n overlay ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete,\r\n visibility ${DesignToken.motion.duration.long2} ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n :host(:is(:state(--bottom), :--bottom)) {\r\n transform-origin: top;\r\n }\r\n :host(:is(:state(--top), :--top)) {\r\n transform-origin: bottom;\r\n }\r\n @starting-style {\r\n :host(:popover-open) {\r\n transform: scaleY(0.8);\r\n }\r\n :host(:is(:state(--modal), :--modal):popover-open)::backdrop {\r\n background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${DesignToken.color.scrim}) 0%, transparent);\r\n }\r\n }\r\n @media (prefers-reduced-motion) {\r\n :host(:not(:is(:state(--no-animate), :--no-animate))) {\r\n transition: none;\r\n }\r\n }\r\n @media (forced-colors: active) {\r\n :host {\r\n background-color: Menu;\r\n color: MenuText;\r\n border: 1px solid CanvasText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ #closeTimeout = -1;\r\n /** @private */ @state() private _open = false;\r\n /** @private */ @state() private _date?: Date | null;\r\n /** @private */ @state() private _rangeStart?: Date | null;\r\n /** @private */ @state() private _rangeEnd?: Date | null;\r\n\r\n /** @private */ @query(\"m3e-calendar\") private readonly _calendar!: M3eCalendarElement;\r\n /** @private */ @state() private _variant?: Exclude<DatepickerVariant, \"auto\">;\r\n /** @private */ #breakpointUnobserve?: () => void;\r\n\r\n /** @private */ #trigger?: HTMLElement;\r\n /** @private */ #anchor?: HTMLElement;\r\n /** @private */ #anchorCleanup?: () => void;\r\n\r\n /** @private */ readonly #scrollLockController = new ScrollLockController(this);\r\n /** @private */ readonly #inertController = new InertController(this);\r\n /** @private */ readonly #documentClickHandler = (e: MouseEvent) => this.#handleDocumentClick(e);\r\n /** @private */ readonly #documentKeyDownHandler = (e: KeyboardEvent) => this.#handleDocumentKeyDown(e);\r\n\r\n /** @private */\r\n readonly #toggleHandler = (e: ToggleEvent) => {\r\n if (e.newState === \"closed\") {\r\n this.#clearSelectionState();\r\n this.#anchorCleanup?.();\r\n this.#anchorCleanup = undefined;\r\n\r\n clearTimeout(this.#closeTimeout);\r\n\r\n if (!prefersReducedMotion()) {\r\n this.#closeTimeout = setTimeout(() => (this._open = false), 100);\r\n } else {\r\n this._open = false;\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * The appearance variant of the picker.\r\n * @default \"docked\"\r\n */\r\n @property() variant: DatepickerVariant = \"docked\";\r\n\r\n /**\r\n * The initial view used to select a date.\r\n * @default \"month\"\r\n */\r\n @property({ attribute: \"start-view\" }) startView: CalendarView = \"month\";\r\n\r\n /**\r\n * The selected date.\r\n * @default null\r\n */\r\n @property({ converter: dateConverter }) date: Date | null = null;\r\n\r\n /**\r\n * A date specifying the period (month or year) to start the calendar in.\r\n * @default null\r\n */\r\n @property({ attribute: \"start-at\", converter: dateConverter }) startAt: Date | null = null;\r\n\r\n /**\r\n * The minimum date that can be selected.\r\n * @default null\r\n */\r\n @property({ attribute: \"min-date\", converter: dateConverter }) minDate: Date | null = null;\r\n\r\n /**\r\n * The maximum date that can be selected.\r\n * @default null\r\n */\r\n @property({ attribute: \"max-date\", converter: dateConverter }) maxDate: Date | null = null;\r\n\r\n /**\r\n * Whether a range of dates can be selected.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) range = false;\r\n\r\n /**\r\n * Start of a date range.\r\n * @default null\r\n */\r\n @property({ attribute: \"range-start\", converter: dateConverter }) rangeStart: Date | null = null;\r\n\r\n /**\r\n * End of a date range.\r\n * @default null\r\n */\r\n @property({ attribute: \"range-end\", converter: dateConverter }) rangeEnd: Date | null = null;\r\n\r\n /**\r\n * A function used to determine whether a date cannot be selected.\r\n * @default null\r\n */\r\n @property({ attribute: false }) blackoutDates: ((date: Date) => boolean) | null = null;\r\n\r\n /**\r\n * A function used to determine whether a date is special.\r\n * @default null\r\n */\r\n @property({ attribute: false }) specialDates: ((date: Date) => boolean) | null = null;\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous month.\r\n * @default \"Previous month\"\r\n */\r\n @property({ attribute: \"previous-month-label\" }) previousMonthLabel = \"Previous month\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous year.\r\n * @default \"Previous year\"\r\n */\r\n @property({ attribute: \"previous-year-label\" }) previousYearLabel = \"Previous year\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous 24 years.\r\n * @default \"Previous 24 years\"\r\n */\r\n @property({ attribute: \"previous-multi-year-label\" }) previousMultiYearLabel = \"Previous 24 years\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next month.\r\n * @default \"Next month\"\r\n */\r\n @property({ attribute: \"next-month-label\" }) nextMonthLabel = \"Next month\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next year.\r\n * @default \"Next year\"\r\n */\r\n @property({ attribute: \"next-year-label\" }) nextYearLabel = \"Next year\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next 24 years.\r\n * @default \"Next 24 years\"\r\n */\r\n @property({ attribute: \"next-multi-year-label\" }) nextMultiYearLabel = \"Next 24 years\";\r\n\r\n /**\r\n * Whether the user can clear the selected date and close the picker.\r\n * @default false\r\n */\r\n @property({ type: Boolean }) clearable = false;\r\n\r\n /**\r\n * The label given to the button used clear the selected date and close the picker.\r\n * @default \"Clear\"\r\n */\r\n @property({ attribute: \"clear-label\" }) clearLabel = \"Clear\";\r\n\r\n /**\r\n * The label given to the button used apply the selected date and close the picker.\r\n * @default \"OK\"\r\n */\r\n @property({ attribute: \"confirm-label\" }) confirmLabel = \"OK\";\r\n\r\n /**\r\n * The label given to the button used discard the selected date and close the picker.\r\n * @default \"Cancel\"\r\n */\r\n @property({ attribute: \"dismiss-label\" }) dismissLabel = \"Cancel\";\r\n\r\n /**\r\n * The label given to the the picker.\r\n * @default \"Select date\"\r\n */\r\n @property() label = \"Select date\";\r\n\r\n /** Whether the picker is open. */\r\n get isOpen() {\r\n return this.#trigger !== undefined;\r\n }\r\n\r\n /** The current variant applied to the picker. */\r\n get currentVariant(): Exclude<DatepickerVariant, \"auto\"> {\r\n return this._variant ?? (this.variant !== \"modal\" ? \"docked\" : \"modal\");\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n\r\n this.setAttribute(\"popover\", \"manual\");\r\n this.addEventListener(\"toggle\", this.#toggleHandler);\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n this._variant = undefined;\r\n this.#breakpointUnobserve?.();\r\n\r\n this.#clearAnchoring();\r\n\r\n deleteCustomState(this, \"--docked\");\r\n deleteCustomState(this, \"--modal\");\r\n\r\n this.removeEventListener(\"toggle\", this.#toggleHandler);\r\n document.removeEventListener(\"click\", this.#documentClickHandler);\r\n document.removeEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n\r\n if (this.variant === \"auto\") {\r\n this.#initBreakpointMonitoring();\r\n }\r\n }\r\n\r\n /**\r\n * Opens the picker.\r\n * @param {HTMLElement} trigger The element that triggered the picker.\r\n * @param {HTMLElement | undefined} anchor The element used to position the picker.\r\n * @returns {Promise<void>} A `Promise` that resolves when the picker is opened.\r\n */\r\n async show(trigger: HTMLElement, anchor?: HTMLElement): Promise<void> {\r\n if (this.#trigger && this.#trigger !== trigger) {\r\n this.hide();\r\n }\r\n\r\n clearTimeout(this.#closeTimeout);\r\n\r\n if (this.currentVariant === \"modal\") {\r\n this.#scrollLockController.lock();\r\n this.#inertController.lock();\r\n }\r\n\r\n // The calendar is rendered on demand\r\n this._open = true;\r\n\r\n // Wait for the calendar to render\r\n if (this.isUpdatePending) {\r\n await this.updateComplete;\r\n }\r\n\r\n const calendar = this._calendar;\r\n\r\n calendar.startView = this.startView;\r\n calendar.startAt = this.startAt;\r\n calendar.minDate = this.minDate;\r\n calendar.maxDate = this.maxDate;\r\n calendar.date = this.date;\r\n calendar.rangeStart = this.rangeStart;\r\n calendar.rangeEnd = this.rangeEnd;\r\n calendar.specialDates = this.specialDates;\r\n calendar.blackoutDates = this.blackoutDates;\r\n\r\n // Ensure the active view is reset\r\n calendar.resetActiveView();\r\n\r\n if (calendar.isUpdatePending) {\r\n await calendar.updateComplete;\r\n }\r\n\r\n this.#trigger = trigger;\r\n this.#trigger.ariaExpanded = \"true\";\r\n this.#anchor = anchor;\r\n\r\n await this.#updatePosition();\r\n this.showPopover();\r\n\r\n document.addEventListener(\"click\", this.#documentClickHandler);\r\n document.addEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n\r\n await calendar.focusActiveCell();\r\n }\r\n\r\n /**\r\n * Hides the picker.\r\n * @param {boolean} [restoreFocus=false] Whether to restore focus to the picker's trigger.\r\n */\r\n hide(restoreFocus: boolean = false): void {\r\n if (!this.isOpen) return;\r\n\r\n document.removeEventListener(\"click\", this.#documentClickHandler);\r\n document.removeEventListener(\"keydown\", this.#documentKeyDownHandler);\r\n\r\n if (this.currentVariant === \"modal\") {\r\n this.#scrollLockController.unlock();\r\n this.#inertController.unlock();\r\n }\r\n\r\n this.hidePopover();\r\n\r\n if (this.#trigger) {\r\n this.#trigger.ariaExpanded = \"false\";\r\n if (restoreFocus) {\r\n this.#trigger.focus();\r\n }\r\n this.#trigger = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Toggles the picker.\r\n * @param {HTMLElement} trigger The element that triggered the picker.\r\n * @param {HTMLElement | undefined} anchor The element used to position the picker.\r\n * @returns {Promise<void>} A `Promise` that resolves when the picker is opened or closed.\r\n */\r\n async toggle(trigger: HTMLElement, anchor?: HTMLElement): Promise<void> {\r\n if (this.#trigger) {\r\n this.hide();\r\n } else {\r\n await this.show(trigger, anchor);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<m3e-focus-trap ?disabled=\"${!this._open}\">\r\n ${this.#renderHeader()}${this.#renderCalendar()}${this.#renderActions()}\r\n </m3e-focus-trap>`;\r\n }\r\n\r\n /** @inheritdoc */\r\n #renderHeader(): unknown {\r\n if (this.currentVariant === \"docked\") return nothing;\r\n\r\n const rangeStart = this._rangeStart ?? this.rangeStart;\r\n const rangeEnd = this._rangeStart ? this._rangeEnd : (this._rangeEnd ?? this.rangeEnd);\r\n const selectedDate = this._date ?? this.date;\r\n\r\n return html`<div class=\"supporting-text\">${this.label}</div>\r\n ${rangeStart\r\n ? html`<div class=\"headline\">\r\n ${new Intl.DateTimeFormat(navigator.language, {\r\n month: \"short\",\r\n day: \"numeric\",\r\n }).format(rangeStart) +\r\n \" – \" +\r\n (rangeEnd\r\n ? new Intl.DateTimeFormat(navigator.language, {\r\n month: \"short\",\r\n day: \"numeric\",\r\n }).format(rangeEnd)\r\n : \"\")}\r\n </div>`\r\n : html`<div class=\"headline\">\r\n ${selectedDate\r\n ? new Intl.DateTimeFormat(navigator.language, {\r\n weekday: \"short\",\r\n month: \"short\",\r\n day: \"numeric\",\r\n }).format(selectedDate)\r\n : \"––\"}\r\n </div>`}\r\n <div class=\"divider\"></div>`;\r\n }\r\n\r\n /** @private */\r\n #renderCalendar(): unknown {\r\n // Calendar is rendered only when open\r\n return this._open\r\n ? html`<m3e-calendar class=\"calendar\" @change=\"${this.#handleCalendarChange}\"></m3e-calendar>`\r\n : nothing;\r\n }\r\n\r\n /** @private */\r\n #renderActions(): unknown {\r\n return html`<div class=\"actions\">\r\n ${this.clearable ? html`<m3e-button @click=\"${this.#handleClearClick}\">${this.clearLabel}</m3e-button>` : nothing}\r\n <div class=\"spacer\" aria-hidden=\"true\"></div>\r\n <m3e-button @click=\"${this.#handleDismissClick}\">${this.dismissLabel}</m3e-button>\r\n <m3e-button @click=\"${this.#handleConfirmClick}\">${this.confirmLabel}</m3e-button>\r\n </div>`;\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\r\n super.willUpdate(changedProperties);\r\n\r\n if ([\"date\", \"rangeStart\", \"rangeEnd\"].some((x) => changedProperties.has(<keyof M3eDatepickerElement>x))) {\r\n this.#clearSelectionState();\r\n }\r\n if (changedProperties.has(\"rangeStart\") && this.rangeStart) {\r\n this.range = true;\r\n }\r\n if (changedProperties.has(\"rangeStart\") && this.rangeStart && !changedProperties.has(\"date\")) {\r\n this.date = new Date(this.rangeStart);\r\n }\r\n if (changedProperties.has(\"rangeEnd\") && this.rangeEnd && !changedProperties.has(\"date\")) {\r\n this.date = new Date(this.rangeEnd);\r\n }\r\n if (changedProperties.has(\"variant\")) {\r\n this.#breakpointUnobserve?.();\r\n\r\n if (this.variant === \"auto\") {\r\n this.#initBreakpointMonitoring();\r\n } else {\r\n this._variant = undefined;\r\n this.#updateVariant();\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDocumentClick(e: MouseEvent): void {\r\n if (this.isOpen && !e.composedPath().some((x) => x === this || x === this.#trigger)) {\r\n this.hide();\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleCalendarChange(e: Event): void {\r\n const calendar = <M3eCalendarElement>e.target;\r\n this._date = calendar.date;\r\n this._rangeStart = calendar.rangeStart;\r\n this._rangeEnd = calendar.rangeEnd;\r\n\r\n if (this.range && !this._rangeStart && this._date) {\r\n this._rangeStart = new Date(this._date);\r\n calendar.rangeStart = this._rangeStart;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleClearClick(): void {\r\n this.date = null;\r\n this.rangeStart = null;\r\n this.rangeEnd = null;\r\n\r\n this.hide(true);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @private */\r\n #handleDismissClick(): void {\r\n this.hide(true);\r\n }\r\n\r\n /** @private */\r\n #handleConfirmClick(): void {\r\n this.date = this._date ?? this.date;\r\n this.rangeStart = this._rangeStart === undefined ? this.rangeStart : this._rangeStart;\r\n this.rangeEnd = this._rangeEnd === undefined ? this.rangeEnd : this._rangeEnd;\r\n this.hide(true);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @private */\r\n #handleDocumentKeyDown(e: KeyboardEvent): void {\r\n if (this.isOpen && this.currentVariant === \"modal\" && e.key === \"Escape\" && !e.shiftKey && !e.ctrlKey) {\r\n e.preventDefault();\r\n this.hide(true);\r\n }\r\n }\r\n\r\n /** @private */\r\n #initBreakpointMonitoring(): void {\r\n this.#breakpointUnobserve = M3eBreakpointObserver.observe([Breakpoint.XSmall, Breakpoint.Small], (matches) => {\r\n this._variant = matches.get(Breakpoint.XSmall) || matches.get(Breakpoint.Small) ? \"modal\" : \"docked\";\r\n this.#updateVariant();\r\n });\r\n }\r\n\r\n /** @private */\r\n #updateVariant(): void {\r\n switch (this.currentVariant) {\r\n case \"docked\":\r\n this.ariaModal = null;\r\n deleteCustomState(this, \"--modal\");\r\n addCustomState(this, \"--docked\");\r\n this.#scrollLockController.unlock();\r\n this.#inertController.unlock();\r\n break;\r\n\r\n case \"modal\":\r\n this.ariaModal = \"true\";\r\n deleteCustomState(this, \"--docked\");\r\n addCustomState(this, \"--modal\");\r\n if (this.isOpen) {\r\n this.#scrollLockController.lock();\r\n this.#inertController.lock();\r\n }\r\n\r\n break;\r\n }\r\n\r\n if (this.isOpen) {\r\n this.#updatePosition();\r\n }\r\n }\r\n\r\n /** @private */\r\n async #updatePosition(): Promise<void> {\r\n if (this.currentVariant === \"docked\" && this.#trigger) {\r\n this.#anchorCleanup?.();\r\n this.#anchorCleanup = await positionAnchor(\r\n this,\r\n this.#anchor ?? this.#trigger,\r\n {\r\n position: \"bottom-start\",\r\n inline: true,\r\n flip: true,\r\n shift: \"both\",\r\n },\r\n (x, y, position) => {\r\n setCustomState(this, \"--top\", position.includes(\"top\"));\r\n setCustomState(this, \"--bottom\", position.includes(\"bottom\"));\r\n\r\n if (M3eDirectionality.current === \"rtl\") {\r\n this.style.right = `${window.innerWidth - x - this.clientWidth}px`;\r\n this.style.left = \"\";\r\n } else {\r\n this.style.left = `${x}px`;\r\n this.style.right = \"\";\r\n }\r\n\r\n this.style.top = `${y}px`;\r\n },\r\n );\r\n } else {\r\n this.#clearAnchoring();\r\n }\r\n }\r\n\r\n /** @private */\r\n #clearAnchoring(): void {\r\n this.#anchorCleanup?.();\r\n this.#anchorCleanup = undefined;\r\n this.style.left = \"\";\r\n this.style.right = \"\";\r\n this.style.top = \"\";\r\n }\r\n\r\n /** @private */\r\n #clearSelectionState(): void {\r\n this._date = this._rangeStart = this._rangeEnd = undefined;\r\n }\r\n}\r\n\r\ninterface M3eDatepickerElementEventMap extends HTMLElementEventMap {\r\n beforetoggle: ToggleEvent;\r\n toggle: ToggleEvent;\r\n}\r\n\r\nexport interface M3eDatepickerElement {\r\n addEventListener<K extends keyof M3eDatepickerElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDatepickerElement, ev: M3eDatepickerElementEventMap[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 M3eDatepickerElementEventMap>(\r\n type: K,\r\n listener: (this: M3eDatepickerElement, ev: M3eDatepickerElementEventMap[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-datepicker\": M3eDatepickerElement;\r\n }\r\n}\r\n","import { customElement, ActionElementBase, HtmlFor } from \"@m3e/web/core\";\r\nimport type { M3eFormFieldElement } from \"@m3e/web/form-field\";\r\n\r\nimport { M3eDatepickerElement } from \"./DatepickerElement\";\r\n\r\n/**\r\n * An element, nested within a clickable element, used to toggle a datepicker.\r\n * @tag m3e-datepicker-toggle\r\n */\r\n@customElement(\"m3e-datepicker-toggle\")\r\nexport class M3eDatepickerToggleElement extends HtmlFor(ActionElementBase) {\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = \"dialog\";\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n if (this.parentElement) {\r\n this.parentElement.ariaHasPopup = null;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override _onClick(): void {\r\n if (this.control instanceof M3eDatepickerElement && this.parentElement) {\r\n this.control.toggle(this.parentElement, this.closest<M3eFormFieldElement>(\"m3e-form-field\") ?? undefined);\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-datepicker-toggle\": M3eDatepickerToggleElement;\r\n }\r\n}\r\n"],"names":["M3eDatepickerElement","SuppressInitialAnimation","ReconnectedCallback","AttachInternals","Role","LitElement","constructor","_M3eDatepickerElement_closeTimeout","set","this","_open","_M3eDatepickerElement_breakpointUnobserve","_M3eDatepickerElement_trigger","_M3eDatepickerElement_anchor","_M3eDatepickerElement_anchorCleanup","_M3eDatepickerElement_scrollLockController","ScrollLockController","_M3eDatepickerElement_inertController","InertController","_M3eDatepickerElement_documentClickHandler","e","__classPrivateFieldGet","call","_M3eDatepickerElement_documentKeyDownHandler","_M3eDatepickerElement_toggleHandler","newState","_M3eDatepickerElement_instances","_M3eDatepickerElement_clearSelectionState","__classPrivateFieldSet","undefined","clearTimeout","prefersReducedMotion","setTimeout","variant","startView","date","startAt","minDate","maxDate","range","rangeStart","rangeEnd","blackoutDates","specialDates","previousMonthLabel","previousYearLabel","previousMultiYearLabel","nextMonthLabel","nextYearLabel","nextMultiYearLabel","clearable","clearLabel","confirmLabel","dismissLabel","label","isOpen","currentVariant","_variant","connectedCallback","super","setAttribute","addEventListener","disconnectedCallback","_M3eDatepickerElement_clearAnchoring","deleteCustomState","removeEventListener","document","reconnectedCallback","_M3eDatepickerElement_initBreakpointMonitoring","show","trigger","anchor","hide","lock","isUpdatePending","updateComplete","calendar","_calendar","resetActiveView","ariaExpanded","_M3eDatepickerElement_updatePosition","showPopover","focusActiveCell","restoreFocus","unlock","hidePopover","focus","toggle","render","html","_M3eDatepickerElement_renderHeader","_M3eDatepickerElement_renderCalendar","_M3eDatepickerElement_renderActions","willUpdate","changedProperties","some","x","has","Date","_M3eDatepickerElement_updateVariant","nothing","_rangeStart","_rangeEnd","selectedDate","_date","Intl","DateTimeFormat","navigator","language","month","day","format","weekday","_M3eDatepickerElement_handleClearClick","_M3eDatepickerElement_handleDismissClick","_M3eDatepickerElement_handleConfirmClick","composedPath","target","dispatchEvent","Event","bubbles","key","shiftKey","ctrlKey","preventDefault","M3eBreakpointObserver","observe","Breakpoint","XSmall","Small","matches","get","ariaModal","addCustomState","async","positionAnchor","position","inline","flip","shift","y","setCustomState","includes","M3eDirectionality","current","style","right","window","innerWidth","clientWidth","left","top","styles","css","DesignToken","color","surfaceContainer","elevation","level3","level0","shape","corner","none","onSurfaceVariant","typescale","standard","headline","large","fontSize","fontWeight","lineHeight","tracking","outlineVariant","surfaceContainerHigh","extraLarge","unsafeCSS","motion","duration","short2","easing","scrim","short3","long2","__decorate","state","prototype","query","property","attribute","converter","dateConverter","type","Boolean","customElement","M3eDatepickerToggleElement","HtmlFor","ActionElementBase","parentElement","ariaHasPopup","_onClick","control","closest"],"mappings":";;;;;m4BAoGO,IAAMA,GAAN,cAAmCC,EACxCC,EAAoBC,EAAgBC,EAAKC,EAAY,cADhDC,WAAAA,mCA2KWC,EAAAC,IAAAC,SACiBA,KAAAC,OAAQ,EAOzBC,EAAAH,IAAAC,aAEAG,EAAAJ,IAAAC,aACAI,EAAAL,IAAAC,aACAK,EAAAN,IAAAC,aAESM,EAAAP,IAAAC,KAAwB,IAAIO,EAAqBP,OACjDQ,EAAAT,IAAAC,KAAmB,IAAIS,EAAgBT,OACvCU,EAAAX,IAAAC,KAAyBW,GAAkBC,EAAAZ,cAAyBa,KAAzBb,KAA0BW,IACrEG,EAAAf,IAAAC,KAA2BW,GAAqBC,EAAAZ,cAA2Ba,KAA3Bb,KAA4BW,IAG5FI,EAAAhB,IAAAC,KAAkBW,IACN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1I,iBAAAA,GACPC,MAAMD,oBAEFjD,KAAK4L,gBACP5L,KAAK4L,cAAcC,aAAe,SAEtC,CAGSxI,oBAAAA,GACPH,MAAMG,uBAEFrD,KAAK4L,gBACP5L,KAAK4L,cAAcC,aAAe,KAEtC,CAGSC,QAAAA,GACH9L,KAAK+L,mBAAmBxM,IAAwBS,KAAK4L,eACvD5L,KAAK+L,QAAQjH,OAAO9E,KAAK4L,cAAe5L,KAAKgM,QAA6B,wBAAqB5K,EAEnG,GAxBWqK,GAA0BX,EAAA,CADtCU,EAAc,0BACFC"}
|
package/dist/fab-menu.js
CHANGED
|
@@ -3,107 +3,15 @@
|
|
|
3
3
|
* Copyright (c) 2025–2026 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import { __classPrivateFieldGet,
|
|
6
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from 'tslib';
|
|
7
7
|
import { LitElement, html, unsafeCSS, css } from 'lit';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { property, query } from 'lit/decorators.js';
|
|
9
|
+
import { SuppressInitialAnimation, AttachInternals, Role, ScrollController, ClickOutsideController, setCustomState, DesignToken, customElement, KeyboardClick, LinkButton, Disabled, renderPseudoLink, HtmlFor, ActionElementBase } from '@m3e/web/core';
|
|
10
10
|
import { RovingTabIndexManager, addAriaReferencedId, removeAriaReferencedId } from '@m3e/web/core/a11y';
|
|
11
11
|
import { M3eDirectionality } from '@m3e/web/core/bidi';
|
|
12
12
|
import { positionAnchor } from '@m3e/web/core/anchoring';
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
/**
|
|
16
|
-
* An item of a floating action button (FAB) menu.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* The following example illustrates triggering a `m3e-fab-menu` from an `m3e-fab` using a `m3e-fab-menu-trigger`.
|
|
20
|
-
* ```html
|
|
21
|
-
* <m3e-fab variant="primary" size="large">
|
|
22
|
-
* <m3e-fab-menu-trigger for="fabmenu">
|
|
23
|
-
* <m3e-icon name="edit"></m3e-icon>
|
|
24
|
-
* </m3e-fab-menu-trigger>
|
|
25
|
-
* </m3e-fab>
|
|
26
|
-
* <m3e-fab-menu id="fabmenu" variant="secondary">
|
|
27
|
-
* <m3e-fab-menu-item>First</m3e-fab-menu-item>
|
|
28
|
-
* <m3e-fab-menu-item>Second</m3e-fab-menu-item>
|
|
29
|
-
* <m3e-fab-menu-item>Third</m3e-fab-menu-item>
|
|
30
|
-
* <m3e-fab-menu-item>Forth</m3e-fab-menu-item>
|
|
31
|
-
* <m3e-fab-menu-item>Fifth</m3e-fab-menu-item>
|
|
32
|
-
* <m3e-fab-menu-item>Sixth</m3e-fab-menu-item>
|
|
33
|
-
* </m3e-fab-menu>
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @tag m3e-menu-item
|
|
37
|
-
*
|
|
38
|
-
* @slot - Renders the label of the item.
|
|
39
|
-
* @slot icon - Renders an icon before the items's label.
|
|
40
|
-
*
|
|
41
|
-
* @attr disabled - Whether the element is disabled.
|
|
42
|
-
* @attr download - A value indicating whether the `target` of the link button will be downloaded, optionally specifying the new name of the file.
|
|
43
|
-
* @attr href - The URL to which the link button points.
|
|
44
|
-
* @attr rel - The relationship between the `target` of the link button and the document.
|
|
45
|
-
* @attr target - The target of the link button.
|
|
46
|
-
*
|
|
47
|
-
* @fires click - Dispatched when the element is clicked.
|
|
48
|
-
*
|
|
49
|
-
* @cssprop --m3e-fab-menu-item-height - Height of the menu item.
|
|
50
|
-
* @cssprop --m3e-fab-menu-item-font-size - Font size of the menu item label.
|
|
51
|
-
* @cssprop --m3e-fab-menu-item-font-weight - Font weight of the menu item label.
|
|
52
|
-
* @cssprop --m3e-fab-menu-item-line-height - Line height of the menu item label.
|
|
53
|
-
* @cssprop --m3e-fab-menu-item-tracking - Letter spacing of the menu item label.
|
|
54
|
-
* @cssprop --m3e-fab-menu-item-shape - Border radius of the menu item.
|
|
55
|
-
* @cssprop --m3e-fab-menu-item-leading-space - Padding at the start of the menu item.
|
|
56
|
-
* @cssprop --m3e-fab-menu-item-trailing-space - Padding at the end of the menu item.
|
|
57
|
-
* @cssprop --m3e-fab-menu-item-spacing - Gap between icon and label.
|
|
58
|
-
* @cssprop --m3e-fab-menu-item-icon-size - Size of the icon in the menu item.
|
|
59
|
-
*/
|
|
60
|
-
let M3eFabMenuItemElement = class M3eFabMenuItemElement extends KeyboardClick(LinkButton(Disabled(AttachInternals(Role(LitElement, "menuitem"), true)))) {
|
|
61
|
-
constructor() {
|
|
62
|
-
super(...arguments);
|
|
63
|
-
_M3eFabMenuItemElement_instances.add(this);
|
|
64
|
-
/** @private */
|
|
65
|
-
_M3eFabMenuItemElement_clickHandler.set(this, e => __classPrivateFieldGet(this, _M3eFabMenuItemElement_instances, "m", _M3eFabMenuItemElement_handleClick).call(this, e));
|
|
66
|
-
}
|
|
67
|
-
/** The floating action button (FAB) menu to which this item belongs. */
|
|
68
|
-
get menu() {
|
|
69
|
-
return this.closest("m3e-fab-menu");
|
|
70
|
-
}
|
|
71
|
-
/** @inheritdoc */
|
|
72
|
-
connectedCallback() {
|
|
73
|
-
super.connectedCallback();
|
|
74
|
-
this.addEventListener("click", __classPrivateFieldGet(this, _M3eFabMenuItemElement_clickHandler, "f"));
|
|
75
|
-
}
|
|
76
|
-
/** @inheritdoc */
|
|
77
|
-
disconnectedCallback() {
|
|
78
|
-
super.disconnectedCallback();
|
|
79
|
-
this.removeEventListener("click", __classPrivateFieldGet(this, _M3eFabMenuItemElement_clickHandler, "f"));
|
|
80
|
-
}
|
|
81
|
-
/** @inheritdoc */
|
|
82
|
-
firstUpdated(_changedProperties) {
|
|
83
|
-
super.firstUpdated(_changedProperties);
|
|
84
|
-
[this._elevation, this._focusRing, this._stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
85
|
-
}
|
|
86
|
-
/** @inheritdoc */
|
|
87
|
-
render() {
|
|
88
|
-
return html`<div class="base"><m3e-elevation class="elevation" ?disabled="${this.disabled}"></m3e-elevation><m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple><div class="touch" aria-hidden="true"></div>${this[renderPseudoLink]()}<div class="wrapper"><slot class="icon" name="icon" aria-hidden="true"></slot><div class="label"><slot></slot></div></div></div>`;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
_M3eFabMenuItemElement_clickHandler = new WeakMap();
|
|
92
|
-
_M3eFabMenuItemElement_instances = new WeakSet();
|
|
93
|
-
_M3eFabMenuItemElement_handleClick = function _M3eFabMenuItemElement_handleClick(e) {
|
|
94
|
-
if (!e.defaultPrevented) {
|
|
95
|
-
this.menu?.hide(true);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
/** The styles of the element. */
|
|
99
|
-
M3eFabMenuItemElement.styles = css`:host { display: inline-block; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .base { box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; height: var(--m3e-fab-menu-item-height, 3.5rem); font-size: var(--m3e-fab-menu-item-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-fab-menu-item-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-fab-menu-item-line-height, ${DesignToken.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-fab-menu-item-tracking, ${DesignToken.typescale.standard.label.large.tracking}); border-radius: var(--m3e-fab-menu-item-shape, ${DesignToken.shape.corner.full}); } :host(:not(:disabled)) .label, :host(:not(:disabled)) .icon { color: var(--_fab-menu-item-color); } :host(:not(:disabled)) .base { background-color: var(--_fab-menu-item-container-color); --m3e-state-layer-hover-color: var(--_fab-menu-background-hover-color); --m3e-state-layer-focus-color: var(--_fab-menu-background-focus-color); --m3e-ripple-color: var(--_fab-menu-ripple-color); } :host(:disabled) .base { background-color: color-mix( in srgb, var(--m3e-fab-menu-item-disabled-container-color, ${DesignToken.color.onSurface}) var(--m3e-fab-menu-item-disabled-container-opacity, 10%), transparent ); } :host(:disabled) .label, :host(:disabled) .icon { color: color-mix( in srgb, var(--m3e-fab-menu-item-disabled-color, ${DesignToken.color.onSurface}) var(--m3e-fab-menu-item-disabled-opacity, 38%), transparent ); } .touch { position: absolute; height: 3rem; left: 0; right: 0; } .wrapper { width: 100%; overflow: hidden; display: inline-flex; align-items: center; padding-inline-start: var(--m3e-fab-menu-item-leading-space, 1.5rem); padding-inline-end: var(--m3e-fab-menu-item-trailing-space, 1.5rem); column-gap: var(--m3e-fab-menu-item-spacing, 0.5rem); } .label { justify-self: center; flex: 1 1 auto; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } .icon { font-size: var(--m3e-fab-menu-item-icon-size, 1.5rem); transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } :host(:not(:disabled)) { cursor: pointer; } ::slotted([slot="icon"]) { font-size: inherit !important; flex: none; } ::slotted(svg[slot="icon"]) { width: 1em; height: 1em; } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } @media (prefers-reduced-motion) { .base, .label, .icon { transition: none; } } @media (forced-colors: active) { .base, .label, .icon { transition: none; } :host(:not(:disabled)) .base { background-color: Menu; } :host(:not(:disabled)) .label, :host(:not(:disabled)) .icon { color: MenuText; } :host(:disabled) .label, :host(:disabled) .icon { color: GrayText; } }`;
|
|
100
|
-
__decorate([query(".elevation")], M3eFabMenuItemElement.prototype, "_elevation", void 0);
|
|
101
|
-
__decorate([query(".focus-ring")], M3eFabMenuItemElement.prototype, "_focusRing", void 0);
|
|
102
|
-
__decorate([query(".state-layer")], M3eFabMenuItemElement.prototype, "_stateLayer", void 0);
|
|
103
|
-
__decorate([query(".ripple")], M3eFabMenuItemElement.prototype, "_ripple", void 0);
|
|
104
|
-
M3eFabMenuItemElement = __decorate([customElement("m3e-fab-menu-item")], M3eFabMenuItemElement);
|
|
105
|
-
|
|
106
|
-
var _M3eFabMenuElement_instances, _M3eFabMenuElement_fabTabIndex, _M3eFabMenuElement_trigger, _M3eFabMenuElement_anchoringCleanup, _M3eFabMenuElement_listManager, _M3eFabMenuElement_keyDownHandler, _M3eFabMenuElement_documentClickHandler, _M3eFabMenuElement_scrollController, _M3eFabMenuElement_toggleHandler, _M3eFabMenuElement_handleSlotChange, _M3eFabMenuElement_handleKeyDown, _M3eFabMenuElement_handleDocumentClick, _M3eFabMenuElement_attachFab, _M3eFabMenuElement_detachFab;
|
|
14
|
+
var _M3eFabMenuElement_instances, _M3eFabMenuElement_fabTabIndex, _M3eFabMenuElement_trigger, _M3eFabMenuElement_anchoringCleanup, _M3eFabMenuElement_listManager, _M3eFabMenuElement_keyDownHandler, _M3eFabMenuElement_scrollController, _M3eFabMenuElement_clickOutsideController, _M3eFabMenuElement_toggleHandler, _M3eFabMenuElement_handleSlotChange, _M3eFabMenuElement_handleKeyDown, _M3eFabMenuElement_attachFab, _M3eFabMenuElement_detachFab;
|
|
107
15
|
/**
|
|
108
16
|
* A menu, opened from a floating action button (FAB), used to display multiple related actions.
|
|
109
17
|
*
|
|
@@ -172,21 +80,30 @@ let M3eFabMenuElement = class M3eFabMenuElement extends SuppressInitialAnimation
|
|
|
172
80
|
/** @private */
|
|
173
81
|
_M3eFabMenuElement_keyDownHandler.set(this, e => __classPrivateFieldGet(this, _M3eFabMenuElement_instances, "m", _M3eFabMenuElement_handleKeyDown).call(this, e));
|
|
174
82
|
/** @private */
|
|
175
|
-
_M3eFabMenuElement_documentClickHandler.set(this, e => __classPrivateFieldGet(this, _M3eFabMenuElement_instances, "m", _M3eFabMenuElement_handleDocumentClick).call(this, e));
|
|
176
|
-
/** @private */
|
|
177
83
|
_M3eFabMenuElement_scrollController.set(this, new ScrollController(this, {
|
|
178
84
|
target: null,
|
|
179
85
|
callback: () => this.hide()
|
|
180
86
|
}));
|
|
181
87
|
/** @private */
|
|
88
|
+
_M3eFabMenuElement_clickOutsideController.set(this, new ClickOutsideController(this, {
|
|
89
|
+
target: null,
|
|
90
|
+
callback: () => this.hide()
|
|
91
|
+
}));
|
|
92
|
+
/** @private */
|
|
182
93
|
_M3eFabMenuElement_toggleHandler.set(this, e => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
94
|
+
switch (e.newState) {
|
|
95
|
+
case "open":
|
|
96
|
+
__classPrivateFieldGet(this, _M3eFabMenuElement_clickOutsideController, "f").observe(this);
|
|
97
|
+
if (__classPrivateFieldGet(this, _M3eFabMenuElement_trigger, "f")) {
|
|
98
|
+
__classPrivateFieldGet(this, _M3eFabMenuElement_clickOutsideController, "f").observe(__classPrivateFieldGet(this, _M3eFabMenuElement_trigger, "f"));
|
|
99
|
+
}
|
|
100
|
+
setTimeout(() => __classPrivateFieldGet(this, _M3eFabMenuElement_listManager, "f").setActiveItem(__classPrivateFieldGet(this, _M3eFabMenuElement_listManager, "f").items.find(x => !x.disabled)), 40);
|
|
101
|
+
break;
|
|
102
|
+
case "closed":
|
|
103
|
+
__classPrivateFieldGet(this, _M3eFabMenuElement_clickOutsideController, "f").unobserveAll();
|
|
104
|
+
__classPrivateFieldGet(this, _M3eFabMenuElement_anchoringCleanup, "f")?.call(this);
|
|
105
|
+
__classPrivateFieldSet(this, _M3eFabMenuElement_anchoringCleanup, undefined, "f");
|
|
106
|
+
break;
|
|
190
107
|
}
|
|
191
108
|
});
|
|
192
109
|
/**
|
|
@@ -270,14 +187,12 @@ let M3eFabMenuElement = class M3eFabMenuElement extends SuppressInitialAnimation
|
|
|
270
187
|
this.setAttribute("popover", "manual");
|
|
271
188
|
this.addEventListener("keydown", __classPrivateFieldGet(this, _M3eFabMenuElement_keyDownHandler, "f"));
|
|
272
189
|
this.addEventListener("toggle", __classPrivateFieldGet(this, _M3eFabMenuElement_toggleHandler, "f"));
|
|
273
|
-
document.addEventListener("click", __classPrivateFieldGet(this, _M3eFabMenuElement_documentClickHandler, "f"));
|
|
274
190
|
}
|
|
275
191
|
/** @inheritdoc */
|
|
276
192
|
disconnectedCallback() {
|
|
277
193
|
super.disconnectedCallback();
|
|
278
194
|
this.removeEventListener("keydown", __classPrivateFieldGet(this, _M3eFabMenuElement_keyDownHandler, "f"));
|
|
279
195
|
this.removeEventListener("toggle", __classPrivateFieldGet(this, _M3eFabMenuElement_toggleHandler, "f"));
|
|
280
|
-
document.removeEventListener("click", __classPrivateFieldGet(this, _M3eFabMenuElement_documentClickHandler, "f"));
|
|
281
196
|
}
|
|
282
197
|
/** @inheritdoc */
|
|
283
198
|
render() {
|
|
@@ -289,8 +204,8 @@ _M3eFabMenuElement_trigger = new WeakMap();
|
|
|
289
204
|
_M3eFabMenuElement_anchoringCleanup = new WeakMap();
|
|
290
205
|
_M3eFabMenuElement_listManager = new WeakMap();
|
|
291
206
|
_M3eFabMenuElement_keyDownHandler = new WeakMap();
|
|
292
|
-
_M3eFabMenuElement_documentClickHandler = new WeakMap();
|
|
293
207
|
_M3eFabMenuElement_scrollController = new WeakMap();
|
|
208
|
+
_M3eFabMenuElement_clickOutsideController = new WeakMap();
|
|
294
209
|
_M3eFabMenuElement_toggleHandler = new WeakMap();
|
|
295
210
|
_M3eFabMenuElement_instances = new WeakSet();
|
|
296
211
|
_M3eFabMenuElement_handleSlotChange = function _M3eFabMenuElement_handleSlotChange() {
|
|
@@ -316,11 +231,6 @@ _M3eFabMenuElement_handleKeyDown = function _M3eFabMenuElement_handleKeyDown(e)
|
|
|
316
231
|
break;
|
|
317
232
|
}
|
|
318
233
|
};
|
|
319
|
-
_M3eFabMenuElement_handleDocumentClick = function _M3eFabMenuElement_handleDocumentClick(e) {
|
|
320
|
-
if (!e.composedPath().some(x => x instanceof M3eFabMenuItemElement || x === __classPrivateFieldGet(this, _M3eFabMenuElement_trigger, "f"))) {
|
|
321
|
-
this.hide();
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
234
|
_M3eFabMenuElement_attachFab = function _M3eFabMenuElement_attachFab() {
|
|
325
235
|
const fab = __classPrivateFieldGet(this, _M3eFabMenuElement_trigger, "f")?.closest("m3e-fab");
|
|
326
236
|
if (fab) {
|
|
@@ -349,6 +259,98 @@ __decorate([property({
|
|
|
349
259
|
})], M3eFabMenuElement.prototype, "variant", void 0);
|
|
350
260
|
M3eFabMenuElement = __decorate([customElement("m3e-fab-menu")], M3eFabMenuElement);
|
|
351
261
|
|
|
262
|
+
var _M3eFabMenuItemElement_instances, _M3eFabMenuItemElement_clickHandler, _M3eFabMenuItemElement_handleClick;
|
|
263
|
+
/**
|
|
264
|
+
* An item of a floating action button (FAB) menu.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* The following example illustrates triggering a `m3e-fab-menu` from an `m3e-fab` using a `m3e-fab-menu-trigger`.
|
|
268
|
+
* ```html
|
|
269
|
+
* <m3e-fab variant="primary" size="large">
|
|
270
|
+
* <m3e-fab-menu-trigger for="fabmenu">
|
|
271
|
+
* <m3e-icon name="edit"></m3e-icon>
|
|
272
|
+
* </m3e-fab-menu-trigger>
|
|
273
|
+
* </m3e-fab>
|
|
274
|
+
* <m3e-fab-menu id="fabmenu" variant="secondary">
|
|
275
|
+
* <m3e-fab-menu-item>First</m3e-fab-menu-item>
|
|
276
|
+
* <m3e-fab-menu-item>Second</m3e-fab-menu-item>
|
|
277
|
+
* <m3e-fab-menu-item>Third</m3e-fab-menu-item>
|
|
278
|
+
* <m3e-fab-menu-item>Forth</m3e-fab-menu-item>
|
|
279
|
+
* <m3e-fab-menu-item>Fifth</m3e-fab-menu-item>
|
|
280
|
+
* <m3e-fab-menu-item>Sixth</m3e-fab-menu-item>
|
|
281
|
+
* </m3e-fab-menu>
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @tag m3e-menu-item
|
|
285
|
+
*
|
|
286
|
+
* @slot - Renders the label of the item.
|
|
287
|
+
* @slot icon - Renders an icon before the items's label.
|
|
288
|
+
*
|
|
289
|
+
* @attr disabled - Whether the element is disabled.
|
|
290
|
+
* @attr download - A value indicating whether the `target` of the link button will be downloaded, optionally specifying the new name of the file.
|
|
291
|
+
* @attr href - The URL to which the link button points.
|
|
292
|
+
* @attr rel - The relationship between the `target` of the link button and the document.
|
|
293
|
+
* @attr target - The target of the link button.
|
|
294
|
+
*
|
|
295
|
+
* @fires click - Dispatched when the element is clicked.
|
|
296
|
+
*
|
|
297
|
+
* @cssprop --m3e-fab-menu-item-height - Height of the menu item.
|
|
298
|
+
* @cssprop --m3e-fab-menu-item-font-size - Font size of the menu item label.
|
|
299
|
+
* @cssprop --m3e-fab-menu-item-font-weight - Font weight of the menu item label.
|
|
300
|
+
* @cssprop --m3e-fab-menu-item-line-height - Line height of the menu item label.
|
|
301
|
+
* @cssprop --m3e-fab-menu-item-tracking - Letter spacing of the menu item label.
|
|
302
|
+
* @cssprop --m3e-fab-menu-item-shape - Border radius of the menu item.
|
|
303
|
+
* @cssprop --m3e-fab-menu-item-leading-space - Padding at the start of the menu item.
|
|
304
|
+
* @cssprop --m3e-fab-menu-item-trailing-space - Padding at the end of the menu item.
|
|
305
|
+
* @cssprop --m3e-fab-menu-item-spacing - Gap between icon and label.
|
|
306
|
+
* @cssprop --m3e-fab-menu-item-icon-size - Size of the icon in the menu item.
|
|
307
|
+
*/
|
|
308
|
+
let M3eFabMenuItemElement = class M3eFabMenuItemElement extends KeyboardClick(LinkButton(Disabled(AttachInternals(Role(LitElement, "menuitem"), true)))) {
|
|
309
|
+
constructor() {
|
|
310
|
+
super(...arguments);
|
|
311
|
+
_M3eFabMenuItemElement_instances.add(this);
|
|
312
|
+
/** @private */
|
|
313
|
+
_M3eFabMenuItemElement_clickHandler.set(this, e => __classPrivateFieldGet(this, _M3eFabMenuItemElement_instances, "m", _M3eFabMenuItemElement_handleClick).call(this, e));
|
|
314
|
+
}
|
|
315
|
+
/** The floating action button (FAB) menu to which this item belongs. */
|
|
316
|
+
get menu() {
|
|
317
|
+
return this.closest("m3e-fab-menu");
|
|
318
|
+
}
|
|
319
|
+
/** @inheritdoc */
|
|
320
|
+
connectedCallback() {
|
|
321
|
+
super.connectedCallback();
|
|
322
|
+
this.addEventListener("click", __classPrivateFieldGet(this, _M3eFabMenuItemElement_clickHandler, "f"));
|
|
323
|
+
}
|
|
324
|
+
/** @inheritdoc */
|
|
325
|
+
disconnectedCallback() {
|
|
326
|
+
super.disconnectedCallback();
|
|
327
|
+
this.removeEventListener("click", __classPrivateFieldGet(this, _M3eFabMenuItemElement_clickHandler, "f"));
|
|
328
|
+
}
|
|
329
|
+
/** @inheritdoc */
|
|
330
|
+
firstUpdated(_changedProperties) {
|
|
331
|
+
super.firstUpdated(_changedProperties);
|
|
332
|
+
[this._elevation, this._focusRing, this._stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
333
|
+
}
|
|
334
|
+
/** @inheritdoc */
|
|
335
|
+
render() {
|
|
336
|
+
return html`<div class="base"><m3e-elevation class="elevation" ?disabled="${this.disabled}"></m3e-elevation><m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple><div class="touch" aria-hidden="true"></div>${this[renderPseudoLink]()}<div class="wrapper"><slot class="icon" name="icon" aria-hidden="true"></slot><div class="label"><slot></slot></div></div></div>`;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
_M3eFabMenuItemElement_clickHandler = new WeakMap();
|
|
340
|
+
_M3eFabMenuItemElement_instances = new WeakSet();
|
|
341
|
+
_M3eFabMenuItemElement_handleClick = function _M3eFabMenuItemElement_handleClick(e) {
|
|
342
|
+
if (!e.defaultPrevented) {
|
|
343
|
+
this.menu?.hide(true);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
/** The styles of the element. */
|
|
347
|
+
M3eFabMenuItemElement.styles = css`:host { display: inline-block; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .base { box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; height: var(--m3e-fab-menu-item-height, 3.5rem); font-size: var(--m3e-fab-menu-item-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-fab-menu-item-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-fab-menu-item-line-height, ${DesignToken.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-fab-menu-item-tracking, ${DesignToken.typescale.standard.label.large.tracking}); border-radius: var(--m3e-fab-menu-item-shape, ${DesignToken.shape.corner.full}); } :host(:not(:disabled)) .label, :host(:not(:disabled)) .icon { color: var(--_fab-menu-item-color); } :host(:not(:disabled)) .base { background-color: var(--_fab-menu-item-container-color); --m3e-state-layer-hover-color: var(--_fab-menu-background-hover-color); --m3e-state-layer-focus-color: var(--_fab-menu-background-focus-color); --m3e-ripple-color: var(--_fab-menu-ripple-color); } :host(:disabled) .base { background-color: color-mix( in srgb, var(--m3e-fab-menu-item-disabled-container-color, ${DesignToken.color.onSurface}) var(--m3e-fab-menu-item-disabled-container-opacity, 10%), transparent ); } :host(:disabled) .label, :host(:disabled) .icon { color: color-mix( in srgb, var(--m3e-fab-menu-item-disabled-color, ${DesignToken.color.onSurface}) var(--m3e-fab-menu-item-disabled-opacity, 38%), transparent ); } .touch { position: absolute; height: 3rem; left: 0; right: 0; } .wrapper { width: 100%; overflow: hidden; display: inline-flex; align-items: center; padding-inline-start: var(--m3e-fab-menu-item-leading-space, 1.5rem); padding-inline-end: var(--m3e-fab-menu-item-trailing-space, 1.5rem); column-gap: var(--m3e-fab-menu-item-spacing, 0.5rem); } .label { justify-self: center; flex: 1 1 auto; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } .icon { font-size: var(--m3e-fab-menu-item-icon-size, 1.5rem); transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } :host(:not(:disabled)) { cursor: pointer; } ::slotted([slot="icon"]) { font-size: inherit !important; flex: none; } ::slotted(svg[slot="icon"]) { width: 1em; height: 1em; } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } @media (prefers-reduced-motion) { .base, .label, .icon { transition: none; } } @media (forced-colors: active) { .base, .label, .icon { transition: none; } :host(:not(:disabled)) .base { background-color: Menu; } :host(:not(:disabled)) .label, :host(:not(:disabled)) .icon { color: MenuText; } :host(:disabled) .label, :host(:disabled) .icon { color: GrayText; } }`;
|
|
348
|
+
__decorate([query(".elevation")], M3eFabMenuItemElement.prototype, "_elevation", void 0);
|
|
349
|
+
__decorate([query(".focus-ring")], M3eFabMenuItemElement.prototype, "_focusRing", void 0);
|
|
350
|
+
__decorate([query(".state-layer")], M3eFabMenuItemElement.prototype, "_stateLayer", void 0);
|
|
351
|
+
__decorate([query(".ripple")], M3eFabMenuItemElement.prototype, "_ripple", void 0);
|
|
352
|
+
M3eFabMenuItemElement = __decorate([customElement("m3e-fab-menu-item")], M3eFabMenuItemElement);
|
|
353
|
+
|
|
352
354
|
/**
|
|
353
355
|
* An element, nested within a clickable element, used to open a floating action button (FAB) menu.
|
|
354
356
|
*
|