@momentum-design/components 0.144.5 → 0.144.7

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.
@@ -47,7 +47,7 @@ declare const Combobox_base: import("../../utils/mixins/index.types").Constructo
47
47
  * @cssproperty --mdc-combobox-height - The height of the combobox trigger control
48
48
  * @cssproperty --mdc-combobox-icon-color - The icon color of the combobox
49
49
  * @cssproperty --mdc-combobox-listbox-height - The height of the listbox inside the combobox
50
- * @cssproperty --mdc-combobox-listbox-width - The width of the listbox inside the combobox
50
+ * @cssproperty --mdc-combobox-listbox-width - The width of the listbox inside the combobox. With `strategy="fixed"`, the default `100%` matches the combobox trigger width.
51
51
  * @cssproperty --mdc-combobox-width - The width of the combobox
52
52
  * @cssproperty --mdc-combobox-hover-background-color - The background color of the combobox when hovered
53
53
  * @cssproperty --mdc-label-font-size - Font size for the label text.
@@ -58,7 +58,7 @@ import styles from './combobox.styles';
58
58
  * @cssproperty --mdc-combobox-height - The height of the combobox trigger control
59
59
  * @cssproperty --mdc-combobox-icon-color - The icon color of the combobox
60
60
  * @cssproperty --mdc-combobox-listbox-height - The height of the listbox inside the combobox
61
- * @cssproperty --mdc-combobox-listbox-width - The width of the listbox inside the combobox
61
+ * @cssproperty --mdc-combobox-listbox-width - The width of the listbox inside the combobox. With `strategy="fixed"`, the default `100%` matches the combobox trigger width.
62
62
  * @cssproperty --mdc-combobox-width - The width of the combobox
63
63
  * @cssproperty --mdc-combobox-hover-background-color - The background color of the combobox when hovered
64
64
  * @cssproperty --mdc-label-font-size - Font size for the label text.
@@ -36,7 +36,7 @@ declare const Popover_base: import("../../utils/mixins/index.types").Constructor
36
36
  * @cssproperty --mdc-popover-inverted-border-color - inverted border color of the popover
37
37
  * @cssproperty --mdc-popover-inverted-text-color - inverted text color of the popover
38
38
  * @cssproperty --mdc-popover-elevation-3 - elevation of the popover
39
- * @cssproperty --mdc-popover-max-width - max width of the popover
39
+ * @cssproperty --mdc-popover-max-width - max width of the popover. With `strategy="fixed"`, `100%` makes the popover as wide as its trigger.
40
40
  * @cssproperty --mdc-popover-max-height - max height of the popover
41
41
  * @cssproperty --mdc-popover-width - width of the popover
42
42
  * @cssproperty --mdc-popover-backdrop-color - background color of the backdrop (if backdrop is enabled)
@@ -42,7 +42,7 @@ import { PopoverUtils } from './popover.utils';
42
42
  * @cssproperty --mdc-popover-inverted-border-color - inverted border color of the popover
43
43
  * @cssproperty --mdc-popover-inverted-text-color - inverted text color of the popover
44
44
  * @cssproperty --mdc-popover-elevation-3 - elevation of the popover
45
- * @cssproperty --mdc-popover-max-width - max width of the popover
45
+ * @cssproperty --mdc-popover-max-width - max width of the popover. With `strategy="fixed"`, `100%` makes the popover as wide as its trigger.
46
46
  * @cssproperty --mdc-popover-max-height - max height of the popover
47
47
  * @cssproperty --mdc-popover-width - width of the popover
48
48
  * @cssproperty --mdc-popover-backdrop-color - background color of the backdrop (if backdrop is enabled)
@@ -691,6 +691,25 @@ class Popover extends KeyDownHandledMixin(KeyToActionMixin(BackdropMixin(Prevent
691
691
  rootBoundary,
692
692
  }));
693
693
  }
694
+ if (this.strategy === 'fixed') {
695
+ // A percentage max-width resolves against the viewport (or a filtered ancestor) under `fixed`,
696
+ // so the default `100%` is replaced with the trigger width, as with `absolute`.
697
+ middleware.push(size({
698
+ boundary,
699
+ rootBoundary,
700
+ apply: ({ rects }) => {
701
+ const maxWidth = getComputedStyle(this).getPropertyValue('--mdc-popover-max-width').trim();
702
+ if (maxWidth !== '100%') {
703
+ this.style.removeProperty('--mdc-popover-internal-trigger-width');
704
+ return;
705
+ }
706
+ this.style.setProperty('--mdc-popover-internal-trigger-width', `${rects.reference.width}px`);
707
+ },
708
+ }));
709
+ }
710
+ else {
711
+ this.style.removeProperty('--mdc-popover-internal-trigger-width');
712
+ }
694
713
  if (this.size) {
695
714
  // expose a CSS variable for the available height
696
715
  // so that it can be used in other components styles
@@ -15,6 +15,8 @@ const styles = css `
15
15
  --mdc-popover-max-height: auto;
16
16
  --mdc-popover-backdrop-color: var(--mds-color-theme-common-overlays-secondary-normal);
17
17
  --mdc-backdrop-mixin-background-color: var(--mdc-popover-backdrop-color);
18
+ /* set inline by positionPopover; 'initial' stops nested popovers from inheriting it */
19
+ --mdc-popover-internal-trigger-width: initial;
18
20
 
19
21
  display: none;
20
22
  position: absolute;
@@ -27,7 +29,7 @@ const styles = css `
27
29
  border: 0.0625rem solid var(--mdc-popover-border-color);
28
30
  filter: var(--mdc-popover-elevation-3);
29
31
  max-width: var(--mdc-popover-max-width);
30
- width: var(--mdc-popover-width, var(--mdc-popover-max-width));
32
+ width: var(--mdc-popover-internal-trigger-width, var(--mdc-popover-width, var(--mdc-popover-max-width)));
31
33
  }
32
34
 
33
35
  :host([strategy='absolute']) {
@@ -68,7 +68,7 @@ declare const Select_base: import("../../utils/mixins/index.types").Constructor<
68
68
  * @cssproperty --mdc-select-height - The height of the select trigger control.
69
69
  * @cssproperty --mdc-select-width - The width of the select.
70
70
  * @cssproperty --mdc-select-listbox-height - The height of the listbox inside the select.
71
- * @cssproperty --mdc-select-listbox-width - The width of the listbox inside the select (default: `--mdc-select-width`).
71
+ * @cssproperty --mdc-select-listbox-width - The width of the listbox inside the select (default: `--mdc-select-width`). With `strategy="fixed"`, the default `100%` matches the select trigger width.
72
72
  */
73
73
  declare class Select extends Select_base implements AssociatedFormControl {
74
74
  /** @internal */
@@ -72,7 +72,7 @@ import styles from './select.styles';
72
72
  * @cssproperty --mdc-select-height - The height of the select trigger control.
73
73
  * @cssproperty --mdc-select-width - The width of the select.
74
74
  * @cssproperty --mdc-select-listbox-height - The height of the listbox inside the select.
75
- * @cssproperty --mdc-select-listbox-width - The width of the listbox inside the select (default: `--mdc-select-width`).
75
+ * @cssproperty --mdc-select-listbox-width - The width of the listbox inside the select (default: `--mdc-select-width`). With `strategy="fixed"`, the default `100%` matches the select trigger width.
76
76
  */
77
77
  class Select extends ListNavigationMixin(KeyToActionMixin(CaptureDestroyEventForChildElement(AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)))))) {
78
78
  constructor() {
@@ -45,6 +45,7 @@ declare const TimePicker_base: import("../../utils/mixins/index.types").Construc
45
45
  * @cssproperty --mdc-timepicker-height - The height of the timepicker trigger control.
46
46
  * @cssproperty --mdc-timepicker-width - Width of the timepicker component.
47
47
  * @cssproperty --mdc-timepicker-listbox-height - The max-height of the dropdown listbox. Default shows ~6 items.
48
+ * @cssproperty --mdc-timepicker-listbox-width - The width of the dropdown listbox (default: `100%`). With `strategy="fixed"`, the default `100%` matches the timepicker trigger width. The listbox is never narrower than its options.
48
49
  *
49
50
  * @csspart label - The label element.
50
51
  * @csspart label-text - The container for the label and required indicator elements.
@@ -43,6 +43,7 @@ import styles from './timepicker.styles';
43
43
  * @cssproperty --mdc-timepicker-height - The height of the timepicker trigger control.
44
44
  * @cssproperty --mdc-timepicker-width - Width of the timepicker component.
45
45
  * @cssproperty --mdc-timepicker-listbox-height - The max-height of the dropdown listbox. Default shows ~6 items.
46
+ * @cssproperty --mdc-timepicker-listbox-width - The width of the dropdown listbox (default: `100%`). With `strategy="fixed"`, the default `100%` matches the timepicker trigger width. The listbox is never narrower than its options.
46
47
  *
47
48
  * @csspart label - The label element.
48
49
  * @csspart label-text - The container for the label and required indicator elements.