@material/web 1.4.2-nightly.b73792a.0 → 1.4.2-nightly.e1f9cbc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dialog/internal/dialog.d.ts +17 -0
- package/dialog/internal/dialog.js +125 -19
- package/dialog/internal/dialog.js.map +1 -1
- package/internal/aria/aria.d.ts +3 -3
- package/internal/aria/aria.js +2 -1
- package/internal/aria/aria.js.map +1 -1
- package/labs/navigationdrawer/internal/_shared.scss +11 -8
- package/labs/navigationdrawer/internal/shared-styles.css +1 -1
- package/labs/navigationdrawer/internal/shared-styles.css.map +1 -1
- package/labs/navigationdrawer/internal/shared-styles.js +1 -1
- package/labs/navigationdrawer/internal/shared-styles.js.map +1 -1
- package/menu/internal/_menu.scss +2 -0
- package/menu/internal/menu-styles.css +1 -1
- package/menu/internal/menu-styles.css.map +1 -1
- package/menu/internal/menu-styles.js +1 -1
- package/menu/internal/menu-styles.js.map +1 -1
- package/menu/internal/menu.d.ts +2 -0
- package/menu/internal/menu.js +12 -0
- package/menu/internal/menu.js.map +1 -1
- package/package.json +1 -1
- package/switch/internal/switch.js +0 -3
- package/switch/internal/switch.js.map +1 -1
- package/textfield/internal/text-field.js +2 -0
- package/textfield/internal/text-field.js.map +1 -1
|
@@ -38,6 +38,19 @@ export declare class Dialog extends LitElement {
|
|
|
38
38
|
* dialog as an alert dialog.
|
|
39
39
|
*/
|
|
40
40
|
type?: 'alert';
|
|
41
|
+
/**
|
|
42
|
+
* Disables focus trapping, which by default keeps keyboard Tab navigation
|
|
43
|
+
* within the dialog.
|
|
44
|
+
*
|
|
45
|
+
* When disabled, after focusing the last element of a dialog, pressing Tab
|
|
46
|
+
* again will release focus from the window back to the browser (such as the
|
|
47
|
+
* URL bar).
|
|
48
|
+
*
|
|
49
|
+
* Focus trapping is recommended for accessibility, and should not typically
|
|
50
|
+
* be disabled. Only turn this off if the use case of a dialog is more
|
|
51
|
+
* accessible without focus trapping.
|
|
52
|
+
*/
|
|
53
|
+
noFocusTrap: boolean;
|
|
41
54
|
/**
|
|
42
55
|
* Gets the opening animation for a dialog. Set to a new function to customize
|
|
43
56
|
* the animation.
|
|
@@ -63,6 +76,7 @@ export declare class Dialog extends LitElement {
|
|
|
63
76
|
private readonly scroller;
|
|
64
77
|
private readonly topAnchor;
|
|
65
78
|
private readonly bottomAnchor;
|
|
79
|
+
private readonly firstFocusTrap;
|
|
66
80
|
private nextClickIsFromContent;
|
|
67
81
|
private intersectionObserver?;
|
|
68
82
|
private hasHeadline;
|
|
@@ -70,6 +84,7 @@ export declare class Dialog extends LitElement {
|
|
|
70
84
|
private hasIcon;
|
|
71
85
|
private cancelAnimations?;
|
|
72
86
|
private escapePressedWithoutCancel;
|
|
87
|
+
private readonly treewalker;
|
|
73
88
|
constructor();
|
|
74
89
|
/**
|
|
75
90
|
* Opens the dialog and fires a cancelable `open` event. After a dialog's
|
|
@@ -109,4 +124,6 @@ export declare class Dialog extends LitElement {
|
|
|
109
124
|
private handleIconChange;
|
|
110
125
|
private handleAnchorIntersection;
|
|
111
126
|
private getIsConnectedPromise;
|
|
127
|
+
private handleFocusTrapFocus;
|
|
128
|
+
private getFirstAndLastFocusableChildren;
|
|
112
129
|
}
|
|
@@ -22,6 +22,9 @@ import { DIALOG_DEFAULT_CLOSE_ANIMATION, DIALOG_DEFAULT_OPEN_ANIMATION, } from '
|
|
|
22
22
|
* on the scrim or pressing Escape.
|
|
23
23
|
*/
|
|
24
24
|
export class Dialog extends LitElement {
|
|
25
|
+
// We do not use `delegatesFocus: true` due to a Chromium bug with
|
|
26
|
+
// selecting text.
|
|
27
|
+
// See https://bugs.chromium.org/p/chromium/issues/detail?id=950357
|
|
25
28
|
/**
|
|
26
29
|
* Opens the dialog when set to `true` and closes it when set to `false`.
|
|
27
30
|
*/
|
|
@@ -55,6 +58,19 @@ export class Dialog extends LitElement {
|
|
|
55
58
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue
|
|
56
59
|
*/
|
|
57
60
|
this.returnValue = '';
|
|
61
|
+
/**
|
|
62
|
+
* Disables focus trapping, which by default keeps keyboard Tab navigation
|
|
63
|
+
* within the dialog.
|
|
64
|
+
*
|
|
65
|
+
* When disabled, after focusing the last element of a dialog, pressing Tab
|
|
66
|
+
* again will release focus from the window back to the browser (such as the
|
|
67
|
+
* URL bar).
|
|
68
|
+
*
|
|
69
|
+
* Focus trapping is recommended for accessibility, and should not typically
|
|
70
|
+
* be disabled. Only turn this off if the use case of a dialog is more
|
|
71
|
+
* accessible without focus trapping.
|
|
72
|
+
*/
|
|
73
|
+
this.noFocusTrap = false;
|
|
58
74
|
/**
|
|
59
75
|
* Gets the opening animation for a dialog. Set to a new function to customize
|
|
60
76
|
* the animation.
|
|
@@ -89,27 +105,11 @@ export class Dialog extends LitElement {
|
|
|
89
105
|
// in Chromium is fixed to fire 'cancel' with one escape press and close with
|
|
90
106
|
// multiple.
|
|
91
107
|
this.escapePressedWithoutCancel = false;
|
|
108
|
+
// This TreeWalker is used to walk through a dialog's children to find
|
|
109
|
+
// focusable elements. TreeWalker is faster than `querySelectorAll('*')`.
|
|
110
|
+
this.treewalker = document.createTreeWalker(this, NodeFilter.SHOW_ELEMENT);
|
|
92
111
|
if (!isServer) {
|
|
93
112
|
this.addEventListener('submit', this.handleSubmit);
|
|
94
|
-
// We do not use `delegatesFocus: true` due to a Chromium bug with
|
|
95
|
-
// selecting text.
|
|
96
|
-
// See https://bugs.chromium.org/p/chromium/issues/detail?id=950357
|
|
97
|
-
//
|
|
98
|
-
// Material requires using focus trapping within the dialog (see
|
|
99
|
-
// b/314840853 for the bug to add it). This would normally mean we don't
|
|
100
|
-
// care about delegating focus since the `<dialog>` never receives it.
|
|
101
|
-
// However, we still need to handle situations when a user has not
|
|
102
|
-
// provided an focusable child in the content. When that happens, the
|
|
103
|
-
// `<dialog>` itself is focused.
|
|
104
|
-
//
|
|
105
|
-
// Listen to focus/blur instead of focusin/focusout since those can bubble
|
|
106
|
-
// from content.
|
|
107
|
-
this.addEventListener('focus', () => {
|
|
108
|
-
this.dialog?.focus();
|
|
109
|
-
});
|
|
110
|
-
this.addEventListener('blur', () => {
|
|
111
|
-
this.dialog?.blur();
|
|
112
|
-
});
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
@@ -137,6 +137,7 @@ export class Dialog extends LitElement {
|
|
|
137
137
|
const preventOpen = !this.dispatchEvent(new Event('open', { cancelable: true }));
|
|
138
138
|
if (preventOpen) {
|
|
139
139
|
this.open = false;
|
|
140
|
+
this.isOpening = false;
|
|
140
141
|
return;
|
|
141
142
|
}
|
|
142
143
|
// All Material dialogs are modal.
|
|
@@ -208,6 +209,16 @@ export class Dialog extends LitElement {
|
|
|
208
209
|
'show-top-divider': scrollable && !this.isAtScrollTop,
|
|
209
210
|
'show-bottom-divider': scrollable && !this.isAtScrollBottom,
|
|
210
211
|
};
|
|
212
|
+
// The focus trap sentinels are only added after the dialog opens, since
|
|
213
|
+
// dialog.showModal() will try to autofocus them, even with tabindex="-1".
|
|
214
|
+
const showFocusTrap = this.open && !this.noFocusTrap;
|
|
215
|
+
const focusTrap = html `
|
|
216
|
+
<div
|
|
217
|
+
class="focus-trap"
|
|
218
|
+
tabindex="0"
|
|
219
|
+
aria-hidden="true"
|
|
220
|
+
@focus=${this.handleFocusTrapFocus}></div>
|
|
221
|
+
`;
|
|
211
222
|
const { ariaLabel } = this;
|
|
212
223
|
return html `
|
|
213
224
|
<div class="scrim"></div>
|
|
@@ -221,6 +232,7 @@ export class Dialog extends LitElement {
|
|
|
221
232
|
@close=${this.handleClose}
|
|
222
233
|
@keydown=${this.handleKeydown}
|
|
223
234
|
.returnValue=${this.returnValue || nothing}>
|
|
235
|
+
${showFocusTrap ? focusTrap : nothing}
|
|
224
236
|
<div class="container" @click=${this.handleContentClick}>
|
|
225
237
|
<div class="headline">
|
|
226
238
|
<div class="icon" aria-hidden="true">
|
|
@@ -245,6 +257,7 @@ export class Dialog extends LitElement {
|
|
|
245
257
|
<slot name="actions" @slotchange=${this.handleActionsChange}></slot>
|
|
246
258
|
</div>
|
|
247
259
|
</div>
|
|
260
|
+
${showFocusTrap ? focusTrap : nothing}
|
|
248
261
|
</dialog>
|
|
249
262
|
`;
|
|
250
263
|
}
|
|
@@ -383,6 +396,69 @@ export class Dialog extends LitElement {
|
|
|
383
396
|
this.isConnectedPromiseResolve = resolve;
|
|
384
397
|
});
|
|
385
398
|
}
|
|
399
|
+
handleFocusTrapFocus(event) {
|
|
400
|
+
const [firstFocusableChild, lastFocusableChild] = this.getFirstAndLastFocusableChildren();
|
|
401
|
+
if (!firstFocusableChild || !lastFocusableChild) {
|
|
402
|
+
// When a dialog does not have focusable children, the dialog itself
|
|
403
|
+
// receives focus.
|
|
404
|
+
this.dialog?.focus();
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
// To determine which child to focus, we need to know which focus trap
|
|
408
|
+
// received focus...
|
|
409
|
+
const isFirstFocusTrap = event.target === this.firstFocusTrap;
|
|
410
|
+
const isLastFocusTrap = !isFirstFocusTrap;
|
|
411
|
+
// ...and where the focus came from (what was previously focused).
|
|
412
|
+
const focusCameFromFirstChild = event.relatedTarget === firstFocusableChild;
|
|
413
|
+
const focusCameFromLastChild = event.relatedTarget === lastFocusableChild;
|
|
414
|
+
// Although this is a focus trap, focus can come from outside the trap.
|
|
415
|
+
// This can happen when elements are programmatically `focus()`'d. It also
|
|
416
|
+
// happens when focus leaves and returns to the window, such as clicking on
|
|
417
|
+
// the browser's URL bar and pressing Tab, or switching focus between
|
|
418
|
+
// iframes.
|
|
419
|
+
const focusCameFromOutsideDialog = !focusCameFromFirstChild && !focusCameFromLastChild;
|
|
420
|
+
// Focus the dialog's first child when we reach the end of the dialog and
|
|
421
|
+
// focus is moving forward. Or, when focus is moving forwards into the
|
|
422
|
+
// dialog from outside of the window.
|
|
423
|
+
const shouldFocusFirstChild = (isLastFocusTrap && focusCameFromLastChild) ||
|
|
424
|
+
(isFirstFocusTrap && focusCameFromOutsideDialog);
|
|
425
|
+
if (shouldFocusFirstChild) {
|
|
426
|
+
firstFocusableChild.focus();
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
// Focus the dialog's last child when we reach the beginning of the dialog
|
|
430
|
+
// and focus is moving backward. Or, when focus is moving backwards into the
|
|
431
|
+
// dialog from outside of the window.
|
|
432
|
+
const shouldFocusLastChild = (isFirstFocusTrap && focusCameFromFirstChild) ||
|
|
433
|
+
(isLastFocusTrap && focusCameFromOutsideDialog);
|
|
434
|
+
if (shouldFocusLastChild) {
|
|
435
|
+
lastFocusableChild.focus();
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
// The booleans above are verbose for readability, but code executation
|
|
439
|
+
// won't actually reach here.
|
|
440
|
+
}
|
|
441
|
+
getFirstAndLastFocusableChildren() {
|
|
442
|
+
let firstFocusableChild = null;
|
|
443
|
+
let lastFocusableChild = null;
|
|
444
|
+
// Reset the current node back to the root host element.
|
|
445
|
+
this.treewalker.currentNode = this.treewalker.root;
|
|
446
|
+
while (this.treewalker.nextNode()) {
|
|
447
|
+
// Cast as Element since the TreeWalker filter only accepts Elements.
|
|
448
|
+
const nextChild = this.treewalker.currentNode;
|
|
449
|
+
if (!isFocusable(nextChild)) {
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
if (!firstFocusableChild) {
|
|
453
|
+
firstFocusableChild = nextChild;
|
|
454
|
+
}
|
|
455
|
+
lastFocusableChild = nextChild;
|
|
456
|
+
}
|
|
457
|
+
// We set lastFocusableChild immediately after finding a
|
|
458
|
+
// firstFocusableChild, which means the pair is either both null or both
|
|
459
|
+
// non-null. Cast since TypeScript does not recognize this.
|
|
460
|
+
return [firstFocusableChild, lastFocusableChild];
|
|
461
|
+
}
|
|
386
462
|
}
|
|
387
463
|
(() => {
|
|
388
464
|
requestUpdateOnAriaChange(Dialog);
|
|
@@ -399,6 +475,9 @@ __decorate([
|
|
|
399
475
|
__decorate([
|
|
400
476
|
property()
|
|
401
477
|
], Dialog.prototype, "type", void 0);
|
|
478
|
+
__decorate([
|
|
479
|
+
property({ type: Boolean, attribute: 'no-focus-trap' })
|
|
480
|
+
], Dialog.prototype, "noFocusTrap", void 0);
|
|
402
481
|
__decorate([
|
|
403
482
|
query('dialog')
|
|
404
483
|
], Dialog.prototype, "dialog", void 0);
|
|
@@ -432,6 +511,9 @@ __decorate([
|
|
|
432
511
|
__decorate([
|
|
433
512
|
query('.bottom.anchor')
|
|
434
513
|
], Dialog.prototype, "bottomAnchor", void 0);
|
|
514
|
+
__decorate([
|
|
515
|
+
query('.focus-trap')
|
|
516
|
+
], Dialog.prototype, "firstFocusTrap", void 0);
|
|
435
517
|
__decorate([
|
|
436
518
|
state()
|
|
437
519
|
], Dialog.prototype, "hasHeadline", void 0);
|
|
@@ -441,4 +523,28 @@ __decorate([
|
|
|
441
523
|
__decorate([
|
|
442
524
|
state()
|
|
443
525
|
], Dialog.prototype, "hasIcon", void 0);
|
|
526
|
+
function isFocusable(element) {
|
|
527
|
+
// Check if the element is a known built-in focusable element:
|
|
528
|
+
// - <a> and <area> with `href` attributes.
|
|
529
|
+
// - Form controls that are not disabled.
|
|
530
|
+
// - `contenteditable` elements.
|
|
531
|
+
// - Anything with a non-negative `tabindex`.
|
|
532
|
+
const knownFocusableElements = ':is(button,input,select,textarea,object,:is(a,area)[href],[tabindex],[contenteditable=true])';
|
|
533
|
+
const notDisabled = ':not(:disabled,[disabled])';
|
|
534
|
+
const notNegativeTabIndex = ':not([tabindex^="-"])';
|
|
535
|
+
if (element.matches(knownFocusableElements + notDisabled + notNegativeTabIndex)) {
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
const isCustomElement = element.localName.includes('-');
|
|
539
|
+
if (!isCustomElement) {
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
// If a custom element does not have a tabindex, it may still be focusable
|
|
543
|
+
// if it delegates focus with a shadow root. We also need to check again if
|
|
544
|
+
// the custom element is a disabled form control.
|
|
545
|
+
if (!element.matches(notDisabled)) {
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
548
|
+
return element.shadowRoot?.delegatesFocus ?? false;
|
|
549
|
+
}
|
|
444
550
|
//# sourceMappingURL=dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,yBAAyB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,eAAe,EAAC,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,GAG9B,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU;IAKpC;;OAEG;IAEH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,IAAI,CAAC,IAAa;QACpB,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE;YACxB,OAAO;SACR;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI,EAAE,CAAC;SACb;aAAM;YACL,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;IACH,CAAC;IAwED;QACE,KAAK,EAAE,CAAC;QAvEV;;WAE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AgB;AAmBO;IAAjC,KAAK,CAAC,QAAQ,CAAC;sCAAoD;AAClC;IAAjC,KAAK,CAAC,QAAQ,CAAC;qCAAmD;AAC7B;IAArC,KAAK,CAAC,YAAY,CAAC;yCAAuD;AACtC;IAApC,KAAK,CAAC,WAAW,CAAC;wCAAsD;AACrC;IAAnC,KAAK,CAAC,UAAU,CAAC;uCAAqD;AACnC;IAAnC,KAAK,CAAC,UAAU,CAAC;uCAAqD;AACtD;IAAhB,KAAK,EAAE;6CAA+B;AACtB;IAAhB,KAAK,EAAE;gDAAkC;AACL;IAApC,KAAK,CAAC,WAAW,CAAC;wCAAgD;AAC5B;IAAtC,KAAK,CAAC,aAAa,CAAC;yCAAiD;AAC5B;IAAzC,KAAK,CAAC,gBAAgB,CAAC;4CAAoD;AAI3D;IAAhB,KAAK,EAAE;2CAA6B;AACpB;IAAhB,KAAK,EAAE;0CAA4B;AACnB;IAAhB,KAAK,EAAE;uCAAyB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../divider/divider.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\n\nimport {\n DIALOG_DEFAULT_CLOSE_ANIMATION,\n DIALOG_DEFAULT_OPEN_ANIMATION,\n DialogAnimation,\n DialogAnimationArgs,\n} from './animations.js';\n\n/**\n * A dialog component.\n *\n * @fires open {Event} Dispatched when the dialog is opening before any animations.\n * @fires opened {Event} Dispatched when the dialog has opened after any animations.\n * @fires close {Event} Dispatched when the dialog is closing before any animations.\n * @fires closed {Event} Dispatched when the dialog has closed after any animations.\n * @fires cancel {Event} Dispatched when the dialog has been canceled by clicking\n * on the scrim or pressing Escape.\n */\nexport class Dialog extends LitElement {\n static {\n requestUpdateOnAriaChange(Dialog);\n }\n\n /**\n * Opens the dialog when set to `true` and closes it when set to `false`.\n */\n @property({type: Boolean})\n get open() {\n return this.isOpen;\n }\n\n set open(open: boolean) {\n if (open === this.isOpen) {\n return;\n }\n\n this.isOpen = open;\n if (open) {\n this.setAttribute('open', '');\n this.show();\n } else {\n this.removeAttribute('open');\n this.close();\n }\n }\n\n /**\n * Skips the opening and closing animations.\n */\n @property({type: Boolean}) quick = false;\n\n /**\n * Gets or sets the dialog's return value, usually to indicate which button\n * a user pressed to close it.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue\n */\n @property({attribute: false}) returnValue = '';\n\n /**\n * The type of dialog for accessibility. Set this to `alert` to announce a\n * dialog as an alert dialog.\n */\n @property() type?: 'alert';\n\n /**\n * Gets the opening animation for a dialog. Set to a new function to customize\n * the animation.\n */\n getOpenAnimation = () => DIALOG_DEFAULT_OPEN_ANIMATION;\n\n /**\n * Gets the closing animation for a dialog. Set to a new function to customize\n * the animation.\n */\n getCloseAnimation = () => DIALOG_DEFAULT_CLOSE_ANIMATION;\n\n private isOpen = false;\n private isOpening = false;\n // getIsConnectedPromise() immediately sets the resolve property.\n private isConnectedPromiseResolve!: () => void;\n private isConnectedPromise = this.getIsConnectedPromise();\n @query('dialog') private readonly dialog!: HTMLDialogElement | null;\n @query('.scrim') private readonly scrim!: HTMLDialogElement | null;\n @query('.container') private readonly container!: HTMLDialogElement | null;\n @query('.headline') private readonly headline!: HTMLDialogElement | null;\n @query('.content') private readonly content!: HTMLDialogElement | null;\n @query('.actions') private readonly actions!: HTMLDialogElement | null;\n @state() private isAtScrollTop = false;\n @state() private isAtScrollBottom = false;\n @query('.scroller') private readonly scroller!: HTMLElement | null;\n @query('.top.anchor') private readonly topAnchor!: HTMLElement | null;\n @query('.bottom.anchor') private readonly bottomAnchor!: HTMLElement | null;\n private nextClickIsFromContent = false;\n private intersectionObserver?: IntersectionObserver;\n // Dialogs should not be SSR'd while open, so we can just use runtime checks.\n @state() private hasHeadline = false;\n @state() private hasActions = false;\n @state() private hasIcon = false;\n private cancelAnimations?: AbortController;\n\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=1512224\n // Chrome v120 has a bug where escape keys do not trigger cancels. If we get\n // a dialog \"close\" event that is triggered without a \"cancel\" after an escape\n // keydown, then we need to manually trigger our closing logic.\n //\n // This bug occurs when pressing escape to close a dialog without first\n // interacting with the dialog's content.\n //\n // Cleanup tracking:\n // https://github.com/material-components/material-web/issues/5330\n // This can be removed when full CloseWatcher support added and the above bug\n // in Chromium is fixed to fire 'cancel' with one escape press and close with\n // multiple.\n private escapePressedWithoutCancel = false;\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('submit', this.handleSubmit);\n\n // We do not use `delegatesFocus: true` due to a Chromium bug with\n // selecting text.\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=950357\n //\n // Material requires using focus trapping within the dialog (see\n // b/314840853 for the bug to add it). This would normally mean we don't\n // care about delegating focus since the `<dialog>` never receives it.\n // However, we still need to handle situations when a user has not\n // provided an focusable child in the content. When that happens, the\n // `<dialog>` itself is focused.\n //\n // Listen to focus/blur instead of focusin/focusout since those can bubble\n // from content.\n this.addEventListener('focus', () => {\n this.dialog?.focus();\n });\n this.addEventListener('blur', () => {\n this.dialog?.blur();\n });\n }\n }\n\n /**\n * Opens the dialog and fires a cancelable `open` event. After a dialog's\n * animation, an `opened` event is fired.\n *\n * Add an `autofocus` attribute to a child of the dialog that should\n * receive focus after opening.\n *\n * @return A Promise that resolves after the animation is finished and the\n * `opened` event was fired.\n */\n async show() {\n this.isOpening = true;\n // Dialogs can be opened before being attached to the DOM, so we need to\n // wait until we're connected before calling `showModal()`.\n await this.isConnectedPromise;\n await this.updateComplete;\n const dialog = this.dialog!;\n // Check if already opened or if `dialog.close()` was called while awaiting.\n if (dialog.open || !this.isOpening) {\n this.isOpening = false;\n return;\n }\n\n const preventOpen = !this.dispatchEvent(\n new Event('open', {cancelable: true}),\n );\n if (preventOpen) {\n this.open = false;\n return;\n }\n\n // All Material dialogs are modal.\n dialog.showModal();\n this.open = true;\n // Reset scroll position if re-opening a dialog with the same content.\n if (this.scroller) {\n this.scroller.scrollTop = 0;\n }\n // Native modal dialogs ignore autofocus and instead force focus to the\n // first focusable child. Override this behavior if there is a child with\n // an autofocus attribute.\n this.querySelector<HTMLElement>('[autofocus]')?.focus();\n\n await this.animateDialog(this.getOpenAnimation());\n this.dispatchEvent(new Event('opened'));\n this.isOpening = false;\n }\n\n /**\n * Closes the dialog and fires a cancelable `close` event. After a dialog's\n * animation, a `closed` event is fired.\n *\n * @param returnValue A return value usually indicating which button was used\n * to close a dialog. If a dialog is canceled by clicking the scrim or\n * pressing Escape, it will not change the return value after closing.\n * @return A Promise that resolves after the animation is finished and the\n * `closed` event was fired.\n */\n async close(returnValue = this.returnValue) {\n this.isOpening = false;\n if (!this.isConnected) {\n // Disconnected dialogs do not fire close events or animate.\n this.open = false;\n return;\n }\n\n await this.updateComplete;\n const dialog = this.dialog!;\n // Check if already closed or if `dialog.show()` was called while awaiting.\n if (!dialog.open || this.isOpening) {\n this.open = false;\n return;\n }\n\n const prevReturnValue = this.returnValue;\n this.returnValue = returnValue;\n const preventClose = !this.dispatchEvent(\n new Event('close', {cancelable: true}),\n );\n if (preventClose) {\n this.returnValue = prevReturnValue;\n return;\n }\n\n await this.animateDialog(this.getCloseAnimation());\n dialog.close(returnValue);\n this.open = false;\n this.dispatchEvent(new Event('closed'));\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.isConnectedPromiseResolve();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.isConnectedPromise = this.getIsConnectedPromise();\n }\n\n protected override render() {\n const scrollable =\n this.open && !(this.isAtScrollTop && this.isAtScrollBottom);\n const classes = {\n 'has-headline': this.hasHeadline,\n 'has-actions': this.hasActions,\n 'has-icon': this.hasIcon,\n 'scrollable': scrollable,\n 'show-top-divider': scrollable && !this.isAtScrollTop,\n 'show-bottom-divider': scrollable && !this.isAtScrollBottom,\n };\n\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <div class=\"scrim\"></div>\n <dialog\n class=${classMap(classes)}\n aria-label=${ariaLabel || nothing}\n aria-labelledby=${this.hasHeadline ? 'headline' : nothing}\n role=${this.type === 'alert' ? 'alertdialog' : nothing}\n @cancel=${this.handleCancel}\n @click=${this.handleDialogClick}\n @close=${this.handleClose}\n @keydown=${this.handleKeydown}\n .returnValue=${this.returnValue || nothing}>\n <div class=\"container\" @click=${this.handleContentClick}>\n <div class=\"headline\">\n <div class=\"icon\" aria-hidden=\"true\">\n <slot name=\"icon\" @slotchange=${this.handleIconChange}></slot>\n </div>\n <h2 id=\"headline\" aria-hidden=${!this.hasHeadline || nothing}>\n <slot\n name=\"headline\"\n @slotchange=${this.handleHeadlineChange}></slot>\n </h2>\n <md-divider></md-divider>\n </div>\n <div class=\"scroller\">\n <div class=\"content\">\n <div class=\"top anchor\"></div>\n <slot name=\"content\"></slot>\n <div class=\"bottom anchor\"></div>\n </div>\n </div>\n <div class=\"actions\">\n <md-divider></md-divider>\n <slot name=\"actions\" @slotchange=${this.handleActionsChange}></slot>\n </div>\n </div>\n </dialog>\n `;\n }\n\n protected override firstUpdated() {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n this.handleAnchorIntersection(entry);\n }\n },\n {root: this.scroller!},\n );\n\n this.intersectionObserver.observe(this.topAnchor!);\n this.intersectionObserver.observe(this.bottomAnchor!);\n }\n\n private handleDialogClick() {\n if (this.nextClickIsFromContent) {\n // Avoid doing a layout calculation below if we know the click came from\n // content.\n this.nextClickIsFromContent = false;\n return;\n }\n\n // Click originated on the backdrop. Native `<dialog>`s will not cancel,\n // but Material dialogs do.\n const preventDefault = !this.dispatchEvent(\n new Event('cancel', {cancelable: true}),\n );\n if (preventDefault) {\n return;\n }\n\n this.close();\n }\n\n private handleContentClick() {\n this.nextClickIsFromContent = true;\n }\n\n private handleSubmit(event: SubmitEvent) {\n const form = event.target as HTMLFormElement;\n const {submitter} = event;\n if (form.method !== 'dialog' || !submitter) {\n return;\n }\n\n // Close reason is the submitter's value attribute, or the dialog's\n // `returnValue` if there is no attribute.\n this.close(submitter.getAttribute('value') ?? this.returnValue);\n }\n\n private handleCancel(event: Event) {\n if (event.target !== this.dialog) {\n // Ignore any cancel events dispatched by content.\n return;\n }\n\n this.escapePressedWithoutCancel = false;\n const preventDefault = !redispatchEvent(this, event);\n // We always prevent default on the original dialog event since we'll\n // animate closing it before it actually closes.\n event.preventDefault();\n if (preventDefault) {\n return;\n }\n\n this.close();\n }\n\n private handleClose() {\n if (!this.escapePressedWithoutCancel) {\n return;\n }\n\n this.escapePressedWithoutCancel = false;\n this.dialog?.dispatchEvent(new Event('cancel', {cancelable: true}));\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape') {\n return;\n }\n\n // An escape key was pressed. If a \"close\" event fires next without a\n // \"cancel\" event first, then we know we're in the Chrome v120 bug.\n this.escapePressedWithoutCancel = true;\n // Wait a full task for the cancel/close event listeners to fire, then\n // reset the flag.\n setTimeout(() => {\n this.escapePressedWithoutCancel = false;\n });\n }\n\n private async animateDialog(animation: DialogAnimation) {\n // Always cancel the previous animations. Animations can include `fill`\n // modes that need to be cleared when `quick` is toggled. If not, content\n // that faded out will remain hidden when a `quick` dialog re-opens after\n // previously opening and closing without `quick`.\n this.cancelAnimations?.abort();\n this.cancelAnimations = new AbortController();\n if (this.quick) {\n return;\n }\n\n const {dialog, scrim, container, headline, content, actions} = this;\n if (!dialog || !scrim || !container || !headline || !content || !actions) {\n return;\n }\n\n const {\n container: containerAnimate,\n dialog: dialogAnimate,\n scrim: scrimAnimate,\n headline: headlineAnimate,\n content: contentAnimate,\n actions: actionsAnimate,\n } = animation;\n\n const elementAndAnimation: Array<[Element, DialogAnimationArgs[]]> = [\n [dialog, dialogAnimate ?? []],\n [scrim, scrimAnimate ?? []],\n [container, containerAnimate ?? []],\n [headline, headlineAnimate ?? []],\n [content, contentAnimate ?? []],\n [actions, actionsAnimate ?? []],\n ];\n\n const animations: Animation[] = [];\n for (const [element, animation] of elementAndAnimation) {\n for (const animateArgs of animation) {\n const animation = element.animate(...animateArgs);\n this.cancelAnimations.signal.addEventListener('abort', () => {\n animation.cancel();\n });\n\n animations.push(animation);\n }\n }\n\n await Promise.all(\n animations.map((animation) =>\n animation.finished.catch(() => {\n // Ignore intentional AbortErrors when calling `animation.cancel()`.\n }),\n ),\n );\n }\n\n private handleHeadlineChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasHeadline = slot.assignedElements().length > 0;\n }\n\n private handleActionsChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasActions = slot.assignedElements().length > 0;\n }\n\n private handleIconChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasIcon = slot.assignedElements().length > 0;\n }\n\n private handleAnchorIntersection(entry: IntersectionObserverEntry) {\n const {target, isIntersecting} = entry;\n if (target === this.topAnchor) {\n this.isAtScrollTop = isIntersecting;\n }\n\n if (target === this.bottomAnchor) {\n this.isAtScrollBottom = isIntersecting;\n }\n }\n\n private getIsConnectedPromise() {\n return new Promise<void>((resolve) => {\n this.isConnectedPromiseResolve = resolve;\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,yBAAyB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,eAAe,EAAC,MAAM,2C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,GAAG,CAAC,CAAC;IACxD,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,KAAK,CAAC;KACd;IAED,0EAA0E;IAC1E,2EAA2E;IAC3E,iDAAiD;IACjD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACjC,OAAO,KAAK,CAAC;KACd;IAED,OAAO,OAAO,CAAC,UAAU,EAAE,cAAc,IAAI,KAAK,CAAC;AACrD,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../divider/divider.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\n\nimport {\n DIALOG_DEFAULT_CLOSE_ANIMATION,\n DIALOG_DEFAULT_OPEN_ANIMATION,\n DialogAnimation,\n DialogAnimationArgs,\n} from './animations.js';\n\n/**\n * A dialog component.\n *\n * @fires open {Event} Dispatched when the dialog is opening before any animations.\n * @fires opened {Event} Dispatched when the dialog has opened after any animations.\n * @fires close {Event} Dispatched when the dialog is closing before any animations.\n * @fires closed {Event} Dispatched when the dialog has closed after any animations.\n * @fires cancel {Event} Dispatched when the dialog has been canceled by clicking\n * on the scrim or pressing Escape.\n */\nexport class Dialog extends LitElement {\n static {\n requestUpdateOnAriaChange(Dialog);\n }\n\n // We do not use `delegatesFocus: true` due to a Chromium bug with\n // selecting text.\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=950357\n\n /**\n * Opens the dialog when set to `true` and closes it when set to `false`.\n */\n @property({type: Boolean})\n get open() {\n return this.isOpen;\n }\n\n set open(open: boolean) {\n if (open === this.isOpen) {\n return;\n }\n\n this.isOpen = open;\n if (open) {\n this.setAttribute('open', '');\n this.show();\n } else {\n this.removeAttribute('open');\n this.close();\n }\n }\n\n /**\n * Skips the opening and closing animations.\n */\n @property({type: Boolean}) quick = false;\n\n /**\n * Gets or sets the dialog's return value, usually to indicate which button\n * a user pressed to close it.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue\n */\n @property({attribute: false}) returnValue = '';\n\n /**\n * The type of dialog for accessibility. Set this to `alert` to announce a\n * dialog as an alert dialog.\n */\n @property() type?: 'alert';\n\n /**\n * Disables focus trapping, which by default keeps keyboard Tab navigation\n * within the dialog.\n *\n * When disabled, after focusing the last element of a dialog, pressing Tab\n * again will release focus from the window back to the browser (such as the\n * URL bar).\n *\n * Focus trapping is recommended for accessibility, and should not typically\n * be disabled. Only turn this off if the use case of a dialog is more\n * accessible without focus trapping.\n */\n @property({type: Boolean, attribute: 'no-focus-trap'})\n noFocusTrap = false;\n\n /**\n * Gets the opening animation for a dialog. Set to a new function to customize\n * the animation.\n */\n getOpenAnimation = () => DIALOG_DEFAULT_OPEN_ANIMATION;\n\n /**\n * Gets the closing animation for a dialog. Set to a new function to customize\n * the animation.\n */\n getCloseAnimation = () => DIALOG_DEFAULT_CLOSE_ANIMATION;\n\n private isOpen = false;\n private isOpening = false;\n // getIsConnectedPromise() immediately sets the resolve property.\n private isConnectedPromiseResolve!: () => void;\n private isConnectedPromise = this.getIsConnectedPromise();\n @query('dialog') private readonly dialog!: HTMLDialogElement | null;\n @query('.scrim') private readonly scrim!: HTMLDialogElement | null;\n @query('.container') private readonly container!: HTMLDialogElement | null;\n @query('.headline') private readonly headline!: HTMLDialogElement | null;\n @query('.content') private readonly content!: HTMLDialogElement | null;\n @query('.actions') private readonly actions!: HTMLDialogElement | null;\n @state() private isAtScrollTop = false;\n @state() private isAtScrollBottom = false;\n @query('.scroller') private readonly scroller!: HTMLElement | null;\n @query('.top.anchor') private readonly topAnchor!: HTMLElement | null;\n @query('.bottom.anchor') private readonly bottomAnchor!: HTMLElement | null;\n @query('.focus-trap')\n private readonly firstFocusTrap!: HTMLElement | null;\n private nextClickIsFromContent = false;\n private intersectionObserver?: IntersectionObserver;\n // Dialogs should not be SSR'd while open, so we can just use runtime checks.\n @state() private hasHeadline = false;\n @state() private hasActions = false;\n @state() private hasIcon = false;\n private cancelAnimations?: AbortController;\n\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=1512224\n // Chrome v120 has a bug where escape keys do not trigger cancels. If we get\n // a dialog \"close\" event that is triggered without a \"cancel\" after an escape\n // keydown, then we need to manually trigger our closing logic.\n //\n // This bug occurs when pressing escape to close a dialog without first\n // interacting with the dialog's content.\n //\n // Cleanup tracking:\n // https://github.com/material-components/material-web/issues/5330\n // This can be removed when full CloseWatcher support added and the above bug\n // in Chromium is fixed to fire 'cancel' with one escape press and close with\n // multiple.\n private escapePressedWithoutCancel = false;\n // This TreeWalker is used to walk through a dialog's children to find\n // focusable elements. TreeWalker is faster than `querySelectorAll('*')`.\n private readonly treewalker = document.createTreeWalker(\n this,\n NodeFilter.SHOW_ELEMENT,\n );\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('submit', this.handleSubmit);\n }\n }\n\n /**\n * Opens the dialog and fires a cancelable `open` event. After a dialog's\n * animation, an `opened` event is fired.\n *\n * Add an `autofocus` attribute to a child of the dialog that should\n * receive focus after opening.\n *\n * @return A Promise that resolves after the animation is finished and the\n * `opened` event was fired.\n */\n async show() {\n this.isOpening = true;\n // Dialogs can be opened before being attached to the DOM, so we need to\n // wait until we're connected before calling `showModal()`.\n await this.isConnectedPromise;\n await this.updateComplete;\n const dialog = this.dialog!;\n // Check if already opened or if `dialog.close()` was called while awaiting.\n if (dialog.open || !this.isOpening) {\n this.isOpening = false;\n return;\n }\n\n const preventOpen = !this.dispatchEvent(\n new Event('open', {cancelable: true}),\n );\n if (preventOpen) {\n this.open = false;\n this.isOpening = false;\n return;\n }\n\n // All Material dialogs are modal.\n dialog.showModal();\n this.open = true;\n // Reset scroll position if re-opening a dialog with the same content.\n if (this.scroller) {\n this.scroller.scrollTop = 0;\n }\n // Native modal dialogs ignore autofocus and instead force focus to the\n // first focusable child. Override this behavior if there is a child with\n // an autofocus attribute.\n this.querySelector<HTMLElement>('[autofocus]')?.focus();\n\n await this.animateDialog(this.getOpenAnimation());\n this.dispatchEvent(new Event('opened'));\n this.isOpening = false;\n }\n\n /**\n * Closes the dialog and fires a cancelable `close` event. After a dialog's\n * animation, a `closed` event is fired.\n *\n * @param returnValue A return value usually indicating which button was used\n * to close a dialog. If a dialog is canceled by clicking the scrim or\n * pressing Escape, it will not change the return value after closing.\n * @return A Promise that resolves after the animation is finished and the\n * `closed` event was fired.\n */\n async close(returnValue = this.returnValue) {\n this.isOpening = false;\n if (!this.isConnected) {\n // Disconnected dialogs do not fire close events or animate.\n this.open = false;\n return;\n }\n\n await this.updateComplete;\n const dialog = this.dialog!;\n // Check if already closed or if `dialog.show()` was called while awaiting.\n if (!dialog.open || this.isOpening) {\n this.open = false;\n return;\n }\n\n const prevReturnValue = this.returnValue;\n this.returnValue = returnValue;\n const preventClose = !this.dispatchEvent(\n new Event('close', {cancelable: true}),\n );\n if (preventClose) {\n this.returnValue = prevReturnValue;\n return;\n }\n\n await this.animateDialog(this.getCloseAnimation());\n dialog.close(returnValue);\n this.open = false;\n this.dispatchEvent(new Event('closed'));\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.isConnectedPromiseResolve();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.isConnectedPromise = this.getIsConnectedPromise();\n }\n\n protected override render() {\n const scrollable =\n this.open && !(this.isAtScrollTop && this.isAtScrollBottom);\n const classes = {\n 'has-headline': this.hasHeadline,\n 'has-actions': this.hasActions,\n 'has-icon': this.hasIcon,\n 'scrollable': scrollable,\n 'show-top-divider': scrollable && !this.isAtScrollTop,\n 'show-bottom-divider': scrollable && !this.isAtScrollBottom,\n };\n\n // The focus trap sentinels are only added after the dialog opens, since\n // dialog.showModal() will try to autofocus them, even with tabindex=\"-1\".\n const showFocusTrap = this.open && !this.noFocusTrap;\n const focusTrap = html`\n <div\n class=\"focus-trap\"\n tabindex=\"0\"\n aria-hidden=\"true\"\n @focus=${this.handleFocusTrapFocus}></div>\n `;\n\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <div class=\"scrim\"></div>\n <dialog\n class=${classMap(classes)}\n aria-label=${ariaLabel || nothing}\n aria-labelledby=${this.hasHeadline ? 'headline' : nothing}\n role=${this.type === 'alert' ? 'alertdialog' : nothing}\n @cancel=${this.handleCancel}\n @click=${this.handleDialogClick}\n @close=${this.handleClose}\n @keydown=${this.handleKeydown}\n .returnValue=${this.returnValue || nothing}>\n ${showFocusTrap ? focusTrap : nothing}\n <div class=\"container\" @click=${this.handleContentClick}>\n <div class=\"headline\">\n <div class=\"icon\" aria-hidden=\"true\">\n <slot name=\"icon\" @slotchange=${this.handleIconChange}></slot>\n </div>\n <h2 id=\"headline\" aria-hidden=${!this.hasHeadline || nothing}>\n <slot\n name=\"headline\"\n @slotchange=${this.handleHeadlineChange}></slot>\n </h2>\n <md-divider></md-divider>\n </div>\n <div class=\"scroller\">\n <div class=\"content\">\n <div class=\"top anchor\"></div>\n <slot name=\"content\"></slot>\n <div class=\"bottom anchor\"></div>\n </div>\n </div>\n <div class=\"actions\">\n <md-divider></md-divider>\n <slot name=\"actions\" @slotchange=${this.handleActionsChange}></slot>\n </div>\n </div>\n ${showFocusTrap ? focusTrap : nothing}\n </dialog>\n `;\n }\n\n protected override firstUpdated() {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n this.handleAnchorIntersection(entry);\n }\n },\n {root: this.scroller!},\n );\n\n this.intersectionObserver.observe(this.topAnchor!);\n this.intersectionObserver.observe(this.bottomAnchor!);\n }\n\n private handleDialogClick() {\n if (this.nextClickIsFromContent) {\n // Avoid doing a layout calculation below if we know the click came from\n // content.\n this.nextClickIsFromContent = false;\n return;\n }\n\n // Click originated on the backdrop. Native `<dialog>`s will not cancel,\n // but Material dialogs do.\n const preventDefault = !this.dispatchEvent(\n new Event('cancel', {cancelable: true}),\n );\n if (preventDefault) {\n return;\n }\n\n this.close();\n }\n\n private handleContentClick() {\n this.nextClickIsFromContent = true;\n }\n\n private handleSubmit(event: SubmitEvent) {\n const form = event.target as HTMLFormElement;\n const {submitter} = event;\n if (form.method !== 'dialog' || !submitter) {\n return;\n }\n\n // Close reason is the submitter's value attribute, or the dialog's\n // `returnValue` if there is no attribute.\n this.close(submitter.getAttribute('value') ?? this.returnValue);\n }\n\n private handleCancel(event: Event) {\n if (event.target !== this.dialog) {\n // Ignore any cancel events dispatched by content.\n return;\n }\n\n this.escapePressedWithoutCancel = false;\n const preventDefault = !redispatchEvent(this, event);\n // We always prevent default on the original dialog event since we'll\n // animate closing it before it actually closes.\n event.preventDefault();\n if (preventDefault) {\n return;\n }\n\n this.close();\n }\n\n private handleClose() {\n if (!this.escapePressedWithoutCancel) {\n return;\n }\n\n this.escapePressedWithoutCancel = false;\n this.dialog?.dispatchEvent(new Event('cancel', {cancelable: true}));\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape') {\n return;\n }\n\n // An escape key was pressed. If a \"close\" event fires next without a\n // \"cancel\" event first, then we know we're in the Chrome v120 bug.\n this.escapePressedWithoutCancel = true;\n // Wait a full task for the cancel/close event listeners to fire, then\n // reset the flag.\n setTimeout(() => {\n this.escapePressedWithoutCancel = false;\n });\n }\n\n private async animateDialog(animation: DialogAnimation) {\n // Always cancel the previous animations. Animations can include `fill`\n // modes that need to be cleared when `quick` is toggled. If not, content\n // that faded out will remain hidden when a `quick` dialog re-opens after\n // previously opening and closing without `quick`.\n this.cancelAnimations?.abort();\n this.cancelAnimations = new AbortController();\n if (this.quick) {\n return;\n }\n\n const {dialog, scrim, container, headline, content, actions} = this;\n if (!dialog || !scrim || !container || !headline || !content || !actions) {\n return;\n }\n\n const {\n container: containerAnimate,\n dialog: dialogAnimate,\n scrim: scrimAnimate,\n headline: headlineAnimate,\n content: contentAnimate,\n actions: actionsAnimate,\n } = animation;\n\n const elementAndAnimation: Array<[Element, DialogAnimationArgs[]]> = [\n [dialog, dialogAnimate ?? []],\n [scrim, scrimAnimate ?? []],\n [container, containerAnimate ?? []],\n [headline, headlineAnimate ?? []],\n [content, contentAnimate ?? []],\n [actions, actionsAnimate ?? []],\n ];\n\n const animations: Animation[] = [];\n for (const [element, animation] of elementAndAnimation) {\n for (const animateArgs of animation) {\n const animation = element.animate(...animateArgs);\n this.cancelAnimations.signal.addEventListener('abort', () => {\n animation.cancel();\n });\n\n animations.push(animation);\n }\n }\n\n await Promise.all(\n animations.map((animation) =>\n animation.finished.catch(() => {\n // Ignore intentional AbortErrors when calling `animation.cancel()`.\n }),\n ),\n );\n }\n\n private handleHeadlineChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasHeadline = slot.assignedElements().length > 0;\n }\n\n private handleActionsChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasActions = slot.assignedElements().length > 0;\n }\n\n private handleIconChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasIcon = slot.assignedElements().length > 0;\n }\n\n private handleAnchorIntersection(entry: IntersectionObserverEntry) {\n const {target, isIntersecting} = entry;\n if (target === this.topAnchor) {\n this.isAtScrollTop = isIntersecting;\n }\n\n if (target === this.bottomAnchor) {\n this.isAtScrollBottom = isIntersecting;\n }\n }\n\n private getIsConnectedPromise() {\n return new Promise<void>((resolve) => {\n this.isConnectedPromiseResolve = resolve;\n });\n }\n\n private handleFocusTrapFocus(event: FocusEvent) {\n const [firstFocusableChild, lastFocusableChild] =\n this.getFirstAndLastFocusableChildren();\n if (!firstFocusableChild || !lastFocusableChild) {\n // When a dialog does not have focusable children, the dialog itself\n // receives focus.\n this.dialog?.focus();\n return;\n }\n\n // To determine which child to focus, we need to know which focus trap\n // received focus...\n const isFirstFocusTrap = event.target === this.firstFocusTrap;\n const isLastFocusTrap = !isFirstFocusTrap;\n // ...and where the focus came from (what was previously focused).\n const focusCameFromFirstChild = event.relatedTarget === firstFocusableChild;\n const focusCameFromLastChild = event.relatedTarget === lastFocusableChild;\n // Although this is a focus trap, focus can come from outside the trap.\n // This can happen when elements are programmatically `focus()`'d. It also\n // happens when focus leaves and returns to the window, such as clicking on\n // the browser's URL bar and pressing Tab, or switching focus between\n // iframes.\n const focusCameFromOutsideDialog =\n !focusCameFromFirstChild && !focusCameFromLastChild;\n\n // Focus the dialog's first child when we reach the end of the dialog and\n // focus is moving forward. Or, when focus is moving forwards into the\n // dialog from outside of the window.\n const shouldFocusFirstChild =\n (isLastFocusTrap && focusCameFromLastChild) ||\n (isFirstFocusTrap && focusCameFromOutsideDialog);\n if (shouldFocusFirstChild) {\n firstFocusableChild.focus();\n return;\n }\n\n // Focus the dialog's last child when we reach the beginning of the dialog\n // and focus is moving backward. Or, when focus is moving backwards into the\n // dialog from outside of the window.\n const shouldFocusLastChild =\n (isFirstFocusTrap && focusCameFromFirstChild) ||\n (isLastFocusTrap && focusCameFromOutsideDialog);\n if (shouldFocusLastChild) {\n lastFocusableChild.focus();\n return;\n }\n\n // The booleans above are verbose for readability, but code executation\n // won't actually reach here.\n }\n\n private getFirstAndLastFocusableChildren() {\n let firstFocusableChild: HTMLElement | null = null;\n let lastFocusableChild: HTMLElement | null = null;\n\n // Reset the current node back to the root host element.\n this.treewalker.currentNode = this.treewalker.root;\n while (this.treewalker.nextNode()) {\n // Cast as Element since the TreeWalker filter only accepts Elements.\n const nextChild = this.treewalker.currentNode as Element;\n if (!isFocusable(nextChild)) {\n continue;\n }\n\n if (!firstFocusableChild) {\n firstFocusableChild = nextChild;\n }\n\n lastFocusableChild = nextChild;\n }\n\n // We set lastFocusableChild immediately after finding a\n // firstFocusableChild, which means the pair is either both null or both\n // non-null. Cast since TypeScript does not recognize this.\n return [firstFocusableChild, lastFocusableChild] as\n | [HTMLElement, HTMLElement]\n | [null, null];\n }\n}\n\nfunction isFocusable(element: Element): element is HTMLElement {\n // Check if the element is a known built-in focusable element:\n // - <a> and <area> with `href` attributes.\n // - Form controls that are not disabled.\n // - `contenteditable` elements.\n // - Anything with a non-negative `tabindex`.\n const knownFocusableElements =\n ':is(button,input,select,textarea,object,:is(a,area)[href],[tabindex],[contenteditable=true])';\n const notDisabled = ':not(:disabled,[disabled])';\n const notNegativeTabIndex = ':not([tabindex^=\"-\"])';\n if (\n element.matches(knownFocusableElements + notDisabled + notNegativeTabIndex)\n ) {\n return true;\n }\n\n const isCustomElement = element.localName.includes('-');\n if (!isCustomElement) {\n return false;\n }\n\n // If a custom element does not have a tabindex, it may still be focusable\n // if it delegates focus with a shadow root. We also need to check again if\n // the custom element is a disabled form control.\n if (!element.matches(notDisabled)) {\n return false;\n }\n\n return element.shadowRoot?.delegatesFocus ?? false;\n}\n"]}
|
package/internal/aria/aria.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Accessibility Object Model reflective aria property name types.
|
|
8
8
|
*/
|
|
9
|
-
export type ARIAProperty =
|
|
9
|
+
export type ARIAProperty = keyof ARIAMixin;
|
|
10
10
|
/**
|
|
11
11
|
* Accessibility Object Model reflective aria properties.
|
|
12
12
|
*/
|
|
@@ -18,7 +18,7 @@ export type ARIAAttribute = ARIAPropertyToAttribute<ARIAProperty>;
|
|
|
18
18
|
/**
|
|
19
19
|
* Accessibility Object Model aria attributes.
|
|
20
20
|
*/
|
|
21
|
-
export declare const ARIA_ATTRIBUTES: ("aria-hidden" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-disabled" | "aria-expanded" | "aria-haspopup" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext")[];
|
|
21
|
+
export declare const ARIA_ATTRIBUTES: ("role" | "aria-hidden" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-disabled" | "aria-expanded" | "aria-haspopup" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext")[];
|
|
22
22
|
/**
|
|
23
23
|
* Checks if an attribute is one of the AOM aria attributes.
|
|
24
24
|
*
|
|
@@ -38,7 +38,7 @@ export declare function isAriaAttribute(attribute: string): attribute is ARIAAtt
|
|
|
38
38
|
* @param property The aria property.
|
|
39
39
|
* @return The aria attribute.
|
|
40
40
|
*/
|
|
41
|
-
export declare function ariaPropertyToAttribute<K extends ARIAProperty
|
|
41
|
+
export declare function ariaPropertyToAttribute<K extends ARIAProperty>(property: K): ARIAPropertyToAttribute<K>;
|
|
42
42
|
type ARIAPropertyToAttribute<K extends string> = K extends `aria${infer Suffix}Element${infer OptS}` ? `aria-${Lowercase<Suffix>}` : K extends `aria${infer Suffix}` ? `aria-${Lowercase<Suffix>}` : K;
|
|
43
43
|
/**
|
|
44
44
|
* An extension of `ARIAMixin` that enforces strict value types for aria
|
package/internal/aria/aria.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Accessibility Object Model reflective aria properties.
|
|
8
8
|
*/
|
|
9
9
|
export const ARIA_PROPERTIES = [
|
|
10
|
+
'role',
|
|
10
11
|
'ariaAtomic',
|
|
11
12
|
'ariaAutoComplete',
|
|
12
13
|
'ariaBusy',
|
|
@@ -59,7 +60,7 @@ export const ARIA_ATTRIBUTES = ARIA_PROPERTIES.map(ariaPropertyToAttribute);
|
|
|
59
60
|
* @return True if the attribute is an aria attribute, or false if not.
|
|
60
61
|
*/
|
|
61
62
|
export function isAriaAttribute(attribute) {
|
|
62
|
-
return attribute.startsWith('aria-');
|
|
63
|
+
return attribute.startsWith('aria-') || attribute === 'role';
|
|
63
64
|
}
|
|
64
65
|
/**
|
|
65
66
|
* Converts an AOM aria property into its corresponding attribute.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aria.js","sourceRoot":"","sources":["aria.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,YAAY;IACZ,kBAAkB;IAClB,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;IACd,aAAa;IACb,aAAa;IACb,cAAc;IACd,cAAc;IACd,cAAc;IACd,YAAY;IACZ,aAAa;IACb,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,UAAU;IACV,WAAW;IACX,eAAe;IACf,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,aAAa;IACb,cAAc;IACd,cAAc;IACd,qBAAqB;IACrB,cAAc;IACd,cAAc;IACd,aAAa;IACb,cAAc;IACd,aAAa;IACb,UAAU;IACV,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;CAChB,CAAC;AAOF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"aria.js","sourceRoot":"","sources":["aria.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,MAAM;IACN,YAAY;IACZ,kBAAkB;IAClB,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;IACd,aAAa;IACb,aAAa;IACb,cAAc;IACd,cAAc;IACd,cAAc;IACd,YAAY;IACZ,aAAa;IACb,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,UAAU;IACV,WAAW;IACX,eAAe;IACf,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,aAAa;IACb,cAAc;IACd,cAAc;IACd,qBAAqB;IACrB,cAAc;IACd,cAAc;IACd,aAAa;IACb,cAAc;IACd,aAAa;IACb,UAAU;IACV,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;CAChB,CAAC;AAOF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,SAAS,KAAK,MAAM,CAAC;AAC/D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAyB,QAAW;IACzE,OACE,QAAQ;SACL,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC;QACzB,kEAAkE;SACjE,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;SACzB,WAAW,EACf,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Accessibility Object Model reflective aria property name types.\n */\nexport type ARIAProperty = keyof ARIAMixin;\n\n/**\n * Accessibility Object Model reflective aria properties.\n */\nexport const ARIA_PROPERTIES: ARIAProperty[] = [\n 'role',\n 'ariaAtomic',\n 'ariaAutoComplete',\n 'ariaBusy',\n 'ariaChecked',\n 'ariaColCount',\n 'ariaColIndex',\n 'ariaColSpan',\n 'ariaCurrent',\n 'ariaDisabled',\n 'ariaExpanded',\n 'ariaHasPopup',\n 'ariaHidden',\n 'ariaInvalid',\n 'ariaKeyShortcuts',\n 'ariaLabel',\n 'ariaLevel',\n 'ariaLive',\n 'ariaModal',\n 'ariaMultiLine',\n 'ariaMultiSelectable',\n 'ariaOrientation',\n 'ariaPlaceholder',\n 'ariaPosInSet',\n 'ariaPressed',\n 'ariaReadOnly',\n 'ariaRequired',\n 'ariaRoleDescription',\n 'ariaRowCount',\n 'ariaRowIndex',\n 'ariaRowSpan',\n 'ariaSelected',\n 'ariaSetSize',\n 'ariaSort',\n 'ariaValueMax',\n 'ariaValueMin',\n 'ariaValueNow',\n 'ariaValueText',\n];\n\n/**\n * Accessibility Object Model aria attribute name types.\n */\nexport type ARIAAttribute = ARIAPropertyToAttribute<ARIAProperty>;\n\n/**\n * Accessibility Object Model aria attributes.\n */\nexport const ARIA_ATTRIBUTES = ARIA_PROPERTIES.map(ariaPropertyToAttribute);\n\n/**\n * Checks if an attribute is one of the AOM aria attributes.\n *\n * @example\n * isAriaAttribute('aria-label'); // true\n *\n * @param attribute The attribute to check.\n * @return True if the attribute is an aria attribute, or false if not.\n */\nexport function isAriaAttribute(attribute: string): attribute is ARIAAttribute {\n return attribute.startsWith('aria-') || attribute === 'role';\n}\n\n/**\n * Converts an AOM aria property into its corresponding attribute.\n *\n * @example\n * ariaPropertyToAttribute('ariaLabel'); // 'aria-label'\n *\n * @param property The aria property.\n * @return The aria attribute.\n */\nexport function ariaPropertyToAttribute<K extends ARIAProperty>(property: K) {\n return (\n property\n .replace('aria', 'aria-')\n // IDREF attributes also include an \"Element\" or \"Elements\" suffix\n .replace(/Elements?/g, '')\n .toLowerCase() as ARIAPropertyToAttribute<K>\n );\n}\n\n// Converts an `ariaFoo` string type to an `aria-foo` string type.\ntype ARIAPropertyToAttribute<K extends string> =\n K extends `aria${infer Suffix}Element${infer OptS}`\n ? `aria-${Lowercase<Suffix>}`\n : K extends `aria${infer Suffix}`\n ? `aria-${Lowercase<Suffix>}`\n : K;\n\n/**\n * An extension of `ARIAMixin` that enforces strict value types for aria\n * properties.\n *\n * This is needed for correct typing in render functions with lit analyzer.\n *\n * @example\n * render() {\n * const {ariaLabel} = this as ARIAMixinStrict;\n * return html`\n * <button aria-label=${ariaLabel || nothing}>\n * <slot></slot>\n * </button>\n * `;\n * }\n */\nexport interface ARIAMixinStrict extends ARIAMixin {\n ariaAtomic: 'true' | 'false' | null;\n ariaAutoComplete: 'none' | 'inline' | 'list' | 'both' | null;\n ariaBusy: 'true' | 'false' | null;\n ariaChecked: 'true' | 'false' | null;\n ariaColCount: `${number}` | null;\n ariaColIndex: `${number}` | null;\n ariaColSpan: `${number}` | null;\n ariaCurrent:\n | 'page'\n | 'step'\n | 'location'\n | 'date'\n | 'time'\n | 'true'\n | 'false'\n | null;\n ariaDisabled: 'true' | 'false' | null;\n ariaExpanded: 'true' | 'false' | null;\n ariaHasPopup:\n | 'false'\n | 'true'\n | 'menu'\n | 'listbox'\n | 'tree'\n | 'grid'\n | 'dialog'\n | null;\n ariaHidden: 'true' | 'false' | null;\n ariaInvalid: 'true' | 'false' | null;\n ariaKeyShortcuts: string | null;\n ariaLabel: string | null;\n ariaLevel: `${number}` | null;\n ariaLive: 'assertive' | 'off' | 'polite' | null;\n ariaModal: 'true' | 'false' | null;\n ariaMultiLine: 'true' | 'false' | null;\n ariaMultiSelectable: 'true' | 'false' | null;\n ariaOrientation: 'horizontal' | 'vertical' | 'undefined' | null;\n ariaPlaceholder: string | null;\n ariaPosInSet: `${number}` | null;\n ariaPressed: 'true' | 'false' | null;\n ariaReadOnly: 'true' | 'false' | null;\n ariaRequired: 'true' | 'false' | null;\n ariaRoleDescription: string | null;\n ariaRowCount: `${number}` | null;\n ariaRowIndex: `${number}` | null;\n ariaRowSpan: `${number}` | null;\n ariaSelected: 'true' | 'false' | null;\n ariaSetSize: `${number}` | null;\n ariaSort: 'ascending' | 'descending' | 'none' | 'other' | null;\n ariaValueMax: `${number}` | null;\n ariaValueMin: `${number}` | null;\n ariaValueNow: `${number}` | null;\n ariaValueText: string | null;\n role: ARIARole | null;\n}\n\n/**\n * Valid values for `role`.\n */\nexport type ARIARole =\n | 'alert'\n | 'alertdialog'\n | 'button'\n | 'checkbox'\n | 'dialog'\n | 'gridcell'\n | 'link'\n | 'log'\n | 'marquee'\n | 'menuitem'\n | 'menuitemcheckbox'\n | 'menuitemradio'\n | 'option'\n | 'progressbar'\n | 'radio'\n | 'scrollbar'\n | 'searchbox'\n | 'slider'\n | 'spinbutton'\n | 'status'\n | 'switch'\n | 'tab'\n | 'tabpanel'\n | 'textbox'\n | 'timer'\n | 'tooltip'\n | 'treeitem'\n | 'combobox'\n | 'grid'\n | 'listbox'\n | 'menu'\n | 'menubar'\n | 'radiogroup'\n | 'tablist'\n | 'tree'\n | 'treegrid'\n | 'application'\n | 'article'\n | 'cell'\n | 'columnheader'\n | 'definition'\n | 'directory'\n | 'document'\n | 'feed'\n | 'figure'\n | 'group'\n | 'heading'\n | 'img'\n | 'list'\n | 'listitem'\n | 'math'\n | 'none'\n | 'note'\n | 'presentation'\n | 'region'\n | 'row'\n | 'rowgroup'\n | 'rowheader'\n | 'separator'\n | 'table'\n | 'term'\n | 'text'\n | 'toolbar'\n | 'banner'\n | 'complementary'\n | 'contentinfo'\n | 'form'\n | 'main'\n | 'navigation'\n | 'region'\n | 'search'\n | 'doc-abstract'\n | 'doc-acknowledgments'\n | 'doc-afterword'\n | 'doc-appendix'\n | 'doc-backlink'\n | 'doc-biblioentry'\n | 'doc-bibliography'\n | 'doc-biblioref'\n | 'doc-chapter'\n | 'doc-colophon'\n | 'doc-conclusion'\n | 'doc-cover'\n | 'doc-credit'\n | 'doc-credits'\n | 'doc-dedication'\n | 'doc-endnote'\n | 'doc-endnotes'\n | 'doc-epigraph'\n | 'doc-epilogue'\n | 'doc-errata'\n | 'doc-example'\n | 'doc-footnote'\n | 'doc-foreword'\n | 'doc-glossary'\n | 'doc-glossref'\n | 'doc-index'\n | 'doc-introduction'\n | 'doc-noteref'\n | 'doc-notice'\n | 'doc-pagebreak'\n | 'doc-pagelist'\n | 'doc-part'\n | 'doc-preface'\n | 'doc-prologue'\n | 'doc-pullquote'\n | 'doc-qna'\n | 'doc-subtitle'\n | 'doc-tip'\n | 'doc-toc';\n"]}
|
|
@@ -11,18 +11,21 @@
|
|
|
11
11
|
// go/keep-sorted end
|
|
12
12
|
|
|
13
13
|
@mixin styles() {
|
|
14
|
-
.md3-navigation-drawer-modal
|
|
14
|
+
.md3-navigation-drawer-modal,
|
|
15
|
+
.md3-navigation-drawer {
|
|
15
16
|
background-color: var(--_container-color);
|
|
16
17
|
border-radius: var(--_container-shape);
|
|
17
18
|
height: var(--_container-height);
|
|
19
|
+
}
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
.md3-navigation-drawer-modal.md3-navigation-drawer-modal--opened,
|
|
22
|
+
.md3-navigation-drawer.md3-navigation-drawer--opened {
|
|
23
|
+
inline-size: var(--_container-width);
|
|
24
|
+
}
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
.md3-navigation-drawer-modal .md3-navigation-drawer-modal__slot-content,
|
|
27
|
+
.md3-navigation-drawer .md3-navigation-drawer__slot-content {
|
|
28
|
+
min-inline-size: var(--_container-width);
|
|
29
|
+
max-inline-size: var(--_container-width);
|
|
27
30
|
}
|
|
28
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.md3-navigation-drawer-modal{background-color:var(--_container-color);border-radius:var(--_container-shape);height:var(--_container-height)}.md3-navigation-drawer-modal.md3-navigation-drawer-modal--opened{inline-size:var(--_container-width)}.md3-navigation-drawer-modal .md3-navigation-drawer-modal__slot-content{min-inline-size:var(--_container-width);max-inline-size:var(--_container-width)}/*# sourceMappingURL=shared-styles.css.map */
|
|
1
|
+
.md3-navigation-drawer-modal,.md3-navigation-drawer{background-color:var(--_container-color);border-radius:var(--_container-shape);height:var(--_container-height)}.md3-navigation-drawer-modal.md3-navigation-drawer-modal--opened,.md3-navigation-drawer.md3-navigation-drawer--opened{inline-size:var(--_container-width)}.md3-navigation-drawer-modal .md3-navigation-drawer-modal__slot-content,.md3-navigation-drawer .md3-navigation-drawer__slot-content{min-inline-size:var(--_container-width);max-inline-size:var(--_container-width)}/*# sourceMappingURL=shared-styles.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["_shared.scss"],"names":[],"mappings":"AAaE,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["_shared.scss"],"names":[],"mappings":"AAaE,oDAEE,yCACA,sCACA,gCAGF,sHAEE,oCAGF,oIAEE,wCACA","file":"shared-styles.css"}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// Generated stylesheet for ./labs/navigationdrawer/internal/shared-styles.css.
|
|
7
7
|
import { css } from 'lit';
|
|
8
|
-
export const styles = css `.md3-navigation-drawer-modal{background-color:var(--_container-color);border-radius:var(--_container-shape);height:var(--_container-height)}.md3-navigation-drawer-modal.md3-navigation-drawer-modal--opened{inline-size:var(--_container-width)}.md3-navigation-drawer-modal .md3-navigation-drawer-modal__slot-content{min-inline-size:var(--_container-width);max-inline-size:var(--_container-width)}
|
|
8
|
+
export const styles = css `.md3-navigation-drawer-modal,.md3-navigation-drawer{background-color:var(--_container-color);border-radius:var(--_container-shape);height:var(--_container-height)}.md3-navigation-drawer-modal.md3-navigation-drawer-modal--opened,.md3-navigation-drawer.md3-navigation-drawer--opened{inline-size:var(--_container-width)}.md3-navigation-drawer-modal .md3-navigation-drawer-modal__slot-content,.md3-navigation-drawer .md3-navigation-drawer__slot-content{min-inline-size:var(--_container-width);max-inline-size:var(--_container-width)}
|
|
9
9
|
`;
|
|
10
10
|
//# sourceMappingURL=shared-styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-styles.js","sourceRoot":"","sources":["shared-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,+EAA+E;AAC/E,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./labs/navigationdrawer/internal/shared-styles.css.\nimport {css} from 'lit';\nexport const styles = css`.md3-navigation-drawer-modal{background-color:var(--_container-color);border-radius:var(--_container-shape);height:var(--_container-height)}.md3-navigation-drawer-modal.md3-navigation-drawer-modal--opened{inline-size:var(--_container-width)}.md3-navigation-drawer-modal .md3-navigation-drawer-modal__slot-content{min-inline-size:var(--_container-width);max-inline-size:var(--_container-width)}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"shared-styles.js","sourceRoot":"","sources":["shared-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,+EAA+E;AAC/E,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./labs/navigationdrawer/internal/shared-styles.css.\nimport {css} from 'lit';\nexport const styles = css`.md3-navigation-drawer-modal,.md3-navigation-drawer{background-color:var(--_container-color);border-radius:var(--_container-shape);height:var(--_container-height)}.md3-navigation-drawer-modal.md3-navigation-drawer-modal--opened,.md3-navigation-drawer.md3-navigation-drawer--opened{inline-size:var(--_container-width)}.md3-navigation-drawer-modal .md3-navigation-drawer-modal__slot-content,.md3-navigation-drawer .md3-navigation-drawer__slot-content{min-inline-size:var(--_container-width);max-inline-size:var(--_container-width)}\n`;\n"]}
|
package/menu/internal/_menu.scss
CHANGED
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
height: inherit;
|
|
75
75
|
min-width: inherit;
|
|
76
76
|
max-width: inherit;
|
|
77
|
+
scrollbar-width: inherit;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
.menu::backdrop {
|
|
@@ -97,6 +98,7 @@
|
|
|
97
98
|
min-width: inherit;
|
|
98
99
|
max-width: inherit;
|
|
99
100
|
border-radius: inherit;
|
|
101
|
+
scrollbar-width: inherit;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
.item-padding {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}/*# sourceMappingURL=menu-styles.css.map */
|
|
1
|
+
:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}/*# sourceMappingURL=menu-styles.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["_menu.scss","../../elevation/internal/_elevation.scss","../../focus/internal/_focus-ring.scss"],"names":[],"mappings":"AAqCE,MCfI,iKDuBF,gBACA,YACA,iBAGF,cE3BI,mGFmCJ,MACE,0FACA,aACA,WACA,YACA,YACA,iBAEA,+BACA,cACA,UACA,WACA,kBACA,iBACA,mBACA,eACA,kBACA,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["_menu.scss","../../elevation/internal/_elevation.scss","../../focus/internal/_focus-ring.scss"],"names":[],"mappings":"AAqCE,MCfI,iKDuBF,gBACA,YACA,iBAGF,cE3BI,mGFmCJ,MACE,0FACA,aACA,WACA,YACA,YACA,iBAEA,+BACA,cACA,UACA,WACA,kBACA,iBACA,mBACA,eACA,kBACA,kBACA,wBAGF,gBACE,aAGF,OACE,eAGF,OACE,cACA,qBACA,SACA,aACA,sBACA,gGACA,eACA,mBACA,cACA,kBACA,kBACA,sBACA,wBAGF,cACE,kBAGF,oCACE,iBAGF,iDAEE,gBAGF,+BAIE,oBAGF,sCACE,UAGF,KACE,cACA,eACA,mBAGF,4CACE,aAGF,8BACE,MACE,mBACA,wBACA","file":"menu-styles.css"}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// Generated stylesheet for ./menu/internal/menu-styles.css.
|
|
7
7
|
import { css } from 'lit';
|
|
8
|
-
export const styles = css `:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}
|
|
8
|
+
export const styles = css `:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}
|
|
9
9
|
`;
|
|
10
10
|
//# sourceMappingURL=menu-styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-styles.js","sourceRoot":"","sources":["menu-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4DAA4D;AAC5D,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./menu/internal/menu-styles.css.\nimport {css} from 'lit';\nexport const styles = css`:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"menu-styles.js","sourceRoot":"","sources":["menu-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4DAA4D;AAC5D,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./menu/internal/menu-styles.css.\nimport {css} from 'lit';\nexport const styles = css`:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}\n`;\n"]}
|