@momentum-design/components 0.53.2 → 0.53.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.
@@ -76,8 +76,6 @@ declare class Button extends Buttonsimple {
76
76
  role: string;
77
77
  /** @internal */
78
78
  private typeInternal;
79
- /** @internal */
80
- private iconSize;
81
79
  /**
82
80
  * @internal
83
81
  */
@@ -12,7 +12,7 @@ import { property, state } from 'lit/decorators.js';
12
12
  import Buttonsimple from '../buttonsimple/buttonsimple.component';
13
13
  import { BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_VARIANTS, DEFAULTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, } from './button.constants';
14
14
  import styles from './button.styles';
15
- import { getIconNameWithoutStyle, getIconSize } from './button.utils';
15
+ import { getIconNameWithoutStyle } from './button.utils';
16
16
  /**
17
17
  * `mdc-button` is a component that can be configured in various ways to suit different use cases.
18
18
  *
@@ -79,8 +79,6 @@ class Button extends Buttonsimple {
79
79
  this.role = 'button';
80
80
  /** @internal */
81
81
  this.typeInternal = DEFAULTS.TYPE_INTERNAL;
82
- /** @internal */
83
- this.iconSize = 1;
84
82
  }
85
83
  update(changedProperties) {
86
84
  super.update(changedProperties);
@@ -156,7 +154,6 @@ class Button extends Buttonsimple {
156
154
  && !(size === ICON_BUTTON_SIZES[20] && this.variant !== BUTTON_VARIANTS.TERTIARY)
157
155
  : Object.values(PILL_BUTTON_SIZES).includes(size);
158
156
  this.setAttribute('size', isValidSize ? `${size}` : `${DEFAULTS.SIZE}`);
159
- this.iconSize = getIconSize(size);
160
157
  }
161
158
  /**
162
159
  * Sets the color attribute for the button.
@@ -198,7 +195,6 @@ class Button extends Buttonsimple {
198
195
  ? html ` <mdc-icon
199
196
  name="${this.prefixIcon}"
200
197
  part="prefix-icon"
201
- size=${this.iconSize}
202
198
  length-unit="rem"
203
199
  >
204
200
  </mdc-icon>`
@@ -208,7 +204,6 @@ class Button extends Buttonsimple {
208
204
  ? html ` <mdc-icon
209
205
  name="${this.postfixIcon}"
210
206
  part="postfix-icon"
211
- size=${this.iconSize}
212
207
  length-unit="rem"
213
208
  >
214
209
  </mdc-icon>`
@@ -245,8 +240,4 @@ __decorate([
245
240
  state(),
246
241
  __metadata("design:type", String)
247
242
  ], Button.prototype, "typeInternal", void 0);
248
- __decorate([
249
- state(),
250
- __metadata("design:type", Object)
251
- ], Button.prototype, "iconSize", void 0);
252
243
  export default Button;
@@ -31,6 +31,33 @@ const styles = css `
31
31
  --mdc-button-line-height-size-32: var(--mds-font-lineheight-body-large);
32
32
  --mdc-button-line-height-size-28: var(--mds-font-lineheight-body-midsize);
33
33
  --mdc-button-line-height-size-24: var(--mds-font-lineheight-body-small);
34
+
35
+ --mdc-button-prefix-icon-size: 1rem;
36
+ --mdc-button-postfix-icon-size: 1rem;
37
+ }
38
+
39
+ :host([size="64"]) {
40
+ --mdc-button-prefix-icon-size: 2rem;
41
+ --mdc-button-postfix-icon-size: 2rem;
42
+ }
43
+
44
+ :host([size="52"]) {
45
+ --mdc-button-prefix-icon-size: 1.75rem;
46
+ --mdc-button-postfix-icon-size: 1.75rem;
47
+ }
48
+
49
+ :host([size="40"]) {
50
+ --mdc-button-prefix-icon-size: 1.25rem;
51
+ --mdc-button-postfix-icon-size: 1.25rem;
52
+ }
53
+
54
+ /* Apply icon size for prefix and postfix icons */
55
+ :host::part(prefix-icon) {
56
+ --mdc-icon-size: var(--mdc-button-prefix-icon-size);
57
+ }
58
+
59
+ :host::part(postfix-icon) {
60
+ --mdc-icon-size: var(--mdc-button-postfix-icon-size);
34
61
  }
35
62
 
36
63
  :host([active]){
@@ -1,11 +1,3 @@
1
- import { IconButtonSize } from './button.types';
2
- /**
3
- * Returns the icon size multiplier based on the provided button size.
4
- *
5
- * @param size - The size of the button.
6
- * @returns The multiplier for the icon size.
7
- */
8
- declare const getIconSize: (size: IconButtonSize) => number;
9
1
  /**
10
2
  * Returns the name of the icon without the style suffix.
11
3
  *
@@ -13,4 +5,4 @@ declare const getIconSize: (size: IconButtonSize) => number;
13
5
  * @returns The name of the icon without the suffix.
14
6
  */
15
7
  declare const getIconNameWithoutStyle: (iconName: string) => string;
16
- export { getIconSize, getIconNameWithoutStyle };
8
+ export { getIconNameWithoutStyle };
@@ -1,18 +1,3 @@
1
- import { ICON_BUTTON_SIZES } from './button.constants';
2
- /**
3
- * Returns the icon size multiplier based on the provided button size.
4
- *
5
- * @param size - The size of the button.
6
- * @returns The multiplier for the icon size.
7
- */
8
- const getIconSize = (size) => {
9
- switch (size) {
10
- case ICON_BUTTON_SIZES[64]: return 2;
11
- case ICON_BUTTON_SIZES[52]: return 1.75;
12
- case ICON_BUTTON_SIZES[40]: return 1.25;
13
- default: return 1;
14
- }
15
- };
16
1
  /**
17
2
  * Returns the name of the icon without the style suffix.
18
3
  *
@@ -24,4 +9,4 @@ const getIconNameWithoutStyle = (iconName) => {
24
9
  const variants = ['bold', 'filled', 'regular', 'light'];
25
10
  return iconParts.filter((part) => !variants.includes(part)).join('-');
26
11
  };
27
- export { getIconSize, getIconNameWithoutStyle };
12
+ export { getIconNameWithoutStyle };
@@ -98,6 +98,7 @@ class Option extends FormInternalsMixin(ListItem) {
98
98
  tooltip.textContent = (_b = this.label) !== null && _b !== void 0 ? _b : '';
99
99
  tooltip.setAttribute('triggerid', this.id);
100
100
  tooltip.setAttribute('visible', '');
101
+ tooltip.setAttribute('show-arrow', '');
101
102
  // Add tooltip programmatically after the nearest select component or the parent element.
102
103
  const parent = this.closest(SELECT_TAG_NAME) || this.parentElement;
103
104
  parent === null || parent === void 0 ? void 0 : parent.after(tooltip);
@@ -493,7 +493,10 @@ class Popover extends FocusTrapMixin(Component) {
493
493
  this.triggerElement.removeAttribute('aria-expanded');
494
494
  }
495
495
  if (this.interactive) {
496
- this.triggerElement.removeAttribute('aria-haspopup');
496
+ const triggerElementRole = this.triggerElement.getAttribute('aria-haspopup');
497
+ if (triggerElementRole === 'dialog' || triggerElementRole === 'alertdialog') {
498
+ this.triggerElement.removeAttribute('aria-haspopup');
499
+ }
497
500
  }
498
501
  if (this.focusBackToTrigger) {
499
502
  (_c = this.triggerElement) === null || _c === void 0 ? void 0 : _c.focus();
@@ -89,7 +89,9 @@ export class PopoverUtils {
89
89
  */
90
90
  setupAccessibility() {
91
91
  var _a, _b, _c;
92
- this.popover.toggleAttribute('aria-modal', this.popover.interactive);
92
+ if (this.popover.role === 'dialog' || this.popover.role === 'alertdialog') {
93
+ this.popover.toggleAttribute('aria-modal', this.popover.interactive);
94
+ }
93
95
  if (this.popover.interactive) {
94
96
  if (!this.popover.ariaLabel) {
95
97
  this.popover.ariaLabel = ((_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.ariaLabel)
@@ -90,9 +90,11 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
90
90
  }).flat()) || [];
91
91
  }
92
92
  handlePopoverOpen() {
93
+ this.displayPopover = true;
93
94
  this.baseIconName = ARROW_ICON.ARROW_UP;
94
95
  }
95
96
  handlePopoverClose() {
97
+ this.displayPopover = false;
96
98
  this.baseIconName = ARROW_ICON.ARROW_DOWN;
97
99
  }
98
100
  /**
@@ -220,10 +222,12 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
220
222
  case KEYS.SPACE:
221
223
  this.updateTabIndexForAllOptions(event.target);
222
224
  this.closePopover();
225
+ event.preventDefault();
223
226
  break;
224
227
  case KEYS.ENTER:
225
228
  this.updateTabIndexForAllOptions(event.target);
226
229
  this.closePopover();
230
+ event.preventDefault();
227
231
  // if the popover is closed, then we submit the form.
228
232
  (_a = this.form) === null || _a === void 0 ? void 0 : _a.requestSubmit();
229
233
  break;
@@ -232,9 +236,11 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
232
236
  break;
233
237
  case KEYS.HOME:
234
238
  this.setFocusAndTabIndex(0);
239
+ event.preventDefault();
235
240
  break;
236
241
  case KEYS.END:
237
242
  this.setFocusAndTabIndex(this.getAllValidOptions().length - 1);
243
+ event.preventDefault();
238
244
  break;
239
245
  case KEYS.ARROW_DOWN:
240
246
  case KEYS.ARROW_UP:
@@ -269,10 +275,12 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
269
275
  case KEYS.HOME:
270
276
  this.openPopover();
271
277
  this.setFocusAndTabIndex(0);
278
+ event.preventDefault();
272
279
  break;
273
280
  case KEYS.END:
274
281
  this.openPopover();
275
282
  this.setFocusAndTabIndex(this.getAllValidOptions().length - 1);
283
+ event.preventDefault();
276
284
  break;
277
285
  default:
278
286
  break;
@@ -379,7 +387,6 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
379
387
  * @returns A TemplateResult representing the native select element.
380
388
  */
381
389
  getNativeSelect() {
382
- var _a;
383
390
  return html `
384
391
  <select
385
392
  part="native-select"
@@ -391,11 +398,6 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
391
398
  ?autofocus="${this.autofocus}"
392
399
  ?disabled="${this.disabled}"
393
400
  ?required="${!!this.requiredLabel}"
394
- aria-activedescendant="${this.activeDescendant}"
395
- aria-expanded="${this.displayPopover}"
396
- aria-haspopup="listbox"
397
- aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
398
- aria-labelledby="${this.label ? FORMFIELD_DEFAULTS.HEADING_ID : ''}"
399
401
  @mousedown="${(event) => event.preventDefault()}"
400
402
  >
401
403
  ${this.getOptionsContentFromSlot()}
@@ -447,7 +449,6 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
447
449
  hide-on-outside-click
448
450
  focus-back-to-trigger
449
451
  focus-trap
450
- prevent-scroll
451
452
  role="listbox"
452
453
  placement="${POPOVER_PLACEMENT.BOTTOM_START}"
453
454
  @shown="${this.handlePopoverOpen}"
@@ -466,7 +467,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
466
467
  }
467
468
  }
468
469
  render() {
469
- var _a;
470
+ var _a, _b;
470
471
  return html `
471
472
  ${this.renderLabel()}
472
473
  <div part="container">
@@ -475,13 +476,19 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
475
476
  part="base-container"
476
477
  tabindex="${this.disabled ? '-1' : '0'}"
477
478
  class="${this.disabled ? '' : 'mdc-focus-ring'}"
479
+ role="combobox"
480
+ aria-activedescendant="${this.activeDescendant}"
481
+ aria-haspopup="listbox"
482
+ aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
483
+ aria-labelledby="${this.label ? FORMFIELD_DEFAULTS.HEADING_ID : ''}"
484
+ aria-expanded="${this.displayPopover ? 'true' : 'false'}"
478
485
  >
479
486
  <mdc-text
480
487
  part="base-text ${this.selectedValueText ? 'selected' : ''}"
481
488
  type="${TYPE.BODY_MIDSIZE_REGULAR}"
482
489
  tagname="${VALID_TEXT_TAGS.SPAN}"
483
490
  >
484
- ${(_a = this.selectedValueText) !== null && _a !== void 0 ? _a : this.placeholder}
491
+ ${(_b = this.selectedValueText) !== null && _b !== void 0 ? _b : this.placeholder}
485
492
  </mdc-text>
486
493
  <div part="icon-container">
487
494
  <mdc-icon size="1" length-unit="rem" name="${this.baseIconName}"></mdc-icon>
@@ -29,7 +29,7 @@ const styles = css `
29
29
  position: absolute;
30
30
  width: 100%;
31
31
  height: 1px;
32
- z-index: 1;
32
+ z-index: -1;
33
33
  }
34
34
  :host::part(container) {
35
35
  width: 100%;
@@ -1802,77 +1802,6 @@
1802
1802
  }
1803
1803
  ]
1804
1804
  },
1805
- {
1806
- "kind": "javascript-module",
1807
- "path": "components/bullet/bullet.component.js",
1808
- "declarations": [
1809
- {
1810
- "kind": "class",
1811
- "description": "Bullet component, which is a visual marker\nand be used to organize and present items in a list format.",
1812
- "name": "Bullet",
1813
- "cssProperties": [
1814
- {
1815
- "description": "background color of the bullet",
1816
- "name": "--mdc-bullet-background-color"
1817
- },
1818
- {
1819
- "description": "small size value of the bullet",
1820
- "name": "--mdc-bullet-size-small"
1821
- },
1822
- {
1823
- "description": "medium size value of the bullet",
1824
- "name": "--mdc-bullet-size-medium"
1825
- },
1826
- {
1827
- "description": "large size value of the bullet",
1828
- "name": "--mdc-bullet-size-large"
1829
- }
1830
- ],
1831
- "members": [
1832
- {
1833
- "kind": "field",
1834
- "name": "size",
1835
- "type": {
1836
- "text": "Size"
1837
- },
1838
- "privacy": "public",
1839
- "description": "Size of the bullet\n\nPossible values: 'small', 'medium', 'large'",
1840
- "default": "small",
1841
- "attribute": "size",
1842
- "reflects": true
1843
- }
1844
- ],
1845
- "attributes": [
1846
- {
1847
- "name": "size",
1848
- "type": {
1849
- "text": "Size"
1850
- },
1851
- "description": "Size of the bullet\n\nPossible values: 'small', 'medium', 'large'",
1852
- "default": "small",
1853
- "fieldName": "size"
1854
- }
1855
- ],
1856
- "superclass": {
1857
- "name": "Component",
1858
- "module": "/src/models"
1859
- },
1860
- "tagName": "mdc-bullet",
1861
- "jsDoc": "/**\n * Bullet component, which is a visual marker\n * and be used to organize and present items in a list format.\n *\n * @tagname mdc-bullet\n *\n * @cssproperty --mdc-bullet-background-color - background color of the bullet\n * @cssproperty --mdc-bullet-size-small - small size value of the bullet\n * @cssproperty --mdc-bullet-size-medium - medium size value of the bullet\n * @cssproperty --mdc-bullet-size-large - large size value of the bullet\n*/",
1862
- "customElement": true
1863
- }
1864
- ],
1865
- "exports": [
1866
- {
1867
- "kind": "js",
1868
- "name": "default",
1869
- "declaration": {
1870
- "name": "Bullet",
1871
- "module": "components/bullet/bullet.component.js"
1872
- }
1873
- }
1874
- ]
1875
- },
1876
1805
  {
1877
1806
  "kind": "javascript-module",
1878
1807
  "path": "components/button/button.component.js",
@@ -2434,6 +2363,77 @@
2434
2363
  }
2435
2364
  ]
2436
2365
  },
2366
+ {
2367
+ "kind": "javascript-module",
2368
+ "path": "components/bullet/bullet.component.js",
2369
+ "declarations": [
2370
+ {
2371
+ "kind": "class",
2372
+ "description": "Bullet component, which is a visual marker\nand be used to organize and present items in a list format.",
2373
+ "name": "Bullet",
2374
+ "cssProperties": [
2375
+ {
2376
+ "description": "background color of the bullet",
2377
+ "name": "--mdc-bullet-background-color"
2378
+ },
2379
+ {
2380
+ "description": "small size value of the bullet",
2381
+ "name": "--mdc-bullet-size-small"
2382
+ },
2383
+ {
2384
+ "description": "medium size value of the bullet",
2385
+ "name": "--mdc-bullet-size-medium"
2386
+ },
2387
+ {
2388
+ "description": "large size value of the bullet",
2389
+ "name": "--mdc-bullet-size-large"
2390
+ }
2391
+ ],
2392
+ "members": [
2393
+ {
2394
+ "kind": "field",
2395
+ "name": "size",
2396
+ "type": {
2397
+ "text": "Size"
2398
+ },
2399
+ "privacy": "public",
2400
+ "description": "Size of the bullet\n\nPossible values: 'small', 'medium', 'large'",
2401
+ "default": "small",
2402
+ "attribute": "size",
2403
+ "reflects": true
2404
+ }
2405
+ ],
2406
+ "attributes": [
2407
+ {
2408
+ "name": "size",
2409
+ "type": {
2410
+ "text": "Size"
2411
+ },
2412
+ "description": "Size of the bullet\n\nPossible values: 'small', 'medium', 'large'",
2413
+ "default": "small",
2414
+ "fieldName": "size"
2415
+ }
2416
+ ],
2417
+ "superclass": {
2418
+ "name": "Component",
2419
+ "module": "/src/models"
2420
+ },
2421
+ "tagName": "mdc-bullet",
2422
+ "jsDoc": "/**\n * Bullet component, which is a visual marker\n * and be used to organize and present items in a list format.\n *\n * @tagname mdc-bullet\n *\n * @cssproperty --mdc-bullet-background-color - background color of the bullet\n * @cssproperty --mdc-bullet-size-small - small size value of the bullet\n * @cssproperty --mdc-bullet-size-medium - medium size value of the bullet\n * @cssproperty --mdc-bullet-size-large - large size value of the bullet\n*/",
2423
+ "customElement": true
2424
+ }
2425
+ ],
2426
+ "exports": [
2427
+ {
2428
+ "kind": "js",
2429
+ "name": "default",
2430
+ "declaration": {
2431
+ "name": "Bullet",
2432
+ "module": "components/bullet/bullet.component.js"
2433
+ }
2434
+ }
2435
+ ]
2436
+ },
2437
2437
  {
2438
2438
  "kind": "javascript-module",
2439
2439
  "path": "components/buttonsimple/buttonsimple.component.js",
@@ -4,8 +4,8 @@ export { default as Avatar } from './avatar';
4
4
  export { default as AvatarButton } from './avatarbutton';
5
5
  export { default as Badge } from './badge';
6
6
  export { default as Brandvisual } from './brandvisual';
7
- export { default as Bullet } from './bullet';
8
7
  export { default as Button } from './button';
8
+ export { default as Bullet } from './bullet';
9
9
  export { default as Buttonsimple } from './buttonsimple';
10
10
  export { default as Checkbox } from './checkbox';
11
11
  export { default as Chip } from './chip';
@@ -4,8 +4,8 @@ export { default as Avatar } from './avatar';
4
4
  export { default as AvatarButton } from './avatarbutton';
5
5
  export { default as Badge } from './badge';
6
6
  export { default as Brandvisual } from './brandvisual';
7
- export { default as Bullet } from './bullet';
8
7
  export { default as Button } from './button';
8
+ export { default as Bullet } from './bullet';
9
9
  export { default as Buttonsimple } from './buttonsimple';
10
10
  export { default as Checkbox } from './checkbox';
11
11
  export { default as Chip } from './chip';
package/package.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "lit": "^3.2.0",
40
40
  "uuid": "^11.0.5"
41
41
  },
42
- "version": "0.53.2"
42
+ "version": "0.53.4"
43
43
  }