@momentum-design/components 0.83.1 → 0.83.3
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/browser/index.js +178 -178
- package/dist/browser/index.js.map +4 -4
- package/dist/components/dialog/dialog.component.d.ts +7 -2
- package/dist/components/dialog/dialog.component.js +28 -9
- package/dist/components/popover/popover.component.d.ts +19 -7
- package/dist/components/popover/popover.component.js +69 -24
- package/dist/components/popover/popover.constants.d.ts +1 -0
- package/dist/components/popover/popover.constants.js +1 -0
- package/dist/components/tooltip/tooltip.component.js +1 -1
- package/dist/custom-elements.json +1411 -1150
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/utils/mixins/FocusTrapMixin.d.ts +2 -2
- package/dist/utils/mixins/FocusTrapMixin.js +78 -40
- package/dist/utils/mixins/PreventScrollMixin.d.ts +9 -0
- package/dist/utils/mixins/PreventScrollMixin.js +32 -0
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
import { CSSResult, PropertyValues } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
3
|
import type { DialogRole, DialogSize, DialogVariant } from './dialog.types';
|
4
|
-
declare const Dialog_base: import("../../utils/mixins/index.types").Constructor<
|
4
|
+
declare const Dialog_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/CardAndDialogFooterMixin").CardAndDialogFooterMixinInterface> & typeof Component;
|
5
5
|
/**
|
6
6
|
* Dialog component is a modal dialog that can be used to display information or prompt the user for input.
|
7
7
|
* It can be used to create custom dialogs where content for the body and footer actions is provided by the consumer.
|
@@ -136,8 +136,13 @@ declare class Dialog extends Dialog_base {
|
|
136
136
|
* For now FocusTrap is always true as the dialog is a modal component only.
|
137
137
|
* This means it will always trap focus within the dialog when it is open.
|
138
138
|
*/
|
139
|
+
focusTrap: boolean;
|
140
|
+
/**
|
141
|
+
* For now preventScroll is always true as the dialog is a modal component only.
|
142
|
+
* This means scroll will be prevented when the dialog is open.
|
143
|
+
*/
|
139
144
|
/** @internal */
|
140
|
-
protected
|
145
|
+
protected preventScroll: boolean;
|
141
146
|
/** @internal */
|
142
147
|
protected triggerElement: HTMLElement | null;
|
143
148
|
/** @internal */
|
@@ -13,6 +13,7 @@ import { property } from 'lit/decorators.js';
|
|
13
13
|
import styles from './dialog.styles';
|
14
14
|
import { Component } from '../../models';
|
15
15
|
import { FocusTrapMixin } from '../../utils/mixins/FocusTrapMixin';
|
16
|
+
import { PreventScrollMixin } from '../../utils/mixins/PreventScrollMixin';
|
16
17
|
import { DEFAULTS } from './dialog.constants';
|
17
18
|
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
18
19
|
import { DialogEventManager } from './dialog.events';
|
@@ -66,7 +67,7 @@ import { CardAndDialogFooterMixin } from '../../utils/mixins/CardAndDialogFooter
|
|
66
67
|
* @slot footer - This slot is for passing custom footer content. Only use this if really needed,
|
67
68
|
* using the footer-link and footer-button slots is preferred
|
68
69
|
*/
|
69
|
-
class Dialog extends FocusTrapMixin(CardAndDialogFooterMixin(Component)) {
|
70
|
+
class Dialog extends PreventScrollMixin(FocusTrapMixin(CardAndDialogFooterMixin(Component))) {
|
70
71
|
constructor() {
|
71
72
|
super(...arguments);
|
72
73
|
/**
|
@@ -140,8 +141,13 @@ class Dialog extends FocusTrapMixin(CardAndDialogFooterMixin(Component)) {
|
|
140
141
|
* For now FocusTrap is always true as the dialog is a modal component only.
|
141
142
|
* This means it will always trap focus within the dialog when it is open.
|
142
143
|
*/
|
143
|
-
/** @internal */
|
144
144
|
this.focusTrap = true;
|
145
|
+
/**
|
146
|
+
* For now preventScroll is always true as the dialog is a modal component only.
|
147
|
+
* This means scroll will be prevented when the dialog is open.
|
148
|
+
*/
|
149
|
+
/** @internal */
|
150
|
+
this.preventScroll = true;
|
145
151
|
/** @internal */
|
146
152
|
this.triggerElement = null;
|
147
153
|
/** @internal */
|
@@ -158,6 +164,9 @@ class Dialog extends FocusTrapMixin(CardAndDialogFooterMixin(Component)) {
|
|
158
164
|
return;
|
159
165
|
}
|
160
166
|
event.preventDefault();
|
167
|
+
// Prevent the event from propagating to the document level
|
168
|
+
// pressing escape on a dialog should only close the dialog, nothing else
|
169
|
+
event.stopPropagation();
|
161
170
|
this.hideDialog();
|
162
171
|
};
|
163
172
|
/**
|
@@ -177,17 +186,20 @@ class Dialog extends FocusTrapMixin(CardAndDialogFooterMixin(Component)) {
|
|
177
186
|
}
|
178
187
|
connectedCallback() {
|
179
188
|
super.connectedCallback();
|
180
|
-
|
189
|
+
// event listener can be added to the element directly, since dialog is a modal component
|
190
|
+
// and it will not be allowed to be focused outside of it
|
191
|
+
this.addEventListener('keydown', this.onEscapeKeydown.bind(this));
|
181
192
|
}
|
182
193
|
disconnectedCallback() {
|
183
194
|
var _a, _b, _c;
|
184
195
|
super.disconnectedCallback();
|
185
|
-
|
196
|
+
this.removeEventListener('keydown', this.onEscapeKeydown);
|
186
197
|
(_a = this.backdropElement) === null || _a === void 0 ? void 0 : _a.remove();
|
187
198
|
this.backdropElement = null;
|
188
|
-
(_b = this.deactivateFocusTrap) === null || _b === void 0 ? void 0 : _b.call(this);
|
189
199
|
// Set aria-expanded attribute on the trigger element to false if it exists
|
190
|
-
(
|
200
|
+
(_b = this.triggerElement) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-expanded', 'false');
|
201
|
+
this.deactivatePreventScroll();
|
202
|
+
(_c = this.deactivateFocusTrap) === null || _c === void 0 ? void 0 : _c.call(this);
|
191
203
|
this.focusBackToTrigger();
|
192
204
|
DialogEventManager.onDestroyedDialog(this);
|
193
205
|
}
|
@@ -222,6 +234,12 @@ class Dialog extends FocusTrapMixin(CardAndDialogFooterMixin(Component)) {
|
|
222
234
|
|| changedProperties.has('descriptionText')) {
|
223
235
|
this.setupAriaLabelledDescribedBy();
|
224
236
|
}
|
237
|
+
if (changedProperties.has('focusTrap')) {
|
238
|
+
// if focusTrap turned false and the popover is visible, deactivate the focus trap
|
239
|
+
if (!this.focusTrap && this.visible) {
|
240
|
+
this.deactivateFocusTrap();
|
241
|
+
}
|
242
|
+
}
|
225
243
|
}
|
226
244
|
/**
|
227
245
|
* Sets up the aria-haspopup attribute for the dialog.
|
@@ -304,8 +322,8 @@ class Dialog extends FocusTrapMixin(CardAndDialogFooterMixin(Component)) {
|
|
304
322
|
if (newValue && !oldValue) {
|
305
323
|
// Store the currently focused element before opening the dialog
|
306
324
|
this.lastActiveElement = document.activeElement;
|
307
|
-
this.enabledPreventScroll = true;
|
308
325
|
this.createBackdrop();
|
326
|
+
this.activatePreventScroll();
|
309
327
|
await this.updateComplete;
|
310
328
|
(_a = this.activateFocusTrap) === null || _a === void 0 ? void 0 : _a.call(this);
|
311
329
|
(_b = this.setInitialFocus) === null || _b === void 0 ? void 0 : _b.call(this);
|
@@ -316,9 +334,10 @@ class Dialog extends FocusTrapMixin(CardAndDialogFooterMixin(Component)) {
|
|
316
334
|
else if (!newValue && oldValue) {
|
317
335
|
(_d = this.backdropElement) === null || _d === void 0 ? void 0 : _d.remove();
|
318
336
|
this.backdropElement = null;
|
319
|
-
(_e = this.deactivateFocusTrap) === null || _e === void 0 ? void 0 : _e.call(this);
|
320
337
|
// Set aria-expanded attribute on the trigger element to false if it exists
|
321
|
-
(
|
338
|
+
(_e = this.triggerElement) === null || _e === void 0 ? void 0 : _e.setAttribute('aria-expanded', 'false');
|
339
|
+
this.deactivatePreventScroll();
|
340
|
+
(_f = this.deactivateFocusTrap) === null || _f === void 0 ? void 0 : _f.call(this);
|
322
341
|
this.focusBackToTrigger();
|
323
342
|
DialogEventManager.onHideDialog(this);
|
324
343
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { CSSResult, PropertyValues } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
3
|
import { PopoverColor, PopoverPlacement, PopoverTrigger } from './popover.types';
|
4
|
-
declare const Popover_base: import("../../utils/mixins/index.types").Constructor<
|
4
|
+
declare const Popover_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & typeof Component;
|
5
5
|
/**
|
6
6
|
* Popover component is a lightweight floating UI element that displays additional content when triggered.
|
7
7
|
* It can be used for tooltips, dropdowns, or contextual menus.
|
@@ -94,7 +94,7 @@ declare class Popover extends Popover_base {
|
|
94
94
|
*/
|
95
95
|
focusTrap: boolean;
|
96
96
|
/**
|
97
|
-
* Prevent outside scrolling when popover
|
97
|
+
* Prevent outside scrolling when popover is shown.
|
98
98
|
* @default false
|
99
99
|
*/
|
100
100
|
preventScroll: boolean;
|
@@ -109,7 +109,10 @@ declare class Popover extends Popover_base {
|
|
109
109
|
*/
|
110
110
|
closeButton: boolean;
|
111
111
|
/**
|
112
|
-
* Determines whether the popover is interactive
|
112
|
+
* Determines whether the popover is interactive.
|
113
|
+
* Make sure to set focusTrap to true to keep the focus inside the popover in case necessary.
|
114
|
+
* Setting interactive to true will not automatically set focusTrap!
|
115
|
+
*
|
113
116
|
* @default false
|
114
117
|
*/
|
115
118
|
interactive: boolean;
|
@@ -123,6 +126,17 @@ declare class Popover extends Popover_base {
|
|
123
126
|
* @default false
|
124
127
|
*/
|
125
128
|
hideOnEscape: boolean;
|
129
|
+
/**
|
130
|
+
* Propagates the event, when the escape key is pressed (only when pressed inside the popover)
|
131
|
+
* If true, the escape key press close the popover and will propagate the keydown event.
|
132
|
+
* If false, the escape key press will close the popover but will not propagate the keydown event.
|
133
|
+
* (set to false to prevent the event from bubbling up to the document).
|
134
|
+
*
|
135
|
+
* This only works when `hideOnEscape` is true.
|
136
|
+
*
|
137
|
+
* @default false
|
138
|
+
*/
|
139
|
+
propagateEventOnEscape: boolean;
|
126
140
|
/**
|
127
141
|
* Hide popover on blur.
|
128
142
|
* @default false
|
@@ -231,6 +245,8 @@ declare class Popover extends Popover_base {
|
|
231
245
|
/**
|
232
246
|
* Handles the escape keydown event to close the popover.
|
233
247
|
*
|
248
|
+
* This method is attached to the document.
|
249
|
+
*
|
234
250
|
* @param event - The keyboard event.
|
235
251
|
*/
|
236
252
|
private onEscapeKeydown;
|
@@ -269,10 +285,6 @@ declare class Popover extends Popover_base {
|
|
269
285
|
* Toggles the popover visibility.
|
270
286
|
*/
|
271
287
|
togglePopoverVisible: () => void;
|
272
|
-
/**
|
273
|
-
* Sets the focusable elements inside the popover.
|
274
|
-
*/
|
275
|
-
private handleCreatePopoverFirstUpdate;
|
276
288
|
/**
|
277
289
|
* Positions the popover based on the trigger element.
|
278
290
|
* It also handles the flip, size and arrow placement.
|
@@ -13,6 +13,7 @@ import { property } from 'lit/decorators.js';
|
|
13
13
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
14
14
|
import { Component } from '../../models';
|
15
15
|
import { FocusTrapMixin } from '../../utils/mixins/FocusTrapMixin';
|
16
|
+
import { PreventScrollMixin } from '../../utils/mixins/PreventScrollMixin';
|
16
17
|
import { COLOR, DEFAULTS, POPOVER_PLACEMENT, TRIGGER } from './popover.constants';
|
17
18
|
import { PopoverEventManager } from './popover.events';
|
18
19
|
import { popoverStack } from './popover.stack';
|
@@ -48,7 +49,7 @@ import { PopoverUtils } from './popover.utils';
|
|
48
49
|
* @slot - Default slot for the popover content
|
49
50
|
*
|
50
51
|
*/
|
51
|
-
class Popover extends FocusTrapMixin(Component) {
|
52
|
+
class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
52
53
|
constructor() {
|
53
54
|
super();
|
54
55
|
/**
|
@@ -112,7 +113,7 @@ class Popover extends FocusTrapMixin(Component) {
|
|
112
113
|
*/
|
113
114
|
this.focusTrap = DEFAULTS.FOCUS_TRAP;
|
114
115
|
/**
|
115
|
-
* Prevent outside scrolling when popover
|
116
|
+
* Prevent outside scrolling when popover is shown.
|
116
117
|
* @default false
|
117
118
|
*/
|
118
119
|
this.preventScroll = DEFAULTS.PREVENT_SCROLL;
|
@@ -127,7 +128,10 @@ class Popover extends FocusTrapMixin(Component) {
|
|
127
128
|
*/
|
128
129
|
this.closeButton = DEFAULTS.CLOSE_BUTTON;
|
129
130
|
/**
|
130
|
-
* Determines whether the popover is interactive
|
131
|
+
* Determines whether the popover is interactive.
|
132
|
+
* Make sure to set focusTrap to true to keep the focus inside the popover in case necessary.
|
133
|
+
* Setting interactive to true will not automatically set focusTrap!
|
134
|
+
*
|
131
135
|
* @default false
|
132
136
|
*/
|
133
137
|
this.interactive = DEFAULTS.INTERACTIVE;
|
@@ -141,6 +145,17 @@ class Popover extends FocusTrapMixin(Component) {
|
|
141
145
|
* @default false
|
142
146
|
*/
|
143
147
|
this.hideOnEscape = DEFAULTS.HIDE_ON_ESCAPE;
|
148
|
+
/**
|
149
|
+
* Propagates the event, when the escape key is pressed (only when pressed inside the popover)
|
150
|
+
* If true, the escape key press close the popover and will propagate the keydown event.
|
151
|
+
* If false, the escape key press will close the popover but will not propagate the keydown event.
|
152
|
+
* (set to false to prevent the event from bubbling up to the document).
|
153
|
+
*
|
154
|
+
* This only works when `hideOnEscape` is true.
|
155
|
+
*
|
156
|
+
* @default false
|
157
|
+
*/
|
158
|
+
this.propagateEventOnEscape = DEFAULTS.PROPAGATE_EVENT_ON_ESCAPE;
|
144
159
|
/**
|
145
160
|
* Hide popover on blur.
|
146
161
|
* @default false
|
@@ -240,12 +255,18 @@ class Popover extends FocusTrapMixin(Component) {
|
|
240
255
|
/**
|
241
256
|
* Handles the escape keydown event to close the popover.
|
242
257
|
*
|
258
|
+
* This method is attached to the document.
|
259
|
+
*
|
243
260
|
* @param event - The keyboard event.
|
244
261
|
*/
|
245
262
|
this.onEscapeKeydown = (event) => {
|
246
263
|
if (!this.visible || event.code !== 'Escape') {
|
247
264
|
return;
|
248
265
|
}
|
266
|
+
if (!this.propagateEventOnEscape) {
|
267
|
+
// If propagateEventOnEscape is false, we don't want to allow the event to bubble up
|
268
|
+
event.stopPropagation();
|
269
|
+
}
|
249
270
|
event.preventDefault();
|
250
271
|
this.hidePopover();
|
251
272
|
};
|
@@ -319,6 +340,7 @@ class Popover extends FocusTrapMixin(Component) {
|
|
319
340
|
this.utils = new PopoverUtils(this);
|
320
341
|
}
|
321
342
|
async firstUpdated(changedProperties) {
|
343
|
+
var _a, _b;
|
322
344
|
super.firstUpdated(changedProperties);
|
323
345
|
this.utils.setupAppendTo();
|
324
346
|
[this.openDelay, this.closeDelay] = this.utils.setupDelay();
|
@@ -328,7 +350,14 @@ class Popover extends FocusTrapMixin(Component) {
|
|
328
350
|
PopoverEventManager.onCreatedPopover(this);
|
329
351
|
if (this.visible) {
|
330
352
|
this.positionPopover();
|
331
|
-
|
353
|
+
this.activatePreventScroll();
|
354
|
+
// If the popover is visible on first update and focustrap is enabled, we need to activate the focus trap
|
355
|
+
if (this.interactive && this.focusTrap) {
|
356
|
+
// Wait for the first update to complete before setting focusable elements
|
357
|
+
await this.updateComplete;
|
358
|
+
(_a = this.activateFocusTrap) === null || _a === void 0 ? void 0 : _a.call(this);
|
359
|
+
(_b = this.setInitialFocus) === null || _b === void 0 ? void 0 : _b.call(this);
|
360
|
+
}
|
332
361
|
}
|
333
362
|
}
|
334
363
|
async disconnectedCallback() {
|
@@ -336,6 +365,7 @@ class Popover extends FocusTrapMixin(Component) {
|
|
336
365
|
super.disconnectedCallback();
|
337
366
|
this.removeEventListeners();
|
338
367
|
(_a = this.deactivateFocusTrap) === null || _a === void 0 ? void 0 : _a.call(this);
|
368
|
+
this.deactivatePreventScroll();
|
339
369
|
PopoverEventManager.onDestroyedPopover(this);
|
340
370
|
popoverStack.remove(this);
|
341
371
|
}
|
@@ -437,6 +467,21 @@ class Popover extends FocusTrapMixin(Component) {
|
|
437
467
|
if (changedProperties.has('interactive') || changedProperties.has('disableAriaHasPopup')) {
|
438
468
|
this.utils.updateAriaHasPopupAttribute();
|
439
469
|
}
|
470
|
+
if (changedProperties.has('focusTrap')) {
|
471
|
+
// if focusTrap turned false and the popover is visible, deactivate the focus trap
|
472
|
+
if (!this.focusTrap && this.visible) {
|
473
|
+
this.deactivateFocusTrap();
|
474
|
+
}
|
475
|
+
}
|
476
|
+
if (changedProperties.has('preventScroll')) {
|
477
|
+
// if preventScroll turned false and the popover is visible, deactivate the prevent scroll
|
478
|
+
if (!this.preventScroll && this.visible) {
|
479
|
+
this.deactivatePreventScroll();
|
480
|
+
}
|
481
|
+
else if (this.preventScroll && this.visible) {
|
482
|
+
this.activatePreventScroll();
|
483
|
+
}
|
484
|
+
}
|
440
485
|
}
|
441
486
|
/**
|
442
487
|
* Handles the popover visibility change and position the popover.
|
@@ -446,7 +491,7 @@ class Popover extends FocusTrapMixin(Component) {
|
|
446
491
|
* @param newValue - The new value of the visible property.
|
447
492
|
*/
|
448
493
|
async isOpenUpdated(oldValue, newValue) {
|
449
|
-
var _a, _b, _c;
|
494
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
450
495
|
if (oldValue === newValue || !this.triggerElement) {
|
451
496
|
return;
|
452
497
|
}
|
@@ -454,13 +499,11 @@ class Popover extends FocusTrapMixin(Component) {
|
|
454
499
|
if (popoverStack.peek() !== this) {
|
455
500
|
popoverStack.push(this);
|
456
501
|
}
|
457
|
-
this.enabledPreventScroll = this.preventScroll;
|
458
502
|
if (this.backdrop) {
|
459
503
|
this.utils.createBackdrop();
|
460
504
|
this.triggerElement.style.zIndex = `${this.zIndex}`;
|
461
505
|
}
|
462
506
|
this.positionPopover();
|
463
|
-
await this.handleCreatePopoverFirstUpdate();
|
464
507
|
if (this.hideOnBlur) {
|
465
508
|
this.addEventListener('focusout', this.onPopoverFocusOut);
|
466
509
|
if (this.trigger === 'click') {
|
@@ -471,7 +514,15 @@ class Popover extends FocusTrapMixin(Component) {
|
|
471
514
|
document.addEventListener('click', this.onOutsidePopoverClick);
|
472
515
|
}
|
473
516
|
if (this.hideOnEscape) {
|
474
|
-
|
517
|
+
this.addEventListener('keydown', this.onEscapeKeydown);
|
518
|
+
(_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', this.onEscapeKeydown);
|
519
|
+
}
|
520
|
+
this.activatePreventScroll();
|
521
|
+
if (this.interactive && this.focusTrap) {
|
522
|
+
// Wait for the update to complete before setting focusable elements
|
523
|
+
await this.updateComplete;
|
524
|
+
(_b = this.activateFocusTrap) === null || _b === void 0 ? void 0 : _b.call(this);
|
525
|
+
(_c = this.setInitialFocus) === null || _c === void 0 ? void 0 : _c.call(this);
|
475
526
|
}
|
476
527
|
PopoverEventManager.onShowPopover(this);
|
477
528
|
}
|
@@ -480,7 +531,7 @@ class Popover extends FocusTrapMixin(Component) {
|
|
480
531
|
popoverStack.pop();
|
481
532
|
}
|
482
533
|
if (this.backdropElement) {
|
483
|
-
(
|
534
|
+
(_d = this.backdropElement) === null || _d === void 0 ? void 0 : _d.remove();
|
484
535
|
this.backdropElement = null;
|
485
536
|
}
|
486
537
|
if (this.hideOnBlur) {
|
@@ -493,9 +544,9 @@ class Popover extends FocusTrapMixin(Component) {
|
|
493
544
|
document.removeEventListener('click', this.onOutsidePopoverClick);
|
494
545
|
}
|
495
546
|
if (this.hideOnEscape) {
|
496
|
-
|
547
|
+
this.removeEventListener('keydown', this.onEscapeKeydown);
|
548
|
+
(_e = this.triggerElement) === null || _e === void 0 ? void 0 : _e.removeEventListener('keydown', this.onEscapeKeydown);
|
497
549
|
}
|
498
|
-
(_b = this.deactivateFocusTrap) === null || _b === void 0 ? void 0 : _b.call(this);
|
499
550
|
if (!this.disableAriaExpanded) {
|
500
551
|
this.triggerElement.removeAttribute('aria-expanded');
|
501
552
|
}
|
@@ -503,24 +554,14 @@ class Popover extends FocusTrapMixin(Component) {
|
|
503
554
|
if (!this.interactive) {
|
504
555
|
this.triggerElement.removeAttribute('aria-haspopup');
|
505
556
|
}
|
557
|
+
this.deactivatePreventScroll();
|
558
|
+
(_f = this.deactivateFocusTrap) === null || _f === void 0 ? void 0 : _f.call(this);
|
506
559
|
if (this.focusBackToTrigger) {
|
507
|
-
(
|
560
|
+
(_g = this.triggerElement) === null || _g === void 0 ? void 0 : _g.focus();
|
508
561
|
}
|
509
562
|
PopoverEventManager.onHidePopover(this);
|
510
563
|
}
|
511
564
|
}
|
512
|
-
/**
|
513
|
-
* Sets the focusable elements inside the popover.
|
514
|
-
*/
|
515
|
-
async handleCreatePopoverFirstUpdate() {
|
516
|
-
var _a, _b;
|
517
|
-
if (this.visible && this.interactive) {
|
518
|
-
// Wait for the first update to complete before setting focusable elements
|
519
|
-
await this.updateComplete;
|
520
|
-
(_a = this.activateFocusTrap) === null || _a === void 0 ? void 0 : _a.call(this);
|
521
|
-
(_b = this.setInitialFocus) === null || _b === void 0 ? void 0 : _b.call(this);
|
522
|
-
}
|
523
|
-
}
|
524
565
|
/**
|
525
566
|
* Positions the popover based on the trigger element.
|
526
567
|
* It also handles the flip, size and arrow placement.
|
@@ -651,6 +692,10 @@ __decorate([
|
|
651
692
|
property({ type: Boolean, reflect: true, attribute: 'hide-on-escape' }),
|
652
693
|
__metadata("design:type", Boolean)
|
653
694
|
], Popover.prototype, "hideOnEscape", void 0);
|
695
|
+
__decorate([
|
696
|
+
property({ type: Boolean, reflect: true, attribute: 'propagate-event-on-escape' }),
|
697
|
+
__metadata("design:type", Boolean)
|
698
|
+
], Popover.prototype, "propagateEventOnEscape", void 0);
|
654
699
|
__decorate([
|
655
700
|
property({ type: Boolean, reflect: true, attribute: 'hide-on-blur' }),
|
656
701
|
__metadata("design:type", Boolean)
|
@@ -57,7 +57,7 @@ class Tooltip extends Popover {
|
|
57
57
|
this.placement = this.placement || DEFAULTS.PLACEMENT;
|
58
58
|
this.role = ROLE.TOOLTIP;
|
59
59
|
this.trigger = 'mouseenter focusin';
|
60
|
-
this.
|
60
|
+
this.preventScroll = false;
|
61
61
|
this.flip = true;
|
62
62
|
this.preventScroll = false;
|
63
63
|
this.closeButton = false;
|