@momentum-design/components 0.139.2 → 0.139.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.
- package/dist/browser/index.js +249 -229
- package/dist/browser/index.js.map +3 -3
- package/dist/components/button/button.component.d.ts +1 -0
- package/dist/components/button/button.constants.d.ts +17 -1
- package/dist/components/button/button.constants.js +11 -1
- package/dist/components/button/button.styles.js +20 -0
- package/dist/components/tablist/tablist.component.d.ts +1 -0
- package/dist/components/tablist/tablist.component.js +10 -2
- package/dist/custom-elements.json +19 -13
- package/dist/react/button/index.d.ts +1 -0
- package/dist/utils/mixins/ButtonComponentMixin.js +6 -2
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ declare const Button_base: import("../../utils/mixins/index.types").Constructor<
|
|
|
12
12
|
* - Use `mdc-button` to trigger an action — submitting a form, opening a dialog, or running a command.
|
|
13
13
|
* - Use `mdc-button` `primary` for the single most important action in a view. Keep at most one primary button per context; when a dialog offers "Save" and "Cancel", only "Save" is primary.
|
|
14
14
|
* - Use `mdc-button` `secondary` for actions that are available but not the expected next step. More than one secondary button can appear together.
|
|
15
|
+
* - Use `mdc-button` with `variant="secondary"` and `color="overlay"` for actions placed directly over images, video, or other non-uniform backgrounds. Its dedicated background and border maintain visual separation and contrast against the underlying content.
|
|
15
16
|
* - Use `mdc-button` `tertiary` for low-emphasis actions that should not compete for attention; unlike secondary, it has no resting outline, so its footprint appears only on hover or interaction.
|
|
16
17
|
* - Use an icon-only `mdc-button` for compact targets such as toolbars or table-row controls where space is constrained and the icon's meaning is unambiguous.
|
|
17
18
|
* - Use `mdc-button` with `inverted` on a dark or inverted surface so the color scheme keeps the required contrast.
|
|
@@ -25,6 +25,7 @@ declare const BUTTON_COLORS: {
|
|
|
25
25
|
readonly NEGATIVE: "negative";
|
|
26
26
|
readonly ACCENT: "accent";
|
|
27
27
|
readonly PROMOTIONAL: "promotional";
|
|
28
|
+
readonly OVERLAY: "overlay";
|
|
28
29
|
readonly DEFAULT: "default";
|
|
29
30
|
};
|
|
30
31
|
declare const BUTTON_TYPE_INTERNAL: {
|
|
@@ -32,11 +33,26 @@ declare const BUTTON_TYPE_INTERNAL: {
|
|
|
32
33
|
readonly ICON: "icon";
|
|
33
34
|
readonly PILL_WITH_ICON: "pill-with-icon";
|
|
34
35
|
};
|
|
36
|
+
declare const PRIMARY_BUTTON_COLORS: {
|
|
37
|
+
readonly POSITIVE: "positive";
|
|
38
|
+
readonly NEGATIVE: "negative";
|
|
39
|
+
readonly ACCENT: "accent";
|
|
40
|
+
readonly PROMOTIONAL: "promotional";
|
|
41
|
+
readonly DEFAULT: "default";
|
|
42
|
+
};
|
|
35
43
|
declare const TERTIARY_BUTTON_COLORS: {
|
|
36
44
|
readonly DEFAULT: "default";
|
|
37
45
|
readonly ACCENT: "accent";
|
|
38
46
|
readonly NEGATIVE: "negative";
|
|
39
47
|
};
|
|
48
|
+
declare const SECONDARY_BUTTON_COLORS: {
|
|
49
|
+
readonly POSITIVE: "positive";
|
|
50
|
+
readonly NEGATIVE: "negative";
|
|
51
|
+
readonly ACCENT: "accent";
|
|
52
|
+
readonly PROMOTIONAL: "promotional";
|
|
53
|
+
readonly OVERLAY: "overlay";
|
|
54
|
+
readonly DEFAULT: "default";
|
|
55
|
+
};
|
|
40
56
|
declare const DEFAULTS: {
|
|
41
57
|
readonly VARIANT: "primary";
|
|
42
58
|
readonly SIZE: 32;
|
|
@@ -45,4 +61,4 @@ declare const DEFAULTS: {
|
|
|
45
61
|
readonly TYPE: "button";
|
|
46
62
|
readonly INVERTED: false;
|
|
47
63
|
};
|
|
48
|
-
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, TERTIARY_BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
|
64
|
+
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, PRIMARY_BUTTON_COLORS, SECONDARY_BUTTON_COLORS, TERTIARY_BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
|
@@ -23,6 +23,7 @@ const BUTTON_COLORS = {
|
|
|
23
23
|
NEGATIVE: 'negative',
|
|
24
24
|
ACCENT: 'accent',
|
|
25
25
|
PROMOTIONAL: 'promotional',
|
|
26
|
+
OVERLAY: 'overlay',
|
|
26
27
|
DEFAULT: 'default',
|
|
27
28
|
};
|
|
28
29
|
const BUTTON_TYPE_INTERNAL = {
|
|
@@ -30,11 +31,20 @@ const BUTTON_TYPE_INTERNAL = {
|
|
|
30
31
|
ICON: 'icon',
|
|
31
32
|
PILL_WITH_ICON: 'pill-with-icon',
|
|
32
33
|
};
|
|
34
|
+
const PRIMARY_BUTTON_COLORS = {
|
|
35
|
+
POSITIVE: BUTTON_COLORS.POSITIVE,
|
|
36
|
+
NEGATIVE: BUTTON_COLORS.NEGATIVE,
|
|
37
|
+
ACCENT: BUTTON_COLORS.ACCENT,
|
|
38
|
+
PROMOTIONAL: BUTTON_COLORS.PROMOTIONAL,
|
|
39
|
+
DEFAULT: BUTTON_COLORS.DEFAULT,
|
|
40
|
+
};
|
|
33
41
|
const TERTIARY_BUTTON_COLORS = {
|
|
34
42
|
DEFAULT: BUTTON_COLORS.DEFAULT,
|
|
35
43
|
ACCENT: BUTTON_COLORS.ACCENT,
|
|
36
44
|
NEGATIVE: BUTTON_COLORS.NEGATIVE,
|
|
37
45
|
};
|
|
46
|
+
// secondary supports every color, so it's just an alias of the full BUTTON_COLORS set
|
|
47
|
+
const SECONDARY_BUTTON_COLORS = BUTTON_COLORS;
|
|
38
48
|
const DEFAULTS = {
|
|
39
49
|
VARIANT: BUTTON_VARIANTS.PRIMARY,
|
|
40
50
|
SIZE: PILL_BUTTON_SIZES[32],
|
|
@@ -43,4 +53,4 @@ const DEFAULTS = {
|
|
|
43
53
|
TYPE: BUTTON_TYPE.BUTTON,
|
|
44
54
|
INVERTED: false,
|
|
45
55
|
};
|
|
46
|
-
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, TERTIARY_BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
|
56
|
+
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, PRIMARY_BUTTON_COLORS, SECONDARY_BUTTON_COLORS, TERTIARY_BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
|
@@ -87,6 +87,19 @@ const styles = css `
|
|
|
87
87
|
--mdc-button-background: var(--mds-color-theme-button-secondary-pressed);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
:host([variant='secondary'][color='overlay']) {
|
|
91
|
+
--mdc-button-background: var(--mds-color-theme-overlay-button-secondary-normal);
|
|
92
|
+
--mdc-button-text-color: var(--mds-color-theme-text-primary-normal);
|
|
93
|
+
--mdc-button-border-color: var(--mds-color-theme-outline-button-normal);
|
|
94
|
+
}
|
|
95
|
+
:host([variant='secondary'][color='overlay']:hover) {
|
|
96
|
+
--mdc-button-background: var(--mds-color-theme-overlay-button-secondary-hover);
|
|
97
|
+
}
|
|
98
|
+
:host([variant='secondary'][color='overlay']:active),
|
|
99
|
+
:host([variant='secondary'][color='overlay'].pressed) {
|
|
100
|
+
--mdc-button-background: var(--mds-color-theme-overlay-button-secondary-pressed);
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
:host([variant='tertiary']) {
|
|
91
104
|
--mdc-button-border-color: transparent;
|
|
92
105
|
--mdc-button-text-color: var(--mds-color-theme-text-primary-normal);
|
|
@@ -287,6 +300,13 @@ const styles = css `
|
|
|
287
300
|
--mdc-button-background: var(--mds-color-theme-button-secondary-disabled);
|
|
288
301
|
cursor: auto;
|
|
289
302
|
}
|
|
303
|
+
:host([variant='secondary'][color='overlay'][disabled]),
|
|
304
|
+
:host([variant='secondary'][color='overlay'][soft-disabled]) {
|
|
305
|
+
--mdc-button-text-color: var(--mds-color-theme-text-primary-disabled);
|
|
306
|
+
--mdc-button-border-color: var(--mds-color-theme-outline-primary-disabled);
|
|
307
|
+
--mdc-button-background: var(--mds-color-theme-overlay-button-secondary-normal);
|
|
308
|
+
cursor: auto;
|
|
309
|
+
}
|
|
290
310
|
:host([variant='tertiary'][disabled]),
|
|
291
311
|
:host([variant='tertiary'][soft-disabled]) {
|
|
292
312
|
--mdc-button-text-color: var(--mds-color-theme-text-primary-disabled);
|
|
@@ -126,6 +126,9 @@ class TabList extends ListNavigationMixin(CaptureDestroyEventForChildElement(Key
|
|
|
126
126
|
* @internal
|
|
127
127
|
*/
|
|
128
128
|
this.showBackwardArrowButton = false;
|
|
129
|
+
this.boundHandleFocus = (event) => {
|
|
130
|
+
void this.handleFocus(event);
|
|
131
|
+
};
|
|
129
132
|
// This must be initialized after the destroyed event listener
|
|
130
133
|
// to keep the element in the itemStore in order to move the focus correctly
|
|
131
134
|
this.itemsStore = new ElementStore(this, {
|
|
@@ -168,12 +171,12 @@ class TabList extends ListNavigationMixin(CaptureDestroyEventForChildElement(Key
|
|
|
168
171
|
if (!this.activeTabId) {
|
|
169
172
|
this.activeTabId = (_a = getFirstTab(this.navItems)) === null || _a === void 0 ? void 0 : _a.tabId;
|
|
170
173
|
}
|
|
171
|
-
(_b = this.tabsContainer) === null || _b === void 0 ? void 0 : _b.addEventListener('focusin', this.
|
|
174
|
+
(_b = this.tabsContainer) === null || _b === void 0 ? void 0 : _b.addEventListener('focusin', this.boundHandleFocus);
|
|
172
175
|
}
|
|
173
176
|
disconnectedCallback() {
|
|
174
177
|
var _a;
|
|
175
178
|
super.disconnectedCallback();
|
|
176
|
-
(_a = this.tabsContainer) === null || _a === void 0 ? void 0 : _a.removeEventListener('focusin', this.
|
|
179
|
+
(_a = this.tabsContainer) === null || _a === void 0 ? void 0 : _a.removeEventListener('focusin', this.boundHandleFocus);
|
|
177
180
|
}
|
|
178
181
|
/**
|
|
179
182
|
* Override focus to delegate to the active tab.
|
|
@@ -205,6 +208,11 @@ class TabList extends ListNavigationMixin(CaptureDestroyEventForChildElement(Key
|
|
|
205
208
|
if (event.relatedTarget instanceof Tab || !(event.target instanceof Tab)) {
|
|
206
209
|
return;
|
|
207
210
|
}
|
|
211
|
+
// After scrolling with arrow buttons, focus moves from the button to the clicked tab.
|
|
212
|
+
// Do not redirect that focus back to the currently active tab.
|
|
213
|
+
if (event.relatedTarget instanceof Button) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
208
216
|
const activeTab = getActiveTab(this.navItems || []);
|
|
209
217
|
if (!(activeTab instanceof Tab)) {
|
|
210
218
|
return;
|
|
@@ -173,8 +173,8 @@
|
|
|
173
173
|
"attribute": "disabled",
|
|
174
174
|
"reflects": true,
|
|
175
175
|
"inheritedFrom": {
|
|
176
|
-
"name": "
|
|
177
|
-
"module": "
|
|
176
|
+
"name": "AccordionButton",
|
|
177
|
+
"module": "components/accordionbutton/accordionbutton.component.js"
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
180
|
{
|
|
@@ -493,8 +493,8 @@
|
|
|
493
493
|
"default": "undefined",
|
|
494
494
|
"fieldName": "disabled",
|
|
495
495
|
"inheritedFrom": {
|
|
496
|
-
"name": "
|
|
497
|
-
"module": "src/
|
|
496
|
+
"name": "AccordionButton",
|
|
497
|
+
"module": "src/components/accordionbutton/accordionbutton.component.ts"
|
|
498
498
|
}
|
|
499
499
|
},
|
|
500
500
|
{
|
|
@@ -5037,7 +5037,7 @@
|
|
|
5037
5037
|
"type": {
|
|
5038
5038
|
"text": "ButtonColor"
|
|
5039
5039
|
},
|
|
5040
|
-
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.",
|
|
5040
|
+
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `overlay`: For secondary buttons placed over images, video, or other non-uniform backgrounds\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons.",
|
|
5041
5041
|
"default": "default",
|
|
5042
5042
|
"attribute": "color",
|
|
5043
5043
|
"inheritedFrom": {
|
|
@@ -5286,7 +5286,7 @@
|
|
|
5286
5286
|
"description": "The color to set."
|
|
5287
5287
|
}
|
|
5288
5288
|
],
|
|
5289
|
-
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or if the color is not supported for the current variant.\nTertiary buttons only support default, accent, and negative colors.",
|
|
5289
|
+
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or if the color is not supported for the current variant.\nTertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons.",
|
|
5290
5290
|
"inheritedFrom": {
|
|
5291
5291
|
"name": "ButtonComponentMixin",
|
|
5292
5292
|
"module": "utils/mixins/ButtonComponentMixin.js"
|
|
@@ -5559,7 +5559,7 @@
|
|
|
5559
5559
|
"type": {
|
|
5560
5560
|
"text": "ButtonColor"
|
|
5561
5561
|
},
|
|
5562
|
-
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.",
|
|
5562
|
+
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `overlay`: For secondary buttons placed over images, video, or other non-uniform backgrounds\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons.",
|
|
5563
5563
|
"default": "default",
|
|
5564
5564
|
"fieldName": "color",
|
|
5565
5565
|
"inheritedFrom": {
|
|
@@ -6042,7 +6042,7 @@
|
|
|
6042
6042
|
"type": {
|
|
6043
6043
|
"text": "ButtonColor"
|
|
6044
6044
|
},
|
|
6045
|
-
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.",
|
|
6045
|
+
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `overlay`: For secondary buttons placed over images, video, or other non-uniform backgrounds\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons.",
|
|
6046
6046
|
"default": "default",
|
|
6047
6047
|
"attribute": "color",
|
|
6048
6048
|
"inheritedFrom": {
|
|
@@ -6278,7 +6278,7 @@
|
|
|
6278
6278
|
"description": "The color to set."
|
|
6279
6279
|
}
|
|
6280
6280
|
],
|
|
6281
|
-
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or if the color is not supported for the current variant.\nTertiary buttons only support default, accent, and negative colors.",
|
|
6281
|
+
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or if the color is not supported for the current variant.\nTertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons.",
|
|
6282
6282
|
"inheritedFrom": {
|
|
6283
6283
|
"name": "ButtonComponentMixin",
|
|
6284
6284
|
"module": "utils/mixins/ButtonComponentMixin.js"
|
|
@@ -6542,7 +6542,7 @@
|
|
|
6542
6542
|
"type": {
|
|
6543
6543
|
"text": "ButtonColor"
|
|
6544
6544
|
},
|
|
6545
|
-
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.",
|
|
6545
|
+
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `overlay`: For secondary buttons placed over images, video, or other non-uniform backgrounds\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons.",
|
|
6546
6546
|
"default": "default",
|
|
6547
6547
|
"fieldName": "color",
|
|
6548
6548
|
"inheritedFrom": {
|
|
@@ -48481,6 +48481,12 @@
|
|
|
48481
48481
|
"module": "utils/mixins/TabListComponentMixin.js"
|
|
48482
48482
|
}
|
|
48483
48483
|
},
|
|
48484
|
+
{
|
|
48485
|
+
"kind": "field",
|
|
48486
|
+
"name": "boundHandleFocus",
|
|
48487
|
+
"privacy": "private",
|
|
48488
|
+
"readonly": true
|
|
48489
|
+
},
|
|
48484
48490
|
{
|
|
48485
48491
|
"kind": "field",
|
|
48486
48492
|
"name": "dataAriaLabel",
|
|
@@ -57461,7 +57467,7 @@
|
|
|
57461
57467
|
"type": {
|
|
57462
57468
|
"text": "ButtonColor"
|
|
57463
57469
|
},
|
|
57464
|
-
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.",
|
|
57470
|
+
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `overlay`: For secondary buttons placed over images, video, or other non-uniform backgrounds\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons.",
|
|
57465
57471
|
"default": "default",
|
|
57466
57472
|
"attribute": "color"
|
|
57467
57473
|
},
|
|
@@ -57510,7 +57516,7 @@
|
|
|
57510
57516
|
"description": "The color to set."
|
|
57511
57517
|
}
|
|
57512
57518
|
],
|
|
57513
|
-
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or if the color is not supported for the current variant.\nTertiary buttons only support default, accent, and negative colors."
|
|
57519
|
+
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or if the color is not supported for the current variant.\nTertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons."
|
|
57514
57520
|
},
|
|
57515
57521
|
{
|
|
57516
57522
|
"kind": "method",
|
|
@@ -57584,7 +57590,7 @@
|
|
|
57584
57590
|
"type": {
|
|
57585
57591
|
"text": "ButtonColor"
|
|
57586
57592
|
},
|
|
57587
|
-
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.",
|
|
57593
|
+
"description": "The semantic color of the button.\n- `positive`: For success or confirmation actions\n- `negative`: For destructive or error actions\n- `accent`: For informational actions\n- `promotional`: For promotional actions\n- `overlay`: For secondary buttons placed over images, video, or other non-uniform backgrounds\n- `default`: For standard actions\n\nNote: Tertiary buttons only support default, accent, and negative colors.\nOverlay color is only supported for secondary buttons.",
|
|
57588
57594
|
"default": "default",
|
|
57589
57595
|
"fieldName": "color"
|
|
57590
57596
|
}
|
|
@@ -9,6 +9,7 @@ import type { Events as EventsInherited } from '../../components/buttonsimple/bu
|
|
|
9
9
|
* - Use `mdc-button` to trigger an action — submitting a form, opening a dialog, or running a command.
|
|
10
10
|
* - Use `mdc-button` `primary` for the single most important action in a view. Keep at most one primary button per context; when a dialog offers "Save" and "Cancel", only "Save" is primary.
|
|
11
11
|
* - Use `mdc-button` `secondary` for actions that are available but not the expected next step. More than one secondary button can appear together.
|
|
12
|
+
* - Use `mdc-button` with `variant="secondary"` and `color="overlay"` for actions placed directly over images, video, or other non-uniform backgrounds. Its dedicated background and border maintain visual separation and contrast against the underlying content.
|
|
12
13
|
* - Use `mdc-button` `tertiary` for low-emphasis actions that should not compete for attention; unlike secondary, it has no resting outline, so its footprint appears only on hover or interaction.
|
|
13
14
|
* - Use an icon-only `mdc-button` for compact targets such as toolbars or table-row controls where space is constrained and the icon's meaning is unambiguous.
|
|
14
15
|
* - Use `mdc-button` with `inverted` on a dark or inverted surface so the color scheme keeps the required contrast.
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
/* eslint-disable max-classes-per-file */
|
|
11
11
|
import { property, state } from 'lit/decorators.js';
|
|
12
|
-
import { BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_VARIANTS, DEFAULTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, TERTIARY_BUTTON_COLORS, } from '../../components/button/button.constants';
|
|
12
|
+
import { BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_VARIANTS, DEFAULTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, PRIMARY_BUTTON_COLORS, TERTIARY_BUTTON_COLORS, } from '../../components/button/button.constants';
|
|
13
13
|
export const ButtonComponentMixin = (superClass) => {
|
|
14
14
|
class InnerMixinClass extends superClass {
|
|
15
15
|
constructor() {
|
|
@@ -28,9 +28,11 @@ export const ButtonComponentMixin = (superClass) => {
|
|
|
28
28
|
* - `negative`: For destructive or error actions
|
|
29
29
|
* - `accent`: For informational actions
|
|
30
30
|
* - `promotional`: For promotional actions
|
|
31
|
+
* - `overlay`: For secondary buttons placed over images, video, or other non-uniform backgrounds
|
|
31
32
|
* - `default`: For standard actions
|
|
32
33
|
*
|
|
33
34
|
* Note: Tertiary buttons only support default, accent, and negative colors.
|
|
35
|
+
* Overlay color is only supported for secondary buttons.
|
|
34
36
|
* @default default
|
|
35
37
|
*/
|
|
36
38
|
this.color = DEFAULTS.COLOR;
|
|
@@ -51,13 +53,15 @@ export const ButtonComponentMixin = (superClass) => {
|
|
|
51
53
|
* Sets the color attribute for the button.
|
|
52
54
|
* Defaults to DEFAULTS.COLOR if invalid or if the color is not supported for the current variant.
|
|
53
55
|
* Tertiary buttons only support default, accent, and negative colors.
|
|
56
|
+
* Overlay color is only supported for secondary buttons.
|
|
54
57
|
*
|
|
55
58
|
* @param color - The color to set.
|
|
56
59
|
*/
|
|
57
60
|
setColor(color) {
|
|
58
61
|
const isValidColor = Object.values(BUTTON_COLORS).includes(color);
|
|
62
|
+
const isPrimaryUnsupported = this.variant === BUTTON_VARIANTS.PRIMARY && !Object.values(PRIMARY_BUTTON_COLORS).includes(color);
|
|
59
63
|
const isTertiaryUnsupported = this.variant === BUTTON_VARIANTS.TERTIARY && !Object.values(TERTIARY_BUTTON_COLORS).includes(color);
|
|
60
|
-
if (!isValidColor || isTertiaryUnsupported) {
|
|
64
|
+
if (!isValidColor || isPrimaryUnsupported || isTertiaryUnsupported) {
|
|
61
65
|
this.setAttribute('color', `${DEFAULTS.COLOR}`);
|
|
62
66
|
}
|
|
63
67
|
else {
|