@momentum-design/components 0.60.0 → 0.61.1
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 +55 -46
- package/dist/browser/index.js.map +2 -2
- package/dist/components/button/button.component.d.ts +8 -0
- package/dist/components/button/button.component.js +12 -0
- package/dist/components/button/button.constants.d.ts +1 -0
- package/dist/components/button/button.constants.js +1 -0
- package/dist/components/button/button.styles.js +9 -0
- package/dist/components/buttonsimple/buttonsimple.component.js +6 -4
- package/dist/custom-elements.json +1018 -991
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +4 -4
- package/package.json +1 -1
@@ -44,6 +44,14 @@ declare class Button extends Button_base {
|
|
44
44
|
* @default 32
|
45
45
|
*/
|
46
46
|
size: PillButtonSize | IconButtonSize;
|
47
|
+
/**
|
48
|
+
* The button color can be inverted by setting the inverted attribute to true.
|
49
|
+
*
|
50
|
+
* Only applies when variant is set to `primary`, color is set to `default`
|
51
|
+
* and button is not `active`.
|
52
|
+
* @default false
|
53
|
+
*/
|
54
|
+
inverted: boolean;
|
47
55
|
/**
|
48
56
|
* This property defines the ARIA role for the element. By default, it is set to 'button'.
|
49
57
|
* Consumers should override this role when:
|
@@ -57,6 +57,14 @@ class Button extends ButtonComponentMixin(Buttonsimple) {
|
|
57
57
|
* @default 32
|
58
58
|
*/
|
59
59
|
this.size = DEFAULTS.SIZE;
|
60
|
+
/**
|
61
|
+
* The button color can be inverted by setting the inverted attribute to true.
|
62
|
+
*
|
63
|
+
* Only applies when variant is set to `primary`, color is set to `default`
|
64
|
+
* and button is not `active`.
|
65
|
+
* @default false
|
66
|
+
*/
|
67
|
+
this.inverted = DEFAULTS.INVERTED;
|
60
68
|
/**
|
61
69
|
* This property defines the ARIA role for the element. By default, it is set to 'button'.
|
62
70
|
* Consumers should override this role when:
|
@@ -128,6 +136,10 @@ __decorate([
|
|
128
136
|
property({ type: Number }),
|
129
137
|
__metadata("design:type", Number)
|
130
138
|
], Button.prototype, "size", void 0);
|
139
|
+
__decorate([
|
140
|
+
property({ type: Boolean, reflect: true }),
|
141
|
+
__metadata("design:type", Boolean)
|
142
|
+
], Button.prototype, "inverted", void 0);
|
131
143
|
__decorate([
|
132
144
|
property({ type: String, reflect: true }),
|
133
145
|
__metadata("design:type", Object)
|
@@ -36,5 +36,6 @@ const DEFAULTS = {
|
|
36
36
|
COLOR: BUTTON_COLORS.DEFAULT,
|
37
37
|
TYPE_INTERNAL: BUTTON_TYPE_INTERNAL.ICON,
|
38
38
|
TYPE: BUTTON_TYPE.BUTTON,
|
39
|
+
INVERTED: false,
|
39
40
|
};
|
40
41
|
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
@@ -226,5 +226,14 @@ const styles = css `
|
|
226
226
|
--mdc-button-secondary-hover-background-color: var(--mds-color-theme-button-secondary-hover);
|
227
227
|
--mdc-button-secondary-pressed-background-color: var(--mds-color-theme-button-secondary-pressed);
|
228
228
|
}
|
229
|
+
|
230
|
+
:host([inverted][variant='primary'][color='default']) {
|
231
|
+
--mdc-button-primary-color: var(--mds-color-theme-text-primary-normal);
|
232
|
+
--mdc-button-primary-background-color: var(--mds-color-theme-inverted-button-primary-normal);
|
233
|
+
--mdc-button-primary-hover-background-color: var(--mds-color-theme-inverted-button-primary-hover);
|
234
|
+
--mdc-button-primary-pressed-background-color: var(--mds-color-theme-inverted-button-primary-pressed);
|
235
|
+
--mdc-button-primary-disabled-background-color: var(--mds-color-theme-inverted-button-primary-disabled);
|
236
|
+
--mdc-button-primary-disabled-color: var(--mds-color-theme-inverted-text-primary-disabled);
|
237
|
+
}
|
229
238
|
`;
|
230
239
|
export default [styles];
|
@@ -185,9 +185,11 @@ class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
|
|
185
185
|
if (event.key === 'Enter') {
|
186
186
|
this.triggerClickEvent();
|
187
187
|
}
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
// preventing the default event behavior for space key
|
189
|
+
// to avoid scrolling etc in the host application
|
190
|
+
// preventing the default event behavior for enter key
|
191
|
+
// to avoid the keyup event to be triggered
|
192
|
+
event.preventDefault();
|
191
193
|
}
|
192
194
|
}
|
193
195
|
/**
|
@@ -217,7 +219,7 @@ __decorate([
|
|
217
219
|
__metadata("design:type", Boolean)
|
218
220
|
], Buttonsimple.prototype, "active", void 0);
|
219
221
|
__decorate([
|
220
|
-
property({ type: Boolean, attribute: 'soft-disabled' }),
|
222
|
+
property({ type: Boolean, attribute: 'soft-disabled', reflect: true }),
|
221
223
|
__metadata("design:type", Boolean)
|
222
224
|
], Buttonsimple.prototype, "softDisabled", void 0);
|
223
225
|
__decorate([
|