@momentum-design/components 0.53.2 → 0.53.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.
@@ -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 };
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.3"
43
43
  }