@momentum-design/components 0.23.2 → 0.24.0
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.
- package/dist/browser/index.js +51 -51
- package/dist/browser/index.js.map +3 -3
- package/dist/components/tab/tab.component.d.ts +12 -3
- package/dist/components/tab/tab.component.js +19 -3
- package/dist/components/tab/tab.constants.d.ts +1 -1
- package/dist/components/tab/tab.constants.js +1 -1
- package/dist/custom-elements.json +591 -571
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
import { CSSResult } from 'lit';
|
2
|
-
import { Variant } from './tab.types';
|
1
|
+
import { CSSResult, PropertyValues } from 'lit';
|
2
|
+
import type { Variant } from './tab.types';
|
3
3
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
4
4
|
declare const Tab_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/IconNameMixin").IconNameMixinInterface> & typeof Buttonsimple;
|
5
5
|
/**
|
@@ -89,7 +89,7 @@ declare class Tab extends Tab_base {
|
|
89
89
|
*/
|
90
90
|
text?: string;
|
91
91
|
/**
|
92
|
-
* Tab can have
|
92
|
+
* Tab can have three variants:
|
93
93
|
* - `glass`
|
94
94
|
* - `line`
|
95
95
|
* - `pill`
|
@@ -112,6 +112,14 @@ declare class Tab extends Tab_base {
|
|
112
112
|
* @param active - The active state.
|
113
113
|
*/
|
114
114
|
private modifyIconName;
|
115
|
+
/**
|
116
|
+
* Sets the variant attribute for the tab component.
|
117
|
+
* If the provided variant is not included in the TAB_VARIANTS,
|
118
|
+
* it defaults to the value specified in DEFAULTS.VARIANT.
|
119
|
+
*
|
120
|
+
* @param variant - The variant to set.
|
121
|
+
*/
|
122
|
+
private setVariant;
|
115
123
|
/**
|
116
124
|
* Sets the aria-selected attribute based on the active state of the Tab.
|
117
125
|
* If the tab is active, the filled version of the icon is displayed,
|
@@ -122,6 +130,7 @@ declare class Tab extends Tab_base {
|
|
122
130
|
*/
|
123
131
|
protected setActive(element: HTMLElement, active: boolean): void;
|
124
132
|
protected executeAction(): void;
|
133
|
+
update(changedProperties: PropertyValues): void;
|
125
134
|
render(): import("lit-html").TemplateResult<1>;
|
126
135
|
static styles: Array<CSSResult>;
|
127
136
|
}
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import styles from './tab.styles';
|
13
|
-
import { DEFAULTS } from './tab.constants';
|
13
|
+
import { DEFAULTS, TAB_VARIANTS } from './tab.constants';
|
14
14
|
import { getIconNameWithoutStyle } from '../button/button.utils';
|
15
15
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
16
16
|
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
@@ -98,7 +98,7 @@ class Tab extends IconNameMixin(Buttonsimple) {
|
|
98
98
|
constructor() {
|
99
99
|
super();
|
100
100
|
/**
|
101
|
-
* Tab can have
|
101
|
+
* Tab can have three variants:
|
102
102
|
* - `glass`
|
103
103
|
* - `line`
|
104
104
|
* - `pill`
|
@@ -106,7 +106,7 @@ class Tab extends IconNameMixin(Buttonsimple) {
|
|
106
106
|
* It defines the background and foreground color of the tab.
|
107
107
|
* @default pill
|
108
108
|
*/
|
109
|
-
this.variant = DEFAULTS.
|
109
|
+
this.variant = DEFAULTS.VARIANT;
|
110
110
|
this.role = 'tab';
|
111
111
|
this.softDisabled = undefined;
|
112
112
|
this.size = undefined;
|
@@ -131,6 +131,16 @@ class Tab extends IconNameMixin(Buttonsimple) {
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
}
|
134
|
+
/**
|
135
|
+
* Sets the variant attribute for the tab component.
|
136
|
+
* If the provided variant is not included in the TAB_VARIANTS,
|
137
|
+
* it defaults to the value specified in DEFAULTS.VARIANT.
|
138
|
+
*
|
139
|
+
* @param variant - The variant to set.
|
140
|
+
*/
|
141
|
+
setVariant(variant) {
|
142
|
+
this.setAttribute('variant', Object.values(TAB_VARIANTS).includes(variant) ? variant : DEFAULTS.VARIANT);
|
143
|
+
}
|
134
144
|
/**
|
135
145
|
* Sets the aria-selected attribute based on the active state of the Tab.
|
136
146
|
* If the tab is active, the filled version of the icon is displayed,
|
@@ -147,6 +157,12 @@ class Tab extends IconNameMixin(Buttonsimple) {
|
|
147
157
|
// Toggle the active state of the tab.
|
148
158
|
this.active = !this.active;
|
149
159
|
}
|
160
|
+
update(changedProperties) {
|
161
|
+
super.update(changedProperties);
|
162
|
+
if (changedProperties.has('variant')) {
|
163
|
+
this.setVariant(this.variant);
|
164
|
+
}
|
165
|
+
}
|
150
166
|
render() {
|
151
167
|
return html `
|
152
168
|
<div part="container">
|