@momentum-design/components 0.70.1 → 0.70.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.
@@ -74,6 +74,7 @@ const styles = css `
74
74
  }
75
75
 
76
76
  .popover-close {
77
+ box-sizing: border-box;
77
78
  position: absolute;
78
79
  right: 0.75rem;
79
80
  top: 0.75rem;
@@ -2,6 +2,7 @@ import type { PropertyValues, TemplateResult } from 'lit';
2
2
  import { CSSResult } from 'lit';
3
3
  import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
4
4
  import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
5
+ import type { IconNames } from '../icon/icon.types';
5
6
  declare const Select_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
6
7
  /**
7
8
  * The mdc-select component is a dropdown selection control that allows users to pick an option from a predefined list.
@@ -45,6 +46,8 @@ declare class Select extends Select_base implements AssociatedFormControl {
45
46
  /** @internal */
46
47
  selectedValueText?: string;
47
48
  /** @internal */
49
+ selectedIcon?: IconNames | null;
50
+ /** @internal */
48
51
  selectedValue: string;
49
52
  /** @internal */
50
53
  displayPopover: boolean;
@@ -143,6 +143,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
143
143
  setSelectedValue(option) {
144
144
  var _a, _b, _c, _d;
145
145
  this.selectedValueText = (_b = (_a = option === null || option === void 0 ? void 0 : option.getAttribute('label')) !== null && _a !== void 0 ? _a : option === null || option === void 0 ? void 0 : option.textContent) !== null && _b !== void 0 ? _b : '';
146
+ this.selectedIcon = option === null || option === void 0 ? void 0 : option.getAttribute('prefix-icon');
146
147
  this.selectedValue = (_d = (_c = option === null || option === void 0 ? void 0 : option.getAttribute('value')) !== null && _c !== void 0 ? _c : option === null || option === void 0 ? void 0 : option.textContent) !== null && _d !== void 0 ? _d : '';
147
148
  // Set form value
148
149
  this.internals.setFormValue(this.selectedValue);
@@ -176,6 +177,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
176
177
  formResetCallback() {
177
178
  this.selectedValue = '';
178
179
  this.selectedValueText = undefined;
180
+ this.selectedIcon = null;
179
181
  this.internals.setFormValue(this.selectedValue);
180
182
  this.updateTabIndexForAllOptions();
181
183
  }
@@ -486,6 +488,9 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
486
488
  aria-labelledby="${this.label ? FORMFIELD_DEFAULTS.HEADING_ID : ''}"
487
489
  aria-expanded="${this.displayPopover ? 'true' : 'false'}"
488
490
  >
491
+ ${this.selectedIcon
492
+ ? html `<mdc-icon length-unit="rem" size="1" name="${this.selectedIcon}" part="selected-icon"></mdc-icon>`
493
+ : nothing}
489
494
  <mdc-text
490
495
  part="base-text ${this.selectedValueText ? 'selected' : ''}"
491
496
  type="${TYPE.BODY_MIDSIZE_REGULAR}"
@@ -529,6 +534,10 @@ __decorate([
529
534
  state(),
530
535
  __metadata("design:type", String)
531
536
  ], Select.prototype, "selectedValueText", void 0);
537
+ __decorate([
538
+ state(),
539
+ __metadata("design:type", Object)
540
+ ], Select.prototype, "selectedIcon", void 0);
532
541
  __decorate([
533
542
  state(),
534
543
  __metadata("design:type", Object)
@@ -42,6 +42,7 @@ const styles = css `
42
42
  background: var(--mdc-select-background-color);
43
43
  display: flex;
44
44
  gap: 0.375rem;
45
+ align-items: center;
45
46
  user-select: none;
46
47
  }
47
48
  :host::part(base-container):hover {
@@ -61,6 +62,9 @@ const styles = css `
61
62
  :host::part(selected) {
62
63
  color: var(--mdc-select-selected-text-color);
63
64
  }
65
+ :host::part(selected-icon) {
66
+ flex-shrink: 0;
67
+ }
64
68
  :host::part(icon-container) {
65
69
  margin-left: auto;
66
70
  display: flex;