@momentum-design/components 0.112.2 → 0.112.4

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.
@@ -160,6 +160,7 @@ class Buttonsimple extends AutoFocusOnMountMixin(TabIndexMixin(DisabledMixin(Com
160
160
  const clickEvent = new MouseEvent('click', {
161
161
  bubbles: true,
162
162
  cancelable: true,
163
+ composed: true,
163
164
  view: window,
164
165
  });
165
166
  this.dispatchEvent(clickEvent);
@@ -125,7 +125,7 @@ declare class MenuPopover extends Popover {
125
125
  * If the popover is currently visible, it hides the popover; otherwise, it shows the popover.
126
126
  * @returns - This method does not return anything.
127
127
  */
128
- togglePopoverVisible: () => void;
128
+ togglePopoverVisible: (event: Event) => void;
129
129
  /**
130
130
  * Closes all other submenus on the same level as the target menu item.
131
131
  * This method is used to ensure that only one submenu is open at a time.
@@ -111,9 +111,9 @@ class MenuPopover extends Popover {
111
111
  * If the popover is currently visible, it hides the popover; otherwise, it shows the popover.
112
112
  * @returns - This method does not return anything.
113
113
  */
114
- this.togglePopoverVisible = () => {
114
+ this.togglePopoverVisible = (event) => {
115
115
  var _a;
116
- if ((_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.hasAttribute('soft-disabled'))
116
+ if (((_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.hasAttribute('soft-disabled')) || !this.isEventFromTrigger(event))
117
117
  return;
118
118
  if (this.visible) {
119
119
  this.hide();
@@ -285,7 +285,6 @@ declare class Popover extends Popover_base {
285
285
  */
286
286
  keepConnectedTooltipClosed: boolean;
287
287
  arrowElement: HTMLElement | null;
288
- triggerElement: HTMLElement | null;
289
288
  /** @internal */
290
289
  private hoverTimer;
291
290
  /** @internal */
@@ -299,18 +298,27 @@ declare class Popover extends Popover_base {
299
298
  /** @internal */
300
299
  private floatingUICleanupFunction;
301
300
  /** @internal */
302
- protected shouldSupressOpening: boolean;
301
+ protected shouldSuppressOpening: boolean;
303
302
  /** @internal */
304
- private connectedTooltip;
303
+ private get connectedTooltip();
304
+ /**
305
+ * Get trigger element on-demand
306
+ * It is necessary because trigger might appear later in the DOM, or it could be replaced completely.
307
+ *
308
+ * @internal
309
+ */
310
+ get triggerElement(): HTMLElement | null;
305
311
  constructor();
306
- private storeConnectedTooltip;
307
- private setupTriggerRelatedElement;
308
- private cleanupTrigger;
309
312
  protected firstUpdated(changedProperties: PropertyValues): Promise<void>;
313
+ connectedCallback(): void;
314
+ private parseTrigger;
310
315
  disconnectedCallback(): Promise<void>;
311
316
  /**
312
317
  * Sets up the trigger related event listeners, based on the trigger type.
313
318
  * Includes fallback for mouseenter trigger to also handle focusin for non-interactive popovers.
319
+ *
320
+ * We are using capture phase for to make sure we capture trigger events even when they are not propagated during the
321
+ * bubble phase (e.g.: buttons in list item)
314
322
  */
315
323
  private setupTriggerListeners;
316
324
  /**
@@ -392,21 +400,14 @@ declare class Popover extends Popover_base {
392
400
  /**
393
401
  * Toggles the popover visibility.
394
402
  */
395
- togglePopoverVisible: () => void;
403
+ togglePopoverVisible: (event: Event) => void;
396
404
  /**
397
405
  * Positions the popover based on the trigger element.
398
406
  * It also handles the flip, size and arrow placement.
399
407
  * It uses the floating-ui/dom library to calculate the position.
400
408
  */
401
409
  private positionPopover;
402
- /**
403
- * Finds the closest popover to the passed element in the DOM tree.
404
- *
405
- * Useful when need to find the parent popover in a nested popover scenario.
406
- *
407
- * @param element - The element to start searching from.
408
- */
409
- protected findClosestPopover: (element: Element) => Popover | null;
410
+ protected isEventFromTrigger(event: Event): boolean;
410
411
  render(): import("lit-html").TemplateResult<1>;
411
412
  static styles: Array<CSSResult>;
412
413
  }
@@ -57,6 +57,20 @@ import { PopoverUtils } from './popover.utils';
57
57
  *
58
58
  */
59
59
  class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component))) {
60
+ /** @internal */
61
+ get connectedTooltip() {
62
+ const connectedTooltips = this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);
63
+ return Array.from(connectedTooltips).find(t => t !== this);
64
+ }
65
+ /**
66
+ * Get trigger element on-demand
67
+ * It is necessary because trigger might appear later in the DOM, or it could be replaced completely.
68
+ *
69
+ * @internal
70
+ */
71
+ get triggerElement() {
72
+ return this.getRootNode().querySelector(`[id="${this.triggerID}"]`);
73
+ }
60
74
  constructor() {
61
75
  super();
62
76
  /**
@@ -285,7 +299,6 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
285
299
  */
286
300
  this.keepConnectedTooltipClosed = DEFAULTS.KEEP_CONNECTED_TOOLTIP_CLOSED;
287
301
  this.arrowElement = null;
288
- this.triggerElement = null;
289
302
  /** @internal */
290
303
  this.hoverTimer = null;
291
304
  /** @internal */
@@ -297,20 +310,8 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
297
310
  /** @internal */
298
311
  this.floatingUICleanupFunction = null;
299
312
  /** @internal */
300
- this.shouldSupressOpening = false;
301
- /** @internal */
302
- this.connectedTooltip = null;
303
- this.storeConnectedTooltip = () => {
304
- const connectedTooltips = this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);
305
- for (const tooltip of connectedTooltips) {
306
- if (tooltip !== this) {
307
- this.connectedTooltip = tooltip;
308
- return;
309
- }
310
- }
311
- this.connectedTooltip = null;
312
- };
313
- this.cleanupTrigger = () => {
313
+ this.shouldSuppressOpening = false;
314
+ this.parseTrigger = () => {
314
315
  var _a;
315
316
  const triggers = ((_a = this.trigger) === null || _a === void 0 ? void 0 : _a.split(' ')) || [];
316
317
  const validTriggers = triggers.filter(trigger => Object.values(TRIGGER).includes(trigger));
@@ -333,25 +334,26 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
333
334
  /**
334
335
  * Sets up the trigger related event listeners, based on the trigger type.
335
336
  * Includes fallback for mouseenter trigger to also handle focusin for non-interactive popovers.
337
+ *
338
+ * We are using capture phase for to make sure we capture trigger events even when they are not propagated during the
339
+ * bubble phase (e.g.: buttons in list item)
336
340
  */
337
341
  this.setupTriggerListeners = () => {
338
- if (!this.triggerElement)
339
- return;
340
342
  if (this.trigger.includes('click')) {
341
- this.triggerElement.addEventListener('click', this.togglePopoverVisible);
343
+ document.addEventListener('click', this.togglePopoverVisible, { capture: true });
342
344
  }
343
345
  if (this.trigger.includes('mouseenter')) {
344
346
  const hoverBridge = this.renderRoot.querySelector('.popover-hover-bridge');
345
347
  hoverBridge === null || hoverBridge === void 0 ? void 0 : hoverBridge.addEventListener('mouseenter', this.show);
346
- this.triggerElement.addEventListener('mouseenter', this.handleMouseEnter);
347
- this.triggerElement.addEventListener('mouseleave', this.handleMouseLeave);
348
+ document.addEventListener('mouseenter', this.handleMouseEnter, { capture: true });
349
+ document.addEventListener('mouseleave', this.handleMouseLeave, { capture: true });
348
350
  this.addEventListener('mouseenter', this.cancelCloseDelay);
349
351
  this.addEventListener('mouseleave', this.startCloseDelay);
350
352
  }
351
353
  if (this.trigger.includes('focusin')) {
352
- this.triggerElement.addEventListener('focusin', this.handleFocusIn);
354
+ document.addEventListener('focusin', this.handleFocusIn, { capture: true });
353
355
  if (!this.interactive) {
354
- this.triggerElement.addEventListener('focusout', this.handleFocusOut);
356
+ document.addEventListener('focusout', this.handleFocusOut, { capture: true });
355
357
  }
356
358
  }
357
359
  };
@@ -359,32 +361,30 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
359
361
  * Removes the trigger related event listeners.
360
362
  */
361
363
  this.removeTriggerListeners = () => {
362
- var _a, _b, _c, _d, _e;
363
364
  // click trigger
364
- (_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', this.togglePopoverVisible);
365
+ document.removeEventListener('click', this.togglePopoverVisible, { capture: true });
365
366
  // mouseenter trigger
366
367
  const hoverBridge = this.renderRoot.querySelector('.popover-hover-bridge');
367
368
  hoverBridge === null || hoverBridge === void 0 ? void 0 : hoverBridge.removeEventListener('mouseenter', this.show);
368
- (_b = this.triggerElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseenter', this.handleMouseEnter);
369
- (_c = this.triggerElement) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseleave', this.handleMouseLeave);
369
+ document.removeEventListener('mouseenter', this.handleMouseEnter, { capture: true });
370
+ document.removeEventListener('mouseleave', this.handleMouseLeave, { capture: true });
370
371
  this.removeEventListener('mouseenter', this.cancelCloseDelay);
371
372
  this.removeEventListener('mouseleave', this.startCloseDelay);
372
373
  // focusin trigger
373
- (_d = this.triggerElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('focusin', this.handleFocusIn);
374
- (_e = this.triggerElement) === null || _e === void 0 ? void 0 : _e.removeEventListener('focusout', this.handleFocusOut);
374
+ document.removeEventListener('focusin', this.handleFocusIn, { capture: true });
375
+ document.removeEventListener('focusout', this.handleFocusOut, { capture: true });
375
376
  };
376
377
  /**
377
378
  * Removes all event listeners related to the popover.
378
379
  */
379
380
  this.removeAllListeners = () => {
380
- var _a;
381
381
  this.removeTriggerListeners();
382
382
  if (this.hideOnOutsideClick) {
383
- document.removeEventListener('click', this.onOutsidePopoverClick);
383
+ document.removeEventListener('click', this.onOutsidePopoverClick, { capture: true });
384
384
  }
385
385
  if (this.hideOnEscape) {
386
386
  this.removeEventListener('keydown', this.onEscapeKeydown);
387
- (_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', this.onEscapeKeydown);
387
+ document.removeEventListener('keydown', this.onEscapeKeydown, { capture: true });
388
388
  }
389
389
  if (this.hideOnBlur) {
390
390
  this.removeEventListener('focusout', this.onPopoverFocusOut);
@@ -439,7 +439,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
439
439
  * Handles mouse enter event on the trigger element.
440
440
  * This method sets the `isHovered` flag to true and shows the popover
441
441
  */
442
- this.handleMouseEnter = () => {
442
+ this.handleMouseEnter = (event) => {
443
+ if (!this.isEventFromTrigger(event))
444
+ return;
443
445
  this.isHovered = true;
444
446
  this.show();
445
447
  };
@@ -448,7 +450,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
448
450
  * This method sets the `isHovered` flag to false and starts the close delay
449
451
  * timer to hide the popover.
450
452
  */
451
- this.handleMouseLeave = () => {
453
+ this.handleMouseLeave = (event) => {
454
+ if (!this.isEventFromTrigger(event))
455
+ return;
452
456
  this.isHovered = false;
453
457
  this.startCloseDelay();
454
458
  };
@@ -457,7 +461,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
457
461
  * This method checks if the popover is not hovered and hides the popover.
458
462
  * If the popover is hovered, it will not hide the popover.
459
463
  */
460
- this.handleFocusOut = () => {
464
+ this.handleFocusOut = (event) => {
465
+ if (!this.isEventFromTrigger(event))
466
+ return;
461
467
  if (!this.isHovered) {
462
468
  this.hide();
463
469
  }
@@ -466,8 +472,10 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
466
472
  * Handles focus in event on the trigger element.
467
473
  * This method checks if the trigger element has visible focus or is being hovered.
468
474
  */
469
- this.handleFocusIn = () => {
475
+ this.handleFocusIn = (event) => {
470
476
  var _a;
477
+ if (!this.isEventFromTrigger(event))
478
+ return;
471
479
  if (((_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.matches(':focus-visible')) || this.isHovered) {
472
480
  this.show();
473
481
  }
@@ -499,7 +507,7 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
499
507
  * Shows the popover.
500
508
  */
501
509
  this.show = () => {
502
- if (this.visible || this.shouldSupressOpening) {
510
+ if (this.visible || this.shouldSuppressOpening) {
503
511
  return;
504
512
  }
505
513
  this.cancelCloseDelay();
@@ -528,7 +536,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
528
536
  /**
529
537
  * Toggles the popover visibility.
530
538
  */
531
- this.togglePopoverVisible = () => {
539
+ this.togglePopoverVisible = (event) => {
540
+ if (!this.isEventFromTrigger(event))
541
+ return;
532
542
  if (this.visible) {
533
543
  this.hide();
534
544
  }
@@ -542,7 +552,8 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
542
552
  * It uses the floating-ui/dom library to calculate the position.
543
553
  */
544
554
  this.positionPopover = () => {
545
- if (!this.triggerElement)
555
+ const { triggerElement } = this;
556
+ if (!triggerElement)
546
557
  return;
547
558
  const boundary = !this.boundary || this.boundary === 'clippingAncestors'
548
559
  ? 'clippingAncestors'
@@ -594,10 +605,11 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
594
605
  }
595
606
  }
596
607
  middleware.push(offset(popoverOffset));
597
- this.floatingUICleanupFunction = autoUpdate(this.triggerElement, this, async () => {
598
- if (!this.triggerElement)
608
+ this.floatingUICleanupFunction = autoUpdate(triggerElement, this, async () => {
609
+ const { triggerElement } = this;
610
+ if (!triggerElement)
599
611
  return;
600
- const { x, y, middlewareData, placement } = await computePosition(this.triggerElement, this, {
612
+ const { x, y, middlewareData, placement } = await computePosition(triggerElement, this, {
601
613
  placement: this.placement,
602
614
  middleware,
603
615
  strategy: this.strategy,
@@ -611,36 +623,20 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
611
623
  }
612
624
  });
613
625
  };
614
- /**
615
- * Finds the closest popover to the passed element in the DOM tree.
616
- *
617
- * Useful when need to find the parent popover in a nested popover scenario.
618
- *
619
- * @param element - The element to start searching from.
620
- */
621
- this.findClosestPopover = (element) => {
622
- let el = element;
623
- while (el && !(el instanceof Popover)) {
624
- el = el.parentElement;
625
- }
626
- return el;
627
- };
628
626
  this.utils = new PopoverUtils(this);
629
- }
630
- setupTriggerRelatedElement() {
631
- this.triggerElement = this.getRootNode().querySelector(`[id="${this.triggerID}"]`);
632
- this.storeConnectedTooltip();
627
+ this.parseTrigger();
628
+ [this.openDelay, this.closeDelay] = this.utils.setupDelay();
633
629
  }
634
630
  async firstUpdated(changedProperties) {
635
631
  super.firstUpdated(changedProperties);
636
- this.utils.setupAppendTo();
637
- [this.openDelay, this.closeDelay] = this.utils.setupDelay();
638
- this.setupTriggerRelatedElement();
639
- this.cleanupTrigger();
640
- this.setupTriggerListeners();
641
632
  this.style.zIndex = `${this.zIndex}`;
633
+ this.utils.setupAppendTo();
642
634
  PopoverEventManager.onCreatedPopover(this);
643
635
  }
636
+ connectedCallback() {
637
+ super.connectedCallback();
638
+ this.setupTriggerListeners();
639
+ }
644
640
  async disconnectedCallback() {
645
641
  var _a, _b;
646
642
  super.disconnectedCallback();
@@ -654,7 +650,7 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
654
650
  this.cancelCloseDelay();
655
651
  if (this.keepConnectedTooltipClosed) {
656
652
  if (this.connectedTooltip) {
657
- this.connectedTooltip.shouldSupressOpening = false;
653
+ this.connectedTooltip.shouldSuppressOpening = false;
658
654
  }
659
655
  }
660
656
  PopoverEventManager.onDestroyedPopover(this);
@@ -668,7 +664,7 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
668
664
  this.utils.updateAriaExpandedAttribute();
669
665
  }
670
666
  if (changedProperties.has('trigger')) {
671
- this.cleanupTrigger();
667
+ this.parseTrigger();
672
668
  this.removeTriggerListeners();
673
669
  this.setupTriggerListeners();
674
670
  }
@@ -727,11 +723,12 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
727
723
  * @param newValue - The new value of the visible property.
728
724
  */
729
725
  async isOpenUpdated(oldValue, newValue) {
730
- var _a, _b, _c, _d, _e;
731
- if (oldValue === newValue || !this.triggerElement) {
726
+ var _a, _b;
727
+ const { triggerElement } = this;
728
+ if (oldValue === newValue || !triggerElement) {
732
729
  return;
733
730
  }
734
- if (newValue && !this.shouldSupressOpening) {
731
+ if (newValue && !this.shouldSuppressOpening) {
735
732
  if (popoverStack.peek() !== this) {
736
733
  popoverStack.push(this);
737
734
  }
@@ -740,28 +737,28 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
740
737
  // we need to close the connected tooltip.
741
738
  if (this.connectedTooltip) {
742
739
  this.connectedTooltip.visible = false;
743
- this.connectedTooltip.shouldSupressOpening = true;
740
+ this.connectedTooltip.shouldSuppressOpening = true;
744
741
  }
745
742
  }
746
743
  // create backdrop if it doesn't exist
747
744
  if (this.backdrop && !this.backdropElement) {
748
745
  this.createBackdrop('popover');
749
- this.keepElementAboveBackdrop(this.triggerElement);
746
+ this.keepElementAboveBackdrop(triggerElement);
750
747
  }
751
748
  this.positionPopover();
752
749
  if (this.hideOnBlur) {
753
750
  this.addEventListener('focusout', this.onPopoverFocusOut);
754
751
  if (this.trigger === 'click') {
755
- this.triggerElement.style.pointerEvents = 'none';
752
+ triggerElement.style.pointerEvents = 'none';
756
753
  }
757
754
  }
758
755
  if (this.hideOnEscape) {
759
756
  this.addEventListener('keydown', this.onEscapeKeydown);
760
- (_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', this.onEscapeKeydown);
757
+ document.addEventListener('keydown', this.onEscapeKeydown);
761
758
  }
762
759
  this.activatePreventScroll();
763
760
  if (this.hideOnOutsideClick) {
764
- document.addEventListener('click', this.onOutsidePopoverClick);
761
+ document.addEventListener('click', this.onOutsidePopoverClick, { capture: true });
765
762
  }
766
763
  // make sure popover is fully rendered before activating focus trap
767
764
  setTimeout(() => {
@@ -778,37 +775,44 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
778
775
  popoverStack.pop();
779
776
  }
780
777
  // cleanup floating-ui on closing the popover
781
- (_b = this.floatingUICleanupFunction) === null || _b === void 0 ? void 0 : _b.call(this);
778
+ (_a = this.floatingUICleanupFunction) === null || _a === void 0 ? void 0 : _a.call(this);
782
779
  if (this.backdrop) {
783
- this.moveElementBackAfterBackdropRemoval(this.triggerElement);
780
+ this.moveElementBackAfterBackdropRemoval(triggerElement);
784
781
  this.removeBackdrop();
785
782
  }
786
783
  if (this.hideOnBlur) {
787
784
  this.removeEventListener('focusout', this.onPopoverFocusOut);
788
785
  if (this.trigger === 'click') {
789
- this.triggerElement.style.pointerEvents = '';
786
+ triggerElement.style.pointerEvents = '';
790
787
  }
791
788
  }
792
789
  if (this.hideOnOutsideClick) {
793
- document.removeEventListener('click', this.onOutsidePopoverClick);
790
+ document.removeEventListener('click', this.onOutsidePopoverClick, { capture: true });
794
791
  }
795
792
  if (this.hideOnEscape) {
796
793
  this.removeEventListener('keydown', this.onEscapeKeydown);
797
- (_c = this.triggerElement) === null || _c === void 0 ? void 0 : _c.removeEventListener('keydown', this.onEscapeKeydown);
794
+ document.removeEventListener('keydown', this.onEscapeKeydown);
798
795
  }
799
796
  this.deactivatePreventScroll();
800
- (_d = this.deactivateFocusTrap) === null || _d === void 0 ? void 0 : _d.call(this);
797
+ (_b = this.deactivateFocusTrap) === null || _b === void 0 ? void 0 : _b.call(this);
801
798
  if (this.focusBackToTrigger) {
802
- (_e = this.triggerElement) === null || _e === void 0 ? void 0 : _e.focus();
799
+ triggerElement === null || triggerElement === void 0 ? void 0 : triggerElement.focus();
803
800
  }
804
801
  if (this.keepConnectedTooltipClosed) {
805
802
  if (this.connectedTooltip) {
806
- this.connectedTooltip.shouldSupressOpening = false;
803
+ this.connectedTooltip.shouldSuppressOpening = false;
807
804
  }
808
805
  }
809
806
  PopoverEventManager.onHidePopover(this);
810
807
  }
811
808
  }
809
+ isEventFromTrigger(event) {
810
+ var _a;
811
+ if (event.composed) {
812
+ return event.composedPath().some(el => (el === null || el === void 0 ? void 0 : el.id) === this.triggerID);
813
+ }
814
+ return ((_a = event.target) === null || _a === void 0 ? void 0 : _a.id) === this.triggerID;
815
+ }
812
816
  render() {
813
817
  return html `
814
818
  <div class="popover-hover-bridge"></div>
@@ -214,7 +214,7 @@ class Slider extends Component {
214
214
  const [inputStart, inputEnd] = this.inputElements;
215
215
  const input = source === 'end' ? inputEnd : inputStart;
216
216
  const value = Number(input === null || input === void 0 ? void 0 : input.value);
217
- if (typeof value !== 'number' || Number.isNaN(value) || this.max === this.min) {
217
+ if (typeof value !== 'number' || Number.isNaN(value) || this.max === this.min || this.disabled) {
218
218
  return nothing;
219
219
  }
220
220
  const normalizedValue = (value - this.min) / (this.max - this.min);
@@ -31,6 +31,19 @@ const styles = css `
31
31
  line-height: var(--mds-font-apps-body-midsize-medium-line-height);
32
32
  }
33
33
 
34
+ :host([disabled])::part(leading-icon),
35
+ :host([disabled])::part(trailing-icon),
36
+ :host([soft-disabled])::part(leading-icon),
37
+ :host([soft-disabled])::part(trailing-icon),
38
+ :host([disabled])::part(slider-label),
39
+ :host([disabled])::part(slider-label-start),
40
+ :host([disabled])::part(slider-label-end),
41
+ :host([soft-disabled])::part(slider-label),
42
+ :host([soft-disabled])::part(slider-label-start),
43
+ :host([soft-disabled])::part(slider-label-end) {
44
+ color: var(--mds-color-theme-text-primary-disabled);
45
+ }
46
+
34
47
  :host::part(slider-label) {
35
48
  margin-bottom: 0.5rem;
36
49
  display: block;
@@ -112,6 +125,18 @@ const styles = css `
112
125
  border: 1px solid var(--mdc-slider-thumb-border-color);
113
126
  }
114
127
 
128
+ :host([disabled]) input[type='range']::-webkit-slider-thumb {
129
+ cursor: unset;
130
+ }
131
+
132
+ :host([disabled]) input[type='range']::-moz-range-thumb {
133
+ cursor: unset;
134
+ }
135
+
136
+ :host([disabled]) input[type='range']::-ms-thumb {
137
+ cursor: unset;
138
+ }
139
+
115
140
  :host(:not([soft-disabled])) input[type='range']:not(:disabled):hover::-webkit-slider-thumb {
116
141
  --mdc-slider-thumb-color: var(--mds-color-theme-overlay-button-secondary-hover);
117
142
  --mdc-slider-thumb-border-color: var(--mds-color-theme-outline-input-active);