@momentum-design/components 0.53.4 → 0.53.6

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.
@@ -1,6 +1,7 @@
1
1
  import type { PropertyValues } from 'lit';
2
2
  import { CSSResult } from 'lit';
3
3
  import Buttonsimple from '../buttonsimple/buttonsimple.component';
4
+ import type { IconNames } from '../icon/icon.types';
4
5
  import type { ButtonColor, ButtonVariant, IconButtonSize, PillButtonSize } from './button.types';
5
6
  /**
6
7
  * `mdc-button` is a component that can be configured in various ways to suit different use cases.
@@ -39,12 +40,12 @@ declare class Button extends Buttonsimple {
39
40
  * The name of the icon to display as a prefix.
40
41
  * The icon is displayed on the left side of the button.
41
42
  */
42
- prefixIcon?: string;
43
+ prefixIcon?: IconNames;
43
44
  /**
44
45
  * The name of the icon to display as a postfix.
45
46
  * The icon is displayed on the right side of the button.
46
47
  */
47
- postfixIcon?: string;
48
+ postfixIcon?: IconNames;
48
49
  /**
49
50
  * There are 3 variants of button: primary, secondary, tertiary. They are styled differently.
50
51
  * - **Primary**: Solid background color.
@@ -191,22 +191,10 @@ class Button extends Buttonsimple {
191
191
  }
192
192
  render() {
193
193
  return html `
194
- ${this.prefixIcon
195
- ? html ` <mdc-icon
196
- name="${this.prefixIcon}"
197
- part="prefix-icon"
198
- length-unit="rem"
199
- >
200
- </mdc-icon>`
201
- : ''}
194
+ ${this.prefixIcon ? html ` <mdc-icon name="${this.prefixIcon}" part="prefix-icon"></mdc-icon>` : ''}
202
195
  <slot @slotchange=${this.inferButtonType}></slot>
203
196
  ${this.postfixIcon
204
- ? html ` <mdc-icon
205
- name="${this.postfixIcon}"
206
- part="postfix-icon"
207
- length-unit="rem"
208
- >
209
- </mdc-icon>`
197
+ ? html ` <mdc-icon name="${this.postfixIcon}" part="postfix-icon"></mdc-icon>`
210
198
  : ''}
211
199
  `;
212
200
  }
@@ -12,7 +12,7 @@ const styles = css `
12
12
  --mdc-button-primary-pressed-background-color: var(--mds-color-theme-button-primary-pressed);
13
13
  --mdc-button-primary-disabled-background-color: var(--mds-color-theme-button-primary-disabled);
14
14
  --mdc-button-primary-disabled-color: var(--mds-color-theme-text-primary-disabled);
15
-
15
+
16
16
  --mdc-button-secondary-color: var(--mds-color-theme-text-primary-normal);
17
17
  --mdc-button-secondary-border-color: var(--mds-color-theme-outline-button-normal);
18
18
  --mdc-button-secondary-hover-background-color: var(--mds-color-theme-button-secondary-hover);
@@ -27,6 +27,11 @@ const styles = css `
27
27
  --mdc-button-tertiary-disabled-background-color: var(--mds-color-theme-button-secondary-disabled);
28
28
  --mdc-button-tertiary-disabled-color: var(--mds-color-theme-text-primary-disabled);
29
29
 
30
+ --mdc-button-active-background-color: var(--mds-color-theme-button-secondary-active-normal);
31
+ --mdc-button-active-hover-background-color: var(--mds-color-theme-button-secondary-active-hover);
32
+ --mdc-button-active-pressed-background-color: var(--mds-color-theme-button-secondary-active-pressed);
33
+ --mdc-button-active-disabled-background-color: var(--mds-color-theme-button-secondary-active-disabled);
34
+
30
35
  --mdc-button-line-height-size-40: var(--mds-font-lineheight-body-large);
31
36
  --mdc-button-line-height-size-32: var(--mds-font-lineheight-body-large);
32
37
  --mdc-button-line-height-size-28: var(--mds-font-lineheight-body-midsize);
@@ -36,17 +41,17 @@ const styles = css `
36
41
  --mdc-button-postfix-icon-size: 1rem;
37
42
  }
38
43
 
39
- :host([size="64"]) {
44
+ :host([size='64']) {
40
45
  --mdc-button-prefix-icon-size: 2rem;
41
46
  --mdc-button-postfix-icon-size: 2rem;
42
47
  }
43
48
 
44
- :host([size="52"]) {
49
+ :host([size='52']) {
45
50
  --mdc-button-prefix-icon-size: 1.75rem;
46
51
  --mdc-button-postfix-icon-size: 1.75rem;
47
52
  }
48
53
 
49
- :host([size="40"]) {
54
+ :host([size='40']) {
50
55
  --mdc-button-prefix-icon-size: 1.25rem;
51
56
  --mdc-button-postfix-icon-size: 1.25rem;
52
57
  }
@@ -60,101 +65,124 @@ const styles = css `
60
65
  --mdc-icon-size: var(--mdc-button-postfix-icon-size);
61
66
  }
62
67
 
63
- :host([active]){
68
+ :host([active]) {
69
+ font-weight: var(--mds-font-apps-body-large-bold-font-weight);
70
+ }
71
+
72
+ :host([active]:not([variant='primary'])) {
73
+ font-weight: var(--mds-font-apps-body-large-bold-font-weight);
74
+ background: var(--mdc-button-active-background-color);
75
+ }
76
+ :host([active]:not([variant='primary']):hover) {
77
+ font-weight: var(--mds-font-apps-body-large-bold-font-weight);
78
+ background: var(--mdc-button-active-hover-background-color);
79
+ }
80
+ :host([active]:not([variant='primary']):active),
81
+ :host([active]:not([variant='primary']).pressed) {
82
+ font-weight: var(--mds-font-apps-body-large-bold-font-weight);
83
+ background: var(--mdc-button-active-pressed-background-color);
84
+ }
85
+ :host([active]:not([variant='primary'])[disabled]),
86
+ :host([active]:not([variant='primary'])[soft-disabled]) {
64
87
  font-weight: var(--mds-font-apps-body-large-bold-font-weight);
88
+ background: var(--mdc-button-active-disabled-background-color);
65
89
  }
66
90
 
67
- :host([variant="primary"]){
91
+ :host([variant='primary']) {
68
92
  background: var(--mdc-button-primary-background-color);
69
93
  color: var(--mdc-button-primary-color);
70
94
  }
71
- :host([variant="primary"]:hover){
95
+ :host([variant='primary']:hover) {
72
96
  background: var(--mdc-button-primary-hover-background-color);
73
97
  }
74
- :host([variant="primary"]:active), :host([variant="primary"].pressed){
98
+ :host([variant='primary']:active),
99
+ :host([variant='primary'].pressed) {
75
100
  background: var(--mdc-button-primary-pressed-background-color);
76
101
  }
77
- :host([variant="primary"][disabled]), :host([variant="primary"][soft-disabled]){
102
+ :host([variant='primary'][disabled]),
103
+ :host([variant='primary'][soft-disabled]) {
78
104
  background: var(--mdc-button-primary-disabled-background-color);
79
105
  color: var(--mdc-button-primary-disabled-color);
80
106
  cursor: auto;
81
107
  }
82
108
 
83
- :host([variant="secondary"]){
109
+ :host([variant='secondary']) {
84
110
  color: var(--mdc-button-secondary-color);
85
111
  border-color: var(--mdc-button-secondary-border-color);
86
112
  }
87
- :host([variant="secondary"]:hover){
113
+ :host([variant='secondary']:hover) {
88
114
  background: var(--mdc-button-secondary-hover-background-color);
89
115
  }
90
- :host([variant="secondary"]:active), :host([variant="secondary"].pressed){
116
+ :host([variant='secondary']:active),
117
+ :host([variant='secondary'].pressed) {
91
118
  background: var(--mdc-button-secondary-pressed-background-color);
92
119
  }
93
- :host([variant="secondary"][disabled]),
94
- :host([variant="secondary"][soft-disabled]){
120
+ :host([variant='secondary'][disabled]),
121
+ :host([variant='secondary'][soft-disabled]) {
95
122
  color: var(--mdc-button-primary-disabled-color);
96
123
  border-color: var(--mdc-button-secondary-disabled-border-color);
97
124
  background: var(--mdc-button-secondary-disabled-background-color);
98
125
  cursor: auto;
99
126
  }
100
127
 
101
- :host([variant="tertiary"]){
128
+ :host([variant='tertiary']) {
102
129
  border-color: transparent;
103
130
  color: var(--mdc-button-tertiary-color);
104
131
  }
105
- :host([variant="tertiary"]:hover){
132
+ :host([variant='tertiary']:hover) {
106
133
  background: var(--mdc-button-tertiary-hover-background-color);
107
134
  }
108
- :host([variant="tertiary"]:active), :host([variant="tertiary"].pressed){
135
+ :host([variant='tertiary']:active),
136
+ :host([variant='tertiary'].pressed) {
109
137
  background: var(--mdc-button-tertiary-pressed-background-color);
110
138
  }
111
- :host([variant="tertiary"][disabled]),
112
- :host([variant="tertiary"][soft-disabled]){
139
+ :host([variant='tertiary'][disabled]),
140
+ :host([variant='tertiary'][soft-disabled]) {
113
141
  color: var(--mdc-button-tertiary-disabled-color);
114
142
  background: var(--mdc-button-tertiary-disabled-background-color);
115
143
  cursor: auto;
116
144
  }
117
145
 
118
- :host([size="64"][data-btn-type='icon']),
119
- :host([size="52"][data-btn-type='icon']),
120
- :host([size="40"][data-btn-type='icon']),
121
- :host([size="32"][data-btn-type='icon']),
122
- :host([size="28"][data-btn-type='icon']),
123
- :host([size="24"][data-btn-type='icon']){
146
+ :host([size='64'][data-btn-type='icon']),
147
+ :host([size='52'][data-btn-type='icon']),
148
+ :host([size='40'][data-btn-type='icon']),
149
+ :host([size='32'][data-btn-type='icon']),
150
+ :host([size='28'][data-btn-type='icon']),
151
+ :host([size='24'][data-btn-type='icon']) {
124
152
  border-radius: 6.25rem;
125
153
  aspect-ratio: 1;
126
154
  padding: unset;
127
155
  }
128
- :host([size="40"]){
156
+ :host([size='40']) {
129
157
  font-size: var(--mds-font-size-body-large);
130
158
  line-height: var(--mdc-button-line-height-size-40);
131
159
  padding: 0 1rem;
132
160
  gap: 0.5rem;
133
161
  }
134
- :host([size="32"]){
162
+ :host([size='32']) {
135
163
  font-size: var(--mds-font-size-body-large);
136
164
  line-height: var(--mdc-button-line-height-size-32);
137
165
  padding: 0 0.75rem;
138
166
  gap: 0.375rem;
139
167
  }
140
- :host([size="28"]){
168
+ :host([size='28']) {
141
169
  font-size: var(--mds-font-size-body-midsize);
142
170
  line-height: var(--mdc-button-line-height-size-28);
143
171
  padding: 0 0.75rem;
144
172
  gap: 0.375rem;
145
173
  }
146
- :host([size="24"]){
174
+ :host([size='24']) {
147
175
  font-size: var(--mds-font-size-body-small);
148
176
  line-height: var(--mdc-button-line-height-size-24);
149
177
  padding: 0 0.625rem;
150
178
  gap: 0.25rem;
151
179
  }
152
- :host([size="20"]){
180
+ :host([size='20']) {
153
181
  padding: 0.0625rem;
154
182
  aspect-ratio: 1;
155
183
  }
156
184
 
157
- :host([color="accent"]){
185
+ :host([color='accent']) {
158
186
  --mdc-button-primary-color: var(--mds-color-theme-common-text-primary-normal);
159
187
  --mdc-button-primary-background-color: var(--mds-color-theme-button-accent-normal);
160
188
  --mdc-button-primary-hover-background-color: var(--mds-color-theme-button-accent-hover);
@@ -165,7 +193,7 @@ const styles = css `
165
193
  --mdc-button-secondary-hover-background-color: var(--mds-color-theme-button-secondary-hover);
166
194
  --mdc-button-secondary-pressed-background-color: var(--mds-color-theme-button-secondary-pressed);
167
195
  }
168
- :host([color="positive"]){
196
+ :host([color='positive']) {
169
197
  --mdc-button-primary-color: var(--mds-color-theme-common-text-primary-normal);
170
198
  --mdc-button-primary-background-color: var(--mds-color-theme-button-join-normal);
171
199
  --mdc-button-primary-hover-background-color: var(--mds-color-theme-button-join-hover);
@@ -176,7 +204,7 @@ const styles = css `
176
204
  --mdc-button-secondary-hover-background-color: var(--mds-color-theme-button-secondary-hover);
177
205
  --mdc-button-secondary-pressed-background-color: var(--mds-color-theme-button-secondary-pressed);
178
206
  }
179
- :host([color="negative"]){
207
+ :host([color='negative']) {
180
208
  --mdc-button-primary-color: var(--mds-color-theme-common-text-primary-normal);
181
209
  --mdc-button-primary-background-color: var(--mds-color-theme-button-cancel-normal);
182
210
  --mdc-button-primary-hover-background-color: var(--mds-color-theme-button-cancel-hover);
@@ -187,7 +215,7 @@ const styles = css `
187
215
  --mdc-button-secondary-hover-background-color: var(--mds-color-theme-button-secondary-hover);
188
216
  --mdc-button-secondary-pressed-background-color: var(--mds-color-theme-button-secondary-pressed);
189
217
  }
190
- :host([color="promotional"]){
218
+ :host([color='promotional']) {
191
219
  --mdc-button-primary-color: var(--mds-color-theme-common-text-primary-normal);
192
220
  --mdc-button-primary-background-color: var(--mds-color-theme-common-button-promotion-normal);
193
221
  --mdc-button-primary-hover-background-color: var(--mds-color-theme-common-button-promotion-hover);
@@ -1,8 +1,9 @@
1
+ import type { IconNames } from '../icon/icon.types';
1
2
  /**
2
3
  * Returns the name of the icon without the style suffix.
3
4
  *
4
5
  * @param iconName - The name of the icon.
5
6
  * @returns The name of the icon without the suffix.
6
7
  */
7
- declare const getIconNameWithoutStyle: (iconName: string) => string;
8
+ declare const getIconNameWithoutStyle: (iconName: IconNames) => string;
8
9
  export { getIconNameWithoutStyle };
@@ -20,9 +20,11 @@ declare class Buttonsimple extends Buttonsimple_base {
20
20
  * The button's active state indicates whether it is currently toggled on (active) or off (inactive).
21
21
  * When the active state is true, the button is considered to be in an active state, meaning it is toggled on.
22
22
  * Conversely, when the active state is false, the button is in an inactive state, indicating it is toggled off.
23
- * @default false
23
+ *
24
+ * This attribute is used to set the provided `ariaStateKey` to true or false.
25
+ * @default undefined
24
26
  */
25
- active: boolean;
27
+ active?: boolean;
26
28
  /**
27
29
  * Indicates whether the button is soft disabled.
28
30
  * When set to `true`, the button appears visually disabled but still allows
@@ -31,9 +33,9 @@ declare class Buttonsimple extends Buttonsimple_base {
31
33
  * **Important:** When using soft disabled, consumers must ensure that
32
34
  * the button behaves like a disabled button, allowing only focus and
33
35
  * preventing any interactions (clicks or keyboard actions) from triggering unintended actions.
34
- * @default false
36
+ * @default undefined
35
37
  */
36
- softDisabled: boolean;
38
+ softDisabled?: boolean;
37
39
  /**
38
40
  * Simplebutton size is a super set of all the sizes supported by children components.
39
41
  * @default 32
@@ -47,6 +49,19 @@ declare class Buttonsimple extends Buttonsimple_base {
47
49
  * @default button
48
50
  */
49
51
  role: string;
52
+ /**
53
+ * This property defines the ARIA state key, which will be toggled when the
54
+ * Button is set to `active`.
55
+ * The default value is 'aria-pressed', which is commonly used for toggle buttons.
56
+ *
57
+ * Consumers can override this property to use a different ARIA state key if needed.
58
+ * In case multiple aria attributes should be toggled, they can be passed in as
59
+ * a comma separated string.
60
+ * For example: `aria-pressed,aria-expanded`
61
+ *
62
+ * @default 'aria-pressed'
63
+ */
64
+ ariaStateKey: string;
50
65
  /**
51
66
  * This property defines the type attribute for the button element.
52
67
  * The type attribute specifies the behavior of the button when it is clicked.
@@ -70,11 +85,11 @@ declare class Buttonsimple extends Buttonsimple_base {
70
85
  update(changedProperties: PropertyValues): void;
71
86
  protected executeAction(): void;
72
87
  /**
73
- * Sets the aria-pressed attribute based on the active state of the button.
88
+ * Sets the ariaStateKey attributes based on the active state of the button.
74
89
  * @param element - The button element
75
90
  * @param active - The active state of the element
76
91
  */
77
- protected setActive(element: HTMLElement, active: boolean): void;
92
+ protected setActive(element: HTMLElement, active?: boolean): void;
78
93
  /**
79
94
  * Sets the soft-disabled attribute for the button.
80
95
  * When soft-disabled, the button looks to be disabled but remains focusable and clickable.
@@ -33,24 +33,6 @@ class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
33
33
  }
34
34
  constructor() {
35
35
  super();
36
- /**
37
- * The button's active state indicates whether it is currently toggled on (active) or off (inactive).
38
- * When the active state is true, the button is considered to be in an active state, meaning it is toggled on.
39
- * Conversely, when the active state is false, the button is in an inactive state, indicating it is toggled off.
40
- * @default false
41
- */
42
- this.active = false;
43
- /**
44
- * Indicates whether the button is soft disabled.
45
- * When set to `true`, the button appears visually disabled but still allows
46
- * focus, click, and keyboard actions to be passed through.
47
- *
48
- * **Important:** When using soft disabled, consumers must ensure that
49
- * the button behaves like a disabled button, allowing only focus and
50
- * preventing any interactions (clicks or keyboard actions) from triggering unintended actions.
51
- * @default false
52
- */
53
- this.softDisabled = false;
54
36
  /**
55
37
  * Simplebutton size is a super set of all the sizes supported by children components.
56
38
  * @default 32
@@ -64,6 +46,19 @@ class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
64
46
  * @default button
65
47
  */
66
48
  this.role = DEFAULTS.ROLE;
49
+ /**
50
+ * This property defines the ARIA state key, which will be toggled when the
51
+ * Button is set to `active`.
52
+ * The default value is 'aria-pressed', which is commonly used for toggle buttons.
53
+ *
54
+ * Consumers can override this property to use a different ARIA state key if needed.
55
+ * In case multiple aria attributes should be toggled, they can be passed in as
56
+ * a comma separated string.
57
+ * For example: `aria-pressed,aria-expanded`
58
+ *
59
+ * @default 'aria-pressed'
60
+ */
61
+ this.ariaStateKey = DEFAULTS.ARIA_STATE_KEY;
67
62
  /**
68
63
  * This property defines the type attribute for the button element.
69
64
  * The type attribute specifies the behavior of the button when it is clicked.
@@ -105,16 +100,27 @@ class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
105
100
  }
106
101
  }
107
102
  /**
108
- * Sets the aria-pressed attribute based on the active state of the button.
103
+ * Sets the ariaStateKey attributes based on the active state of the button.
109
104
  * @param element - The button element
110
105
  * @param active - The active state of the element
111
106
  */
112
107
  setActive(element, active) {
113
- if (active) {
114
- element.setAttribute('aria-pressed', 'true');
115
- }
116
- else {
117
- element.removeAttribute('aria-pressed');
108
+ if (this.ariaStateKey) {
109
+ const ariaStateKeys = this.ariaStateKey.split(',');
110
+ ariaStateKeys
111
+ .filter((key) => key.trim().startsWith('aria-'))
112
+ .forEach((key) => {
113
+ if (active === true) {
114
+ element.setAttribute(key.trim(), 'true');
115
+ }
116
+ else if (active === false) {
117
+ element.setAttribute(key.trim(), 'false');
118
+ }
119
+ else {
120
+ // If the active state is not a boolean, remove the attribute
121
+ element.removeAttribute(key.trim());
122
+ }
123
+ });
118
124
  }
119
125
  }
120
126
  /**
@@ -207,9 +213,7 @@ class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
207
213
  }
208
214
  }
209
215
  render() {
210
- return html `
211
- <slot></slot>
212
- `;
216
+ return html ` <slot></slot> `;
213
217
  }
214
218
  }
215
219
  /** @internal */
@@ -217,11 +221,11 @@ Buttonsimple.formAssociated = true;
217
221
  Buttonsimple.styles = [...Component.styles, ...styles];
218
222
  __decorate([
219
223
  property({ type: Boolean, reflect: true }),
220
- __metadata("design:type", Object)
224
+ __metadata("design:type", Boolean)
221
225
  ], Buttonsimple.prototype, "active", void 0);
222
226
  __decorate([
223
227
  property({ type: Boolean, attribute: 'soft-disabled' }),
224
- __metadata("design:type", Object)
228
+ __metadata("design:type", Boolean)
225
229
  ], Buttonsimple.prototype, "softDisabled", void 0);
226
230
  __decorate([
227
231
  property({ type: Number, reflect: true }),
@@ -231,6 +235,10 @@ __decorate([
231
235
  property({ type: String, reflect: true }),
232
236
  __metadata("design:type", Object)
233
237
  ], Buttonsimple.prototype, "role", void 0);
238
+ __decorate([
239
+ property({ type: String, reflect: true }),
240
+ __metadata("design:type", Object)
241
+ ], Buttonsimple.prototype, "ariaStateKey", void 0);
234
242
  __decorate([
235
243
  property({ reflect: true }),
236
244
  __metadata("design:type", String)
@@ -21,5 +21,6 @@ declare const DEFAULTS: {
21
21
  SIZE: 32;
22
22
  TYPE: "button";
23
23
  ROLE: string;
24
+ ARIA_STATE_KEY: string;
24
25
  };
25
26
  export { TAG_NAME, DEFAULTS, BUTTON_TYPE, BUTTON_SIZES, };
@@ -22,5 +22,6 @@ const DEFAULTS = {
22
22
  SIZE: BUTTON_SIZES[32],
23
23
  TYPE: BUTTON_TYPE.BUTTON,
24
24
  ROLE: 'button',
25
+ ARIA_STATE_KEY: 'aria-pressed',
25
26
  };
26
27
  export { TAG_NAME, DEFAULTS, BUTTON_TYPE, BUTTON_SIZES, };
@@ -4,6 +4,7 @@ const styles = [hostFitContentStyles, css `
4
4
  :host {
5
5
  border: 0.0625rem solid transparent;
6
6
  cursor: pointer;
7
+ user-select: none;
7
8
 
8
9
  background-color: var(--mds-color-theme-text-primary-normal);
9
10
  color: var(--mds-color-theme-inverted-text-secondary-normal);
@@ -100,6 +100,18 @@ declare const Tab_base: import("../../utils/mixins/index.types").Constructor<imp
100
100
  * @cssproperty --mdc-tab-pill-inactive-color-disabled - Text and icon color for inactive pill tab in disabled state.
101
101
  */
102
102
  declare class Tab extends Tab_base {
103
+ /**
104
+ * The tab's active state indicates whether it is currently toggled on (active) or off (inactive).
105
+ * When the active state is true, the tab is considered to be in an active state, meaning it is toggled on.
106
+ * Conversely, when the active state is false, the tab is in an inactive state, indicating it is toggled off.
107
+ *
108
+ * This attribute also controls the "aria-selected" attribute of the tab.
109
+ * When the tab is active, "aria-selected" is set to true, indicating that the tab is selected.
110
+ * When the tab is inactive, "aria-selected" is set to false, indicating that the tab is not selected.
111
+ *
112
+ * @default false
113
+ */
114
+ active?: boolean;
103
115
  /**
104
116
  * Text to be displayed in the tab.
105
117
  * If no `text` is provided, no text will be rendered,
@@ -115,6 +115,18 @@ import { IconNameMixin } from '../../utils/mixins/IconNameMixin';
115
115
  class Tab extends IconNameMixin(Buttonsimple) {
116
116
  constructor() {
117
117
  super(...arguments);
118
+ /**
119
+ * The tab's active state indicates whether it is currently toggled on (active) or off (inactive).
120
+ * When the active state is true, the tab is considered to be in an active state, meaning it is toggled on.
121
+ * Conversely, when the active state is false, the tab is in an inactive state, indicating it is toggled off.
122
+ *
123
+ * This attribute also controls the "aria-selected" attribute of the tab.
124
+ * When the tab is active, "aria-selected" is set to true, indicating that the tab is selected.
125
+ * When the tab is inactive, "aria-selected" is set to false, indicating that the tab is not selected.
126
+ *
127
+ * @default false
128
+ */
129
+ this.active = DEFAULTS.ACTIVE;
118
130
  /**
119
131
  * Tab can have three variants:
120
132
  * - `glass`
@@ -144,6 +156,7 @@ class Tab extends IconNameMixin(Buttonsimple) {
144
156
  this.softDisabled = undefined;
145
157
  this.size = undefined;
146
158
  this.type = undefined;
159
+ this.ariaStateKey = 'aria-selected';
147
160
  if (!this.tabId && this.onerror) {
148
161
  this.onerror('tab id is required');
149
162
  }
@@ -186,7 +199,7 @@ class Tab extends IconNameMixin(Buttonsimple) {
186
199
  * @param active - The active state of the tab.
187
200
  */
188
201
  setActive(element, active) {
189
- element.setAttribute('aria-selected', active ? 'true' : 'false');
202
+ super.setActive(element, active);
190
203
  this.modifyIconName(active);
191
204
  }
192
205
  executeAction() {
@@ -222,6 +235,10 @@ class Tab extends IconNameMixin(Buttonsimple) {
222
235
  }
223
236
  }
224
237
  Tab.styles = [...Buttonsimple.styles, ...styles];
238
+ __decorate([
239
+ property({ type: Boolean, reflect: true }),
240
+ __metadata("design:type", Boolean)
241
+ ], Tab.prototype, "active", void 0);
225
242
  __decorate([
226
243
  property({ type: String, reflect: true }),
227
244
  __metadata("design:type", String)
@@ -6,5 +6,6 @@ declare const TAB_VARIANTS: {
6
6
  };
7
7
  declare const DEFAULTS: {
8
8
  readonly VARIANT: "pill";
9
+ readonly ACTIVE: false;
9
10
  };
10
11
  export { DEFAULTS, TAG_NAME, TAB_VARIANTS };
@@ -7,5 +7,6 @@ const TAB_VARIANTS = {
7
7
  };
8
8
  const DEFAULTS = {
9
9
  VARIANT: TAB_VARIANTS.PILL,
10
+ ACTIVE: false,
10
11
  };
11
12
  export { DEFAULTS, TAG_NAME, TAB_VARIANTS };
@@ -94,7 +94,7 @@ const styles = [hostFitContentStyles, css `
94
94
  flex-direction: column;
95
95
  }
96
96
 
97
- :host::part(text)::after{
97
+ :host mdc-text::after {
98
98
  content: attr(data-text);
99
99
  height: 0;
100
100
  visibility: hidden;