@momentum-design/components 0.104.4 → 0.104.6
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 +356 -357
- package/dist/browser/index.js.map +4 -4
- package/dist/components/dialog/dialog.component.d.ts +1 -10
- package/dist/components/dialog/dialog.component.js +13 -45
- package/dist/components/menubar/menubar.component.js +1 -1
- package/dist/components/menupopover/menupopover.component.js +2 -1
- package/dist/components/popover/popover.component.d.ts +13 -5
- package/dist/components/popover/popover.component.js +25 -20
- package/dist/components/popover/popover.constants.d.ts +1 -0
- package/dist/components/popover/popover.constants.js +1 -0
- package/dist/components/popover/popover.utils.d.ts +0 -2
- package/dist/components/popover/popover.utils.js +0 -29
- package/dist/components/select/select.component.d.ts +13 -0
- package/dist/components/select/select.component.js +19 -0
- package/dist/components/select/select.styles.js +1 -0
- package/dist/components/slider/index.d.ts +7 -0
- package/dist/components/slider/index.js +4 -0
- package/dist/components/slider/slider.component.d.ts +120 -0
- package/dist/components/slider/slider.component.js +189 -0
- package/dist/components/slider/slider.constants.d.ts +2 -0
- package/dist/components/slider/slider.constants.js +3 -0
- package/dist/components/slider/slider.styles.d.ts +2 -0
- package/dist/components/slider/slider.styles.js +7 -0
- package/dist/components/slider/slider.types.d.ts +3 -0
- package/dist/components/slider/slider.types.js +2 -0
- package/dist/custom-elements.json +2640 -1659
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +3 -2
- package/dist/react/slider/index.d.ts +12 -0
- package/dist/react/slider/index.js +21 -0
- package/dist/utils/mixins/BackdropMixin.d.ts +14 -0
- package/dist/utils/mixins/BackdropMixin.js +99 -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<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/FooterMixin").FooterMixinInterface> & typeof Component;
|
4
|
+
declare const Dialog_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/BackdropMixin").BackdropMixinInterface> & 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/FooterMixin").FooterMixinInterface> & 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.
|
@@ -162,8 +162,6 @@ declare class Dialog extends Dialog_base {
|
|
162
162
|
/** @internal */
|
163
163
|
protected triggerElement: HTMLElement | null;
|
164
164
|
/** @internal */
|
165
|
-
protected backdropElement: HTMLElement | null;
|
166
|
-
/** @internal */
|
167
165
|
protected lastActiveElement: HTMLElement | null;
|
168
166
|
connectedCallback(): void;
|
169
167
|
disconnectedCallback(): void;
|
@@ -192,13 +190,6 @@ declare class Dialog extends Dialog_base {
|
|
192
190
|
* @internal
|
193
191
|
*/
|
194
192
|
private setupAriaLabelledDescribedBy;
|
195
|
-
/**
|
196
|
-
* Creates a backdrop element for the dialog.
|
197
|
-
* The backdrop is a full-screen overlay that appears behind the dialog when it is open.
|
198
|
-
* It prevents interaction with the rest of the application while the dialog is open.
|
199
|
-
* @internal
|
200
|
-
*/
|
201
|
-
private createBackdrop;
|
202
193
|
/**
|
203
194
|
* Fired when Close Button is clicked or Escape key is pressed.
|
204
195
|
* This method dispatches the close event. Setting visible to false
|
@@ -16,6 +16,7 @@ import { PreventScrollMixin } from '../../utils/mixins/PreventScrollMixin';
|
|
16
16
|
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
17
17
|
import { BUTTON_VARIANTS, ICON_BUTTON_SIZES } from '../button/button.constants';
|
18
18
|
import { FooterMixin } from '../../utils/mixins/FooterMixin';
|
19
|
+
import { BackdropMixin } from '../../utils/mixins/BackdropMixin';
|
19
20
|
import { DEFAULTS } from './dialog.constants';
|
20
21
|
import { DialogEventManager } from './dialog.events';
|
21
22
|
import styles from './dialog.styles';
|
@@ -74,7 +75,7 @@ import styles from './dialog.styles';
|
|
74
75
|
* @slot footer - This slot is for passing custom footer content. Only use this if really needed,
|
75
76
|
* using the footer-link and footer-button slots is preferred
|
76
77
|
*/
|
77
|
-
class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component))) {
|
78
|
+
class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))) {
|
78
79
|
constructor() {
|
79
80
|
super(...arguments);
|
80
81
|
/**
|
@@ -167,8 +168,6 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
|
|
167
168
|
/** @internal */
|
168
169
|
this.triggerElement = null;
|
169
170
|
/** @internal */
|
170
|
-
this.backdropElement = null;
|
171
|
-
/** @internal */
|
172
171
|
this.lastActiveElement = null;
|
173
172
|
/**
|
174
173
|
* Handles the escape keydown event to close the dialog.
|
@@ -193,15 +192,14 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
|
|
193
192
|
this.addEventListener('keydown', this.onEscapeKeydown.bind(this));
|
194
193
|
}
|
195
194
|
disconnectedCallback() {
|
196
|
-
var _a, _b
|
195
|
+
var _a, _b;
|
197
196
|
super.disconnectedCallback();
|
198
197
|
this.removeEventListener('keydown', this.onEscapeKeydown);
|
199
|
-
|
200
|
-
this.backdropElement = null;
|
198
|
+
this.removeBackdrop();
|
201
199
|
// Set aria-expanded attribute on the trigger element to false if it exists
|
202
|
-
(
|
200
|
+
(_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'false');
|
203
201
|
this.deactivatePreventScroll();
|
204
|
-
(
|
202
|
+
(_b = this.deactivateFocusTrap) === null || _b === void 0 ? void 0 : _b.call(this);
|
205
203
|
this.focusBackToTrigger();
|
206
204
|
DialogEventManager.onDestroyedDialog(this);
|
207
205
|
}
|
@@ -299,37 +297,6 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
|
|
299
297
|
}
|
300
298
|
}
|
301
299
|
}
|
302
|
-
/**
|
303
|
-
* Creates a backdrop element for the dialog.
|
304
|
-
* The backdrop is a full-screen overlay that appears behind the dialog when it is open.
|
305
|
-
* It prevents interaction with the rest of the application while the dialog is open.
|
306
|
-
* @internal
|
307
|
-
*/
|
308
|
-
createBackdrop() {
|
309
|
-
var _a;
|
310
|
-
// Remove existing backdrop if present
|
311
|
-
if (this.backdropElement && this.backdropElement.parentElement) {
|
312
|
-
this.backdropElement.parentElement.removeChild(this.backdropElement);
|
313
|
-
this.backdropElement = null;
|
314
|
-
}
|
315
|
-
const backdrop = document.createElement('div');
|
316
|
-
backdrop.classList.add('dialog-backdrop');
|
317
|
-
const styleElement = document.createElement('style');
|
318
|
-
styleElement.textContent = `
|
319
|
-
.dialog-backdrop {
|
320
|
-
position: fixed;
|
321
|
-
top: 0;
|
322
|
-
left: 0;
|
323
|
-
width: 100%;
|
324
|
-
height: 100%;
|
325
|
-
background: var(--mds-color-theme-common-overlays-secondary-normal);
|
326
|
-
z-index: ${this.zIndex - 1};
|
327
|
-
}
|
328
|
-
`;
|
329
|
-
backdrop.appendChild(styleElement);
|
330
|
-
(_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.appendChild(backdrop);
|
331
|
-
this.backdropElement = backdrop;
|
332
|
-
}
|
333
300
|
/**
|
334
301
|
* Fired when Close Button is clicked or Escape key is pressed.
|
335
302
|
* This method dispatches the close event. Setting visible to false
|
@@ -346,14 +313,16 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
|
|
346
313
|
* @param newValue - The new value of the visible property.
|
347
314
|
*/
|
348
315
|
async isOpenUpdated(oldValue, newValue) {
|
349
|
-
var _a, _b, _c, _d, _e
|
316
|
+
var _a, _b, _c, _d, _e;
|
350
317
|
if (oldValue === newValue) {
|
351
318
|
return;
|
352
319
|
}
|
353
320
|
if (newValue && !oldValue) {
|
354
321
|
// Store the currently focused element before opening the dialog
|
355
322
|
this.lastActiveElement = document.activeElement;
|
356
|
-
|
323
|
+
// remove any existing backdrop and create a new one
|
324
|
+
this.removeBackdrop();
|
325
|
+
this.createBackdrop('dialog');
|
357
326
|
this.activatePreventScroll();
|
358
327
|
await this.updateComplete;
|
359
328
|
if (this.focusTrap) {
|
@@ -365,12 +334,11 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
|
|
365
334
|
DialogEventManager.onShowDialog(this);
|
366
335
|
}
|
367
336
|
else if (!newValue && oldValue) {
|
368
|
-
|
369
|
-
this.backdropElement = null;
|
337
|
+
this.removeBackdrop();
|
370
338
|
// Set aria-expanded attribute on the trigger element to false if it exists
|
371
|
-
(
|
339
|
+
(_d = this.triggerElement) === null || _d === void 0 ? void 0 : _d.setAttribute('aria-expanded', 'false');
|
372
340
|
this.deactivatePreventScroll();
|
373
|
-
(
|
341
|
+
(_e = this.deactivateFocusTrap) === null || _e === void 0 ? void 0 : _e.call(this);
|
374
342
|
this.focusBackToTrigger();
|
375
343
|
DialogEventManager.onHideDialog(this);
|
376
344
|
}
|
@@ -88,7 +88,7 @@ class MenuBar extends Component {
|
|
88
88
|
const id = item.getAttribute('id');
|
89
89
|
if (!id)
|
90
90
|
return;
|
91
|
-
const submenu = (_a =
|
91
|
+
const submenu = (_a = document.querySelector) === null || _a === void 0 ? void 0 : _a.call(document, `${MENUPOPOVER_TAGNAME}[triggerid="${id}"]`);
|
92
92
|
if (submenu && submenu.visible) {
|
93
93
|
subMenus.push(submenu);
|
94
94
|
}
|
@@ -11,6 +11,7 @@ import { property } from 'lit/decorators.js';
|
|
11
11
|
import { KEYS } from '../../utils/keys';
|
12
12
|
import { ROLE } from '../../utils/roles';
|
13
13
|
import { TAG_NAME as MENUSECTION_TAGNAME } from '../menusection/menusection.constants';
|
14
|
+
import { TAG_NAME as NAVMENUITEM_TAGNAME } from '../navmenuitem/navmenuitem.constants';
|
14
15
|
import { TAG_NAME as MENUITEM_TAGNAME } from '../menuitem/menuitem.constants';
|
15
16
|
import { TAG_NAME as MENUITEMCHECKBOX_TAGNAME } from '../menuitemcheckbox/menuitemcheckbox.constants';
|
16
17
|
import { TAG_NAME as MENUITEMRADIO_TAGNAME } from '../menuitemradio/menuitemradio.constants';
|
@@ -358,7 +359,7 @@ class MenuPopover extends Popover {
|
|
358
359
|
// make sure backdrop is set before showing the popover, but it does not change when popover is closing, otherwise
|
359
360
|
// `super.isOpenUpdated` will skip the backdrop cleanup
|
360
361
|
if (newValue) {
|
361
|
-
this.backdrop = !(this.triggerElement.tagName.toLowerCase()
|
362
|
+
this.backdrop = ![MENUITEM_TAGNAME, NAVMENUITEM_TAGNAME].includes(this.triggerElement.tagName.toLowerCase());
|
362
363
|
}
|
363
364
|
// if the current menupopover is closed, close all submenus
|
364
365
|
if (newValue === false) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { CSSResult, PropertyValues } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
3
|
import type { PopoverColor, PopoverPlacement, PopoverTrigger } from './popover.types';
|
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;
|
4
|
+
declare const Popover_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/BackdropMixin").BackdropMixinInterface> & 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.
|
@@ -195,6 +195,18 @@ declare class Popover extends Popover_base {
|
|
195
195
|
* @default false
|
196
196
|
*/
|
197
197
|
backdrop: boolean;
|
198
|
+
/**
|
199
|
+
* Element ID the backdrop will be a append to (if `backdrop` is true).
|
200
|
+
* @default ''
|
201
|
+
*/
|
202
|
+
backdropAppendTo?: string;
|
203
|
+
/**
|
204
|
+
* Set this property to true to make the backdrop invisible (if `backdrop` is true).
|
205
|
+
* This is useful for components that do want a backdrop which stops interaction,
|
206
|
+
* but do not want the backdrop to be visible as a overlay.
|
207
|
+
* @default false
|
208
|
+
*/
|
209
|
+
isBackdropInvisible?: boolean;
|
198
210
|
/**
|
199
211
|
* Changes the placement of popover to keep it in view when scrolling.
|
200
212
|
* @default true
|
@@ -271,8 +283,6 @@ declare class Popover extends Popover_base {
|
|
271
283
|
arrowElement: HTMLElement | null;
|
272
284
|
triggerElement: HTMLElement | null;
|
273
285
|
/** @internal */
|
274
|
-
private triggerElementOriginalStyle;
|
275
|
-
/** @internal */
|
276
286
|
private hoverTimer;
|
277
287
|
/** @internal */
|
278
288
|
private isHovered;
|
@@ -287,8 +297,6 @@ declare class Popover extends Popover_base {
|
|
287
297
|
/** @internal */
|
288
298
|
protected shouldSupressOpening: boolean;
|
289
299
|
/** @internal */
|
290
|
-
backdropElement: HTMLElement | null;
|
291
|
-
/** @internal */
|
292
300
|
private connectedTooltip;
|
293
301
|
constructor();
|
294
302
|
private storeConnectedTooltip;
|
@@ -13,6 +13,7 @@ import { html, nothing } from 'lit';
|
|
13
13
|
import { property } from 'lit/decorators.js';
|
14
14
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
15
15
|
import { Component } from '../../models';
|
16
|
+
import { BackdropMixin } from '../../utils/mixins/BackdropMixin';
|
16
17
|
import { FocusTrapMixin } from '../../utils/mixins/FocusTrapMixin';
|
17
18
|
import { PreventScrollMixin } from '../../utils/mixins/PreventScrollMixin';
|
18
19
|
import { COLOR, DEFAULTS, POPOVER_PLACEMENT, TRIGGER } from './popover.constants';
|
@@ -50,7 +51,7 @@ import { PopoverUtils } from './popover.utils';
|
|
50
51
|
* @slot - Default slot for the popover content
|
51
52
|
*
|
52
53
|
*/
|
53
|
-
class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
54
|
+
class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component))) {
|
54
55
|
constructor() {
|
55
56
|
super();
|
56
57
|
/**
|
@@ -204,6 +205,13 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
204
205
|
* @default false
|
205
206
|
*/
|
206
207
|
this.backdrop = DEFAULTS.BACKDROP;
|
208
|
+
/**
|
209
|
+
* Set this property to true to make the backdrop invisible (if `backdrop` is true).
|
210
|
+
* This is useful for components that do want a backdrop which stops interaction,
|
211
|
+
* but do not want the backdrop to be visible as a overlay.
|
212
|
+
* @default false
|
213
|
+
*/
|
214
|
+
this.isBackdropInvisible = DEFAULTS.IS_BACKDROP_INVISIBLE;
|
207
215
|
/**
|
208
216
|
* Changes the placement of popover to keep it in view when scrolling.
|
209
217
|
* @default true
|
@@ -275,11 +283,6 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
275
283
|
this.arrowElement = null;
|
276
284
|
this.triggerElement = null;
|
277
285
|
/** @internal */
|
278
|
-
this.triggerElementOriginalStyle = {
|
279
|
-
zIndex: '',
|
280
|
-
position: '',
|
281
|
-
};
|
282
|
-
/** @internal */
|
283
286
|
this.hoverTimer = null;
|
284
287
|
/** @internal */
|
285
288
|
this.isHovered = false;
|
@@ -292,8 +295,6 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
292
295
|
/** @internal */
|
293
296
|
this.shouldSupressOpening = false;
|
294
297
|
/** @internal */
|
295
|
-
this.backdropElement = null;
|
296
|
-
/** @internal */
|
297
298
|
this.connectedTooltip = null;
|
298
299
|
this.storeConnectedTooltip = () => {
|
299
300
|
const connectedTooltips = this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);
|
@@ -642,7 +643,8 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
642
643
|
this.removeAllListeners();
|
643
644
|
(_a = this.deactivateFocusTrap) === null || _a === void 0 ? void 0 : _a.call(this);
|
644
645
|
this.deactivatePreventScroll();
|
645
|
-
this.
|
646
|
+
this.moveElementBackAfterBackdropRemoval(this.triggerElement);
|
647
|
+
this.removeBackdrop();
|
646
648
|
(_b = this.floatingUICleanupFunction) === null || _b === void 0 ? void 0 : _b.call(this);
|
647
649
|
// clean timer if there is one set:
|
648
650
|
this.cancelCloseDelay();
|
@@ -740,14 +742,10 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
740
742
|
this.connectedTooltip.shouldSupressOpening = true;
|
741
743
|
}
|
742
744
|
}
|
743
|
-
|
744
|
-
|
745
|
-
this.
|
746
|
-
|
747
|
-
zIndex: this.triggerElement.style.zIndex,
|
748
|
-
};
|
749
|
-
this.triggerElement.style.position = 'relative';
|
750
|
-
this.triggerElement.style.zIndex = `${this.zIndex}`;
|
745
|
+
// create backdrop if it doesn't exist
|
746
|
+
if (this.backdrop && !this.backdropElement) {
|
747
|
+
this.createBackdrop('popover');
|
748
|
+
this.keepElementAboveBackdrop(this.triggerElement);
|
751
749
|
}
|
752
750
|
this.positionPopover();
|
753
751
|
if (this.hideOnBlur) {
|
@@ -781,9 +779,8 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
|
|
781
779
|
// cleanup floating-ui on closing the popover
|
782
780
|
(_b = this.floatingUICleanupFunction) === null || _b === void 0 ? void 0 : _b.call(this);
|
783
781
|
if (this.backdrop) {
|
784
|
-
this.
|
785
|
-
this.
|
786
|
-
this.utils.removeBackdrop();
|
782
|
+
this.moveElementBackAfterBackdropRemoval(this.triggerElement);
|
783
|
+
this.removeBackdrop();
|
787
784
|
}
|
788
785
|
if (this.hideOnBlur) {
|
789
786
|
this.removeEventListener('focusout', this.onPopoverFocusOut);
|
@@ -927,6 +924,14 @@ __decorate([
|
|
927
924
|
property({ type: Boolean, reflect: true }),
|
928
925
|
__metadata("design:type", Boolean)
|
929
926
|
], Popover.prototype, "backdrop", void 0);
|
927
|
+
__decorate([
|
928
|
+
property({ type: String, reflect: true, attribute: 'backdrop-append-to' }),
|
929
|
+
__metadata("design:type", String)
|
930
|
+
], Popover.prototype, "backdropAppendTo", void 0);
|
931
|
+
__decorate([
|
932
|
+
property({ type: Boolean, reflect: true, attribute: 'is-backdrop-invisible' }),
|
933
|
+
__metadata("design:type", Boolean)
|
934
|
+
], Popover.prototype, "isBackdropInvisible", void 0);
|
930
935
|
__decorate([
|
931
936
|
property({ type: Boolean, reflect: true }),
|
932
937
|
__metadata("design:type", Boolean)
|
@@ -52,5 +52,6 @@ declare const DEFAULTS: {
|
|
52
52
|
readonly PROPAGATE_EVENT_ON_ESCAPE: false;
|
53
53
|
readonly KEEP_CONNECTED_TOOLTIP_CLOSED: true;
|
54
54
|
readonly STRATEGY: "absolute";
|
55
|
+
readonly IS_BACKDROP_INVISIBLE: false;
|
55
56
|
};
|
56
57
|
export { TAG_NAME, POPOVER_PLACEMENT, COLOR, TRIGGER, DEFAULTS };
|
@@ -184,33 +184,4 @@ export class PopoverUtils {
|
|
184
184
|
top: `${y}px`,
|
185
185
|
});
|
186
186
|
}
|
187
|
-
createBackdrop() {
|
188
|
-
var _a;
|
189
|
-
if (!this.popover.backdropElement) {
|
190
|
-
const backdrop = document.createElement('div');
|
191
|
-
backdrop.classList.add('popover-backdrop');
|
192
|
-
const styleElement = document.createElement('style');
|
193
|
-
styleElement.textContent = `
|
194
|
-
.popover-backdrop {
|
195
|
-
position: fixed;
|
196
|
-
cursor: default;
|
197
|
-
top: 0;
|
198
|
-
left: 0;
|
199
|
-
width: 100%;
|
200
|
-
height: 100%;
|
201
|
-
background: transparent;
|
202
|
-
z-index: ${this.popover.zIndex - 1};
|
203
|
-
}
|
204
|
-
`;
|
205
|
-
backdrop.appendChild(styleElement);
|
206
|
-
(_a = this.popover.parentElement) === null || _a === void 0 ? void 0 : _a.appendChild(backdrop);
|
207
|
-
this.popover.backdropElement = backdrop;
|
208
|
-
}
|
209
|
-
}
|
210
|
-
removeBackdrop() {
|
211
|
-
if (this.popover.backdropElement) {
|
212
|
-
this.popover.backdropElement.remove();
|
213
|
-
this.popover.backdropElement = null;
|
214
|
-
}
|
215
|
-
}
|
216
187
|
}
|
@@ -97,6 +97,19 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
97
97
|
* @see [Floating UI - strategy](https://floating-ui.com/docs/computePosition#strategy)
|
98
98
|
*/
|
99
99
|
strategy: 'absolute' | 'fixed';
|
100
|
+
/**
|
101
|
+
* The z-index of the popover within Select.
|
102
|
+
*
|
103
|
+
* Override this to make sure this stays on top of other components.
|
104
|
+
* @default 1000
|
105
|
+
*/
|
106
|
+
popoverZIndex: number;
|
107
|
+
/**
|
108
|
+
* ID of the element where the backdrop will be appended to.
|
109
|
+
* This is useful to ensure that the backdrop is appended to the correct element in the DOM.
|
110
|
+
* If not set, the backdrop will be appended to the parent element of the select.
|
111
|
+
*/
|
112
|
+
backdropAppendTo?: string;
|
100
113
|
/** @internal */
|
101
114
|
slottedListboxes: Array<HTMLElement>;
|
102
115
|
/** @internal */
|
@@ -103,6 +103,13 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
103
103
|
* @see [Floating UI - strategy](https://floating-ui.com/docs/computePosition#strategy)
|
104
104
|
*/
|
105
105
|
this.strategy = POPOVER_DEFAULTS.STRATEGY;
|
106
|
+
/**
|
107
|
+
* The z-index of the popover within Select.
|
108
|
+
*
|
109
|
+
* Override this to make sure this stays on top of other components.
|
110
|
+
* @default 1000
|
111
|
+
*/
|
112
|
+
this.popoverZIndex = POPOVER_DEFAULTS.Z_INDEX;
|
106
113
|
/** @internal */
|
107
114
|
this.displayPopover = false;
|
108
115
|
/** @internal */
|
@@ -549,6 +556,8 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
549
556
|
?visible="${this.displayPopover}"
|
550
557
|
role=""
|
551
558
|
backdrop
|
559
|
+
backdrop-append-to="${ifDefined(this.backdropAppendTo)}"
|
560
|
+
is-backdrop-invisible
|
552
561
|
hide-on-outside-click
|
553
562
|
hide-on-escape
|
554
563
|
focus-back-to-trigger
|
@@ -563,6 +572,8 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
563
572
|
@closebyoutsideclick="${() => {
|
564
573
|
this.displayPopover = false;
|
565
574
|
}}"
|
575
|
+
z-index="${ifDefined(this.popoverZIndex)}"
|
576
|
+
exportparts="popover-content"
|
566
577
|
>
|
567
578
|
<slot @click="${this.handleOptionsClick}"></slot>
|
568
579
|
</mdc-popover>
|
@@ -596,6 +607,14 @@ __decorate([
|
|
596
607
|
property({ type: String, reflect: true, attribute: 'strategy' }),
|
597
608
|
__metadata("design:type", String)
|
598
609
|
], Select.prototype, "strategy", void 0);
|
610
|
+
__decorate([
|
611
|
+
property({ type: Number, reflect: true, attribute: 'popover-z-index' }),
|
612
|
+
__metadata("design:type", Number)
|
613
|
+
], Select.prototype, "popoverZIndex", void 0);
|
614
|
+
__decorate([
|
615
|
+
property({ type: String, reflect: true, attribute: 'backdrop-append-to' }),
|
616
|
+
__metadata("design:type", String)
|
617
|
+
], Select.prototype, "backdropAppendTo", void 0);
|
599
618
|
__decorate([
|
600
619
|
queryAssignedElements({ selector: 'mdc-selectlistbox' }),
|
601
620
|
__metadata("design:type", Array)
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { CSSResult } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
/**
|
4
|
+
* slider component, which ...
|
5
|
+
*
|
6
|
+
* @tagname mdc-slider
|
7
|
+
*
|
8
|
+
* @slot default - This is a default/unnamed slot
|
9
|
+
*
|
10
|
+
* @cssproperty --custom-property-name - Description of the CSS custom property
|
11
|
+
*/
|
12
|
+
declare class Slider extends Component {
|
13
|
+
/**
|
14
|
+
* Whether or not to show a value range. When false, the slider displays a slide-able handle for the value property; when true, it displays slide-able handles for the valueStart and valueEnd properties.
|
15
|
+
*/
|
16
|
+
range: boolean;
|
17
|
+
/**
|
18
|
+
* Whether the slider is disabled.
|
19
|
+
*/
|
20
|
+
disabled?: boolean;
|
21
|
+
/**
|
22
|
+
* Acts similar to disabled, but component is focusable and tooltip is shown on focus.
|
23
|
+
*/
|
24
|
+
softDisabled?: boolean;
|
25
|
+
/**
|
26
|
+
* Icon that represents the minimum value; ex: muted speaker.
|
27
|
+
*/
|
28
|
+
leadingIcon?: string;
|
29
|
+
/**
|
30
|
+
* Icon that represents the maximum value; ex: speaker with full volume.
|
31
|
+
*/
|
32
|
+
trailingIcon?: string;
|
33
|
+
/**
|
34
|
+
* The slider minimum value.
|
35
|
+
*/
|
36
|
+
min: number;
|
37
|
+
/**
|
38
|
+
* The slider maximum value.
|
39
|
+
*/
|
40
|
+
max: number;
|
41
|
+
/**
|
42
|
+
* The slider value displayed when range is false.
|
43
|
+
*/
|
44
|
+
value?: number;
|
45
|
+
/**
|
46
|
+
* The slider start value displayed when range is true.
|
47
|
+
*/
|
48
|
+
valueStart?: number;
|
49
|
+
/**
|
50
|
+
* The slider end value displayed when range is true.
|
51
|
+
*/
|
52
|
+
valueEnd?: number;
|
53
|
+
/**
|
54
|
+
* The step between values. This will show tick marks and the stepper will snap to the nearest tick mark.
|
55
|
+
*/
|
56
|
+
step: number;
|
57
|
+
/**
|
58
|
+
* It represents the label for slider component.
|
59
|
+
*/
|
60
|
+
label?: string;
|
61
|
+
/**
|
62
|
+
* The label text is shown below the slider (on leading side) representing the minimum starting value of the slider.
|
63
|
+
*/
|
64
|
+
labelStart?: string;
|
65
|
+
/**
|
66
|
+
* The label text is shown below the slider (on trailing side) representing the maximum starting value of the slider.
|
67
|
+
*/
|
68
|
+
labelEnd?: string;
|
69
|
+
/**
|
70
|
+
* An optional label for the slider's value displayed when range is false; if not set, the label is the value itself.
|
71
|
+
*/
|
72
|
+
valueLabel: string;
|
73
|
+
/**
|
74
|
+
* An optional label for the slider's start value displayed when range is true; if not set, the label is the valueStart itself.
|
75
|
+
*/
|
76
|
+
valueLabelStart: string;
|
77
|
+
/**
|
78
|
+
* An optional label for the slider's end value displayed when range is true; if not set, the label is the valueEnd itself.
|
79
|
+
*/
|
80
|
+
valueLabelEnd: string;
|
81
|
+
/**
|
82
|
+
* Aria label for the slider's start handle displayed when range is true.
|
83
|
+
*/
|
84
|
+
ariaLabelStart: string;
|
85
|
+
/**
|
86
|
+
* Aria value text for the slider's start value displayed when range is true.
|
87
|
+
*/
|
88
|
+
ariaValuetextStart: string;
|
89
|
+
/**
|
90
|
+
* Aria label for the slider's end handle displayed when range is true.
|
91
|
+
*/
|
92
|
+
ariaLabelEnd: string;
|
93
|
+
/**
|
94
|
+
* Aria value text for the slider's end value displayed when range is true.
|
95
|
+
*/
|
96
|
+
ariaValuetextEnd: string;
|
97
|
+
/**
|
98
|
+
* Name attribute for the slider (single value).
|
99
|
+
*/
|
100
|
+
name?: string;
|
101
|
+
/**
|
102
|
+
* Name attribute for the slider's start handle (range).
|
103
|
+
*/
|
104
|
+
nameStart?: string;
|
105
|
+
/**
|
106
|
+
* Name attribute for the slider's end handle (range).
|
107
|
+
*/
|
108
|
+
nameEnd?: string;
|
109
|
+
/**
|
110
|
+
* Aria value text for the slider's value displayed when range is false.
|
111
|
+
*/
|
112
|
+
dataAriaValuetext: string;
|
113
|
+
/**
|
114
|
+
* Aria label for the slider's handle displayed when range is false.
|
115
|
+
*/
|
116
|
+
dataAriaLabel: string;
|
117
|
+
render(): import("lit-html").TemplateResult<1>;
|
118
|
+
static styles: Array<CSSResult>;
|
119
|
+
}
|
120
|
+
export default Slider;
|