@momentum-design/components 0.134.1 → 0.134.2
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 +223 -201
- package/dist/browser/index.js.map +3 -3
- package/dist/components/button/button.component.d.ts +6 -0
- package/dist/components/button/button.component.js +7 -0
- package/dist/components/button/button.constants.d.ts +6 -1
- package/dist/components/button/button.constants.js +6 -1
- package/dist/components/button/button.styles.js +22 -0
- package/dist/components/buttonlink/buttonlink.component.js +1 -0
- package/dist/custom-elements.json +11 -11
- package/dist/react/button/index.d.ts +6 -0
- package/dist/react/button/index.js +6 -0
- package/dist/utils/mixins/ButtonComponentMixin.js +7 -4
- package/package.json +1 -1
|
@@ -37,6 +37,12 @@ declare const Button_base: import("../../utils/mixins/index.types").Constructor<
|
|
|
37
37
|
* - **Accent**: For informational actions
|
|
38
38
|
* - **Promotional**: For promotional actions
|
|
39
39
|
*
|
|
40
|
+
* Color options for **Tertiary** buttons:
|
|
41
|
+
*
|
|
42
|
+
* - **Default**: For standard actions
|
|
43
|
+
* - **Accent**: For informational actions
|
|
44
|
+
* - **Negative**: For destructive or error actions
|
|
45
|
+
*
|
|
40
46
|
* ### Button Sizes
|
|
41
47
|
*
|
|
42
48
|
* Size options for different button configurations in REM:
|
|
@@ -49,6 +49,12 @@ import { getIconNameWithoutStyle } from './button.utils';
|
|
|
49
49
|
* - **Accent**: For informational actions
|
|
50
50
|
* - **Promotional**: For promotional actions
|
|
51
51
|
*
|
|
52
|
+
* Color options for **Tertiary** buttons:
|
|
53
|
+
*
|
|
54
|
+
* - **Default**: For standard actions
|
|
55
|
+
* - **Accent**: For informational actions
|
|
56
|
+
* - **Negative**: For destructive or error actions
|
|
57
|
+
*
|
|
52
58
|
* ### Button Sizes
|
|
53
59
|
*
|
|
54
60
|
* Size options for different button configurations in REM:
|
|
@@ -143,6 +149,7 @@ class Button extends OverflowMixin(ButtonComponentMixin(Buttonsimple)) {
|
|
|
143
149
|
}
|
|
144
150
|
if (changedProperties.has('variant')) {
|
|
145
151
|
this.setVariant(this.variant);
|
|
152
|
+
this.setColor(this.color);
|
|
146
153
|
this.setSize(this.size);
|
|
147
154
|
}
|
|
148
155
|
if (changedProperties.has('color')) {
|
|
@@ -32,6 +32,11 @@ declare const BUTTON_TYPE_INTERNAL: {
|
|
|
32
32
|
readonly ICON: "icon";
|
|
33
33
|
readonly PILL_WITH_ICON: "pill-with-icon";
|
|
34
34
|
};
|
|
35
|
+
declare const TERTIARY_BUTTON_COLORS: {
|
|
36
|
+
readonly DEFAULT: "default";
|
|
37
|
+
readonly ACCENT: "accent";
|
|
38
|
+
readonly NEGATIVE: "negative";
|
|
39
|
+
};
|
|
35
40
|
declare const DEFAULTS: {
|
|
36
41
|
readonly VARIANT: "primary";
|
|
37
42
|
readonly SIZE: 32;
|
|
@@ -40,4 +45,4 @@ declare const DEFAULTS: {
|
|
|
40
45
|
readonly TYPE: "button";
|
|
41
46
|
readonly INVERTED: false;
|
|
42
47
|
};
|
|
43
|
-
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
|
48
|
+
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, TERTIARY_BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
|
@@ -30,6 +30,11 @@ const BUTTON_TYPE_INTERNAL = {
|
|
|
30
30
|
ICON: 'icon',
|
|
31
31
|
PILL_WITH_ICON: 'pill-with-icon',
|
|
32
32
|
};
|
|
33
|
+
const TERTIARY_BUTTON_COLORS = {
|
|
34
|
+
DEFAULT: BUTTON_COLORS.DEFAULT,
|
|
35
|
+
ACCENT: BUTTON_COLORS.ACCENT,
|
|
36
|
+
NEGATIVE: BUTTON_COLORS.NEGATIVE,
|
|
37
|
+
};
|
|
33
38
|
const DEFAULTS = {
|
|
34
39
|
VARIANT: BUTTON_VARIANTS.PRIMARY,
|
|
35
40
|
SIZE: PILL_BUTTON_SIZES[32],
|
|
@@ -38,4 +43,4 @@ const DEFAULTS = {
|
|
|
38
43
|
TYPE: BUTTON_TYPE.BUTTON,
|
|
39
44
|
INVERTED: false,
|
|
40
45
|
};
|
|
41
|
-
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
|
46
|
+
export { TAG_NAME, DEFAULTS, BUTTON_VARIANTS, PILL_BUTTON_SIZES, ICON_BUTTON_SIZES, BUTTON_COLORS, TERTIARY_BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_TYPE, };
|
|
@@ -99,6 +99,28 @@ const styles = css `
|
|
|
99
99
|
--mdc-button-background: var(--mds-color-theme-button-secondary-pressed);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
:host([color='accent'][variant='tertiary']) {
|
|
103
|
+
--mdc-button-text-color: var(--mds-color-theme-text-accent-normal);
|
|
104
|
+
}
|
|
105
|
+
:host([color='accent'][variant='tertiary']:hover:not([disabled]):not([soft-disabled])) {
|
|
106
|
+
--mdc-button-background: var(--mds-color-theme-button-secondary-hover);
|
|
107
|
+
}
|
|
108
|
+
:host([color='accent'][variant='tertiary']:active:not([disabled]):not([soft-disabled])),
|
|
109
|
+
:host([color='accent'][variant='tertiary'].pressed:not([disabled]):not([soft-disabled])) {
|
|
110
|
+
--mdc-button-background: var(--mds-color-theme-button-secondary-pressed);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:host([color='negative'][variant='tertiary']) {
|
|
114
|
+
--mdc-button-text-color: var(--mds-color-theme-text-error-normal);
|
|
115
|
+
}
|
|
116
|
+
:host([color='negative'][variant='tertiary']:hover:not([disabled]):not([soft-disabled])) {
|
|
117
|
+
--mdc-button-background: var(--mds-color-theme-button-secondary-hover);
|
|
118
|
+
}
|
|
119
|
+
:host([color='negative'][variant='tertiary']:active:not([disabled]):not([soft-disabled])),
|
|
120
|
+
:host([color='negative'][variant='tertiary'].pressed:not([disabled]):not([soft-disabled])) {
|
|
121
|
+
--mdc-button-background: var(--mds-color-theme-button-secondary-pressed);
|
|
122
|
+
}
|
|
123
|
+
|
|
102
124
|
:host([size='64'][data-btn-type='icon']),
|
|
103
125
|
:host([size='52'][data-btn-type='icon']),
|
|
104
126
|
:host([size='40'][data-btn-type='icon']),
|
|
@@ -4897,7 +4897,7 @@
|
|
|
4897
4897
|
"declarations": [
|
|
4898
4898
|
{
|
|
4899
4899
|
"kind": "class",
|
|
4900
|
-
"description": "`mdc-button` is a component that can be configured in various ways to suit different use cases.\n\n## Button configuration\n\nThe appearance of the button depends on combination of multiple attributes.\n\n### Button Types\n\nThe type of button is inferred based on the presence of slot and/or prefix and postfix icons/slots:\n\n- **Pill button**: Contains text value, commonly used for call to action, tags, or filters\n- **Pill button with icons**: Contains an icon on the left or right side of the button\n- **Icon button**: Represented by just an icon without any text\n\n### Button Variants:\n\nOptions for button backgrounds and borders:\n\n- **Primary**: Solid background color\n- **Secondary**: Transparent background with solid border\n- **Tertiary**: No background or border, text-only appearance\n\n### Button Colors\n\nColor options for **Primary** and **Secondary** buttons:\n\n- **Default**: For standard actions\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\n### Button Sizes\n\nSize options for different button configurations in REM:\n\n- **Pill button**: 40, 32, 28, 24\n- **Icon button**: 64, 52, 40, 32, 28, 24\n- **Tertiary icon button**: 20",
|
|
4900
|
+
"description": "`mdc-button` is a component that can be configured in various ways to suit different use cases.\n\n## Button configuration\n\nThe appearance of the button depends on combination of multiple attributes.\n\n### Button Types\n\nThe type of button is inferred based on the presence of slot and/or prefix and postfix icons/slots:\n\n- **Pill button**: Contains text value, commonly used for call to action, tags, or filters\n- **Pill button with icons**: Contains an icon on the left or right side of the button\n- **Icon button**: Represented by just an icon without any text\n\n### Button Variants:\n\nOptions for button backgrounds and borders:\n\n- **Primary**: Solid background color\n- **Secondary**: Transparent background with solid border\n- **Tertiary**: No background or border, text-only appearance\n\n### Button Colors\n\nColor options for **Primary** and **Secondary** buttons:\n\n- **Default**: For standard actions\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\nColor options for **Tertiary** buttons:\n\n- **Default**: For standard actions\n- **Accent**: For informational actions\n- **Negative**: For destructive or error actions\n\n### Button Sizes\n\nSize options for different button configurations in REM:\n\n- **Pill button**: 40, 32, 28, 24\n- **Icon button**: 64, 52, 40, 32, 28, 24\n- **Tertiary icon button**: 20",
|
|
4901
4901
|
"name": "Button",
|
|
4902
4902
|
"cssProperties": [
|
|
4903
4903
|
{
|
|
@@ -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
|
|
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.",
|
|
5041
5041
|
"default": "default",
|
|
5042
5042
|
"attribute": "color",
|
|
5043
5043
|
"inheritedFrom": {
|
|
@@ -5272,7 +5272,7 @@
|
|
|
5272
5272
|
"description": "The color to set."
|
|
5273
5273
|
}
|
|
5274
5274
|
],
|
|
5275
|
-
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or for
|
|
5275
|
+
"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.",
|
|
5276
5276
|
"inheritedFrom": {
|
|
5277
5277
|
"name": "ButtonComponentMixin",
|
|
5278
5278
|
"module": "utils/mixins/ButtonComponentMixin.js"
|
|
@@ -5545,7 +5545,7 @@
|
|
|
5545
5545
|
"type": {
|
|
5546
5546
|
"text": "ButtonColor"
|
|
5547
5547
|
},
|
|
5548
|
-
"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
|
|
5548
|
+
"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.",
|
|
5549
5549
|
"default": "default",
|
|
5550
5550
|
"fieldName": "color",
|
|
5551
5551
|
"inheritedFrom": {
|
|
@@ -5684,7 +5684,7 @@
|
|
|
5684
5684
|
"module": "/src/components/buttonsimple/buttonsimple.component"
|
|
5685
5685
|
},
|
|
5686
5686
|
"tagName": "mdc-button",
|
|
5687
|
-
"jsDoc": "/**\n * `mdc-button` is a component that can be configured in various ways to suit different use cases.\n *\n * ## Button configuration\n *\n * The appearance of the button depends on combination of multiple attributes.\n *\n * ### Button Types\n *\n * The type of button is inferred based on the presence of slot and/or prefix and postfix icons/slots:\n *\n * - **Pill button**: Contains text value, commonly used for call to action, tags, or filters\n * - **Pill button with icons**: Contains an icon on the left or right side of the button\n * - **Icon button**: Represented by just an icon without any text\n *\n * ### Button Variants:\n *\n * Options for button backgrounds and borders:\n *\n * - **Primary**: Solid background color\n * - **Secondary**: Transparent background with solid border\n * - **Tertiary**: No background or border, text-only appearance\n *\n * ### Button Colors\n *\n * Color options for **Primary** and **Secondary** buttons:\n *\n * - **Default**: For standard actions\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 *\n * ### Button Sizes\n *\n * Size options for different button configurations in REM:\n *\n * - **Pill button**: 40, 32, 28, 24\n * - **Icon button**: 64, 52, 40, 32, 28, 24\n * - **Tertiary icon button**: 20\n *\n * @dependency mdc-icon\n *\n * @tagname mdc-button\n *\n * @slot - Text label of the button.\n * @slot prefix - Content to be displayed before the text label.\n * @slot postfix - Content to be displayed after the text label.\n *\n * @csspart button-text - Text label of the button, passed in default slot\n * @csspart prefix - Content before the text label, passed in `prefix` slot\n * @csspart postfix - Content after the text label, passed in `postfix` slot\n * @csspart prefix-icon - Icon element displayed before the text label when `prefix-icon` attribute is set\n * @csspart postfix-icon - Icon element displayed after the text label when `postfix-icon` attribute is set\n *\n * @cssproperty --mdc-button-height - Height for button size\n * @cssproperty --mdc-button-background - Background of the button\n * @cssproperty --mdc-button-border-color - Border color of the button\n * @cssproperty --mdc-button-text-color - Text color of the button\n * @cssproperty --mdc-button-prefix-icon-size - Size of the prefix icon\n * @cssproperty --mdc-button-postfix-icon-size - Size of the postfix icon\n * @cssproperty --mdc-button-line-height - Line height of the button text\n *\n */",
|
|
5687
|
+
"jsDoc": "/**\n * `mdc-button` is a component that can be configured in various ways to suit different use cases.\n *\n * ## Button configuration\n *\n * The appearance of the button depends on combination of multiple attributes.\n *\n * ### Button Types\n *\n * The type of button is inferred based on the presence of slot and/or prefix and postfix icons/slots:\n *\n * - **Pill button**: Contains text value, commonly used for call to action, tags, or filters\n * - **Pill button with icons**: Contains an icon on the left or right side of the button\n * - **Icon button**: Represented by just an icon without any text\n *\n * ### Button Variants:\n *\n * Options for button backgrounds and borders:\n *\n * - **Primary**: Solid background color\n * - **Secondary**: Transparent background with solid border\n * - **Tertiary**: No background or border, text-only appearance\n *\n * ### Button Colors\n *\n * Color options for **Primary** and **Secondary** buttons:\n *\n * - **Default**: For standard actions\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 *\n * Color options for **Tertiary** buttons:\n *\n * - **Default**: For standard actions\n * - **Accent**: For informational actions\n * - **Negative**: For destructive or error actions\n *\n * ### Button Sizes\n *\n * Size options for different button configurations in REM:\n *\n * - **Pill button**: 40, 32, 28, 24\n * - **Icon button**: 64, 52, 40, 32, 28, 24\n * - **Tertiary icon button**: 20\n *\n * @dependency mdc-icon\n *\n * @tagname mdc-button\n *\n * @slot - Text label of the button.\n * @slot prefix - Content to be displayed before the text label.\n * @slot postfix - Content to be displayed after the text label.\n *\n * @csspart button-text - Text label of the button, passed in default slot\n * @csspart prefix - Content before the text label, passed in `prefix` slot\n * @csspart postfix - Content after the text label, passed in `postfix` slot\n * @csspart prefix-icon - Icon element displayed before the text label when `prefix-icon` attribute is set\n * @csspart postfix-icon - Icon element displayed after the text label when `postfix-icon` attribute is set\n *\n * @cssproperty --mdc-button-height - Height for button size\n * @cssproperty --mdc-button-background - Background of the button\n * @cssproperty --mdc-button-border-color - Border color of the button\n * @cssproperty --mdc-button-text-color - Text color of the button\n * @cssproperty --mdc-button-prefix-icon-size - Size of the prefix icon\n * @cssproperty --mdc-button-postfix-icon-size - Size of the postfix icon\n * @cssproperty --mdc-button-line-height - Line height of the button text\n *\n */",
|
|
5688
5688
|
"customElement": true,
|
|
5689
5689
|
"events": [
|
|
5690
5690
|
{
|
|
@@ -6028,7 +6028,7 @@
|
|
|
6028
6028
|
"type": {
|
|
6029
6029
|
"text": "ButtonColor"
|
|
6030
6030
|
},
|
|
6031
|
-
"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
|
|
6031
|
+
"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.",
|
|
6032
6032
|
"default": "default",
|
|
6033
6033
|
"attribute": "color",
|
|
6034
6034
|
"inheritedFrom": {
|
|
@@ -6264,7 +6264,7 @@
|
|
|
6264
6264
|
"description": "The color to set."
|
|
6265
6265
|
}
|
|
6266
6266
|
],
|
|
6267
|
-
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or for
|
|
6267
|
+
"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.",
|
|
6268
6268
|
"inheritedFrom": {
|
|
6269
6269
|
"name": "ButtonComponentMixin",
|
|
6270
6270
|
"module": "utils/mixins/ButtonComponentMixin.js"
|
|
@@ -6528,7 +6528,7 @@
|
|
|
6528
6528
|
"type": {
|
|
6529
6529
|
"text": "ButtonColor"
|
|
6530
6530
|
},
|
|
6531
|
-
"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
|
|
6531
|
+
"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.",
|
|
6532
6532
|
"default": "default",
|
|
6533
6533
|
"fieldName": "color",
|
|
6534
6534
|
"inheritedFrom": {
|
|
@@ -56070,7 +56070,7 @@
|
|
|
56070
56070
|
"type": {
|
|
56071
56071
|
"text": "ButtonColor"
|
|
56072
56072
|
},
|
|
56073
|
-
"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
|
|
56073
|
+
"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.",
|
|
56074
56074
|
"default": "default",
|
|
56075
56075
|
"attribute": "color"
|
|
56076
56076
|
},
|
|
@@ -56119,7 +56119,7 @@
|
|
|
56119
56119
|
"description": "The color to set."
|
|
56120
56120
|
}
|
|
56121
56121
|
],
|
|
56122
|
-
"description": "Sets the color attribute for the button.\nDefaults to DEFAULTS.COLOR if invalid or for
|
|
56122
|
+
"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."
|
|
56123
56123
|
},
|
|
56124
56124
|
{
|
|
56125
56125
|
"kind": "method",
|
|
@@ -56193,7 +56193,7 @@
|
|
|
56193
56193
|
"type": {
|
|
56194
56194
|
"text": "ButtonColor"
|
|
56195
56195
|
},
|
|
56196
|
-
"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
|
|
56196
|
+
"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.",
|
|
56197
56197
|
"default": "default",
|
|
56198
56198
|
"fieldName": "color"
|
|
56199
56199
|
}
|
|
@@ -34,6 +34,12 @@ import type { Events as EventsInherited } from '../../components/buttonsimple/bu
|
|
|
34
34
|
* - **Accent**: For informational actions
|
|
35
35
|
* - **Promotional**: For promotional actions
|
|
36
36
|
*
|
|
37
|
+
* Color options for **Tertiary** buttons:
|
|
38
|
+
*
|
|
39
|
+
* - **Default**: For standard actions
|
|
40
|
+
* - **Accent**: For informational actions
|
|
41
|
+
* - **Negative**: For destructive or error actions
|
|
42
|
+
*
|
|
37
43
|
* ### Button Sizes
|
|
38
44
|
*
|
|
39
45
|
* Size options for different button configurations in REM:
|
|
@@ -35,6 +35,12 @@ import { TAG_NAME } from '../../components/button/button.constants';
|
|
|
35
35
|
* - **Accent**: For informational actions
|
|
36
36
|
* - **Promotional**: For promotional actions
|
|
37
37
|
*
|
|
38
|
+
* Color options for **Tertiary** buttons:
|
|
39
|
+
*
|
|
40
|
+
* - **Default**: For standard actions
|
|
41
|
+
* - **Accent**: For informational actions
|
|
42
|
+
* - **Negative**: For destructive or error actions
|
|
43
|
+
*
|
|
38
44
|
* ### Button Sizes
|
|
39
45
|
*
|
|
40
46
|
* Size options for different button configurations in REM:
|
|
@@ -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, } from '../../components/button/button.constants';
|
|
12
|
+
import { BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_VARIANTS, DEFAULTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, TERTIARY_BUTTON_COLORS, } from '../../components/button/button.constants';
|
|
13
13
|
export const ButtonComponentMixin = (superClass) => {
|
|
14
14
|
class InnerMixinClass extends superClass {
|
|
15
15
|
constructor() {
|
|
@@ -30,7 +30,7 @@ export const ButtonComponentMixin = (superClass) => {
|
|
|
30
30
|
* - `promotional`: For promotional actions
|
|
31
31
|
* - `default`: For standard actions
|
|
32
32
|
*
|
|
33
|
-
* Note: Tertiary buttons
|
|
33
|
+
* Note: Tertiary buttons only support default, accent, and negative colors.
|
|
34
34
|
* @default default
|
|
35
35
|
*/
|
|
36
36
|
this.color = DEFAULTS.COLOR;
|
|
@@ -49,12 +49,15 @@ export const ButtonComponentMixin = (superClass) => {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Sets the color attribute for the button.
|
|
52
|
-
* Defaults to DEFAULTS.COLOR if invalid or for
|
|
52
|
+
* Defaults to DEFAULTS.COLOR if invalid or if the color is not supported for the current variant.
|
|
53
|
+
* Tertiary buttons only support default, accent, and negative colors.
|
|
53
54
|
*
|
|
54
55
|
* @param color - The color to set.
|
|
55
56
|
*/
|
|
56
57
|
setColor(color) {
|
|
57
|
-
|
|
58
|
+
const isValidColor = Object.values(BUTTON_COLORS).includes(color);
|
|
59
|
+
const isTertiaryUnsupported = this.variant === BUTTON_VARIANTS.TERTIARY && !Object.values(TERTIARY_BUTTON_COLORS).includes(color);
|
|
60
|
+
if (!isValidColor || isTertiaryUnsupported) {
|
|
58
61
|
this.setAttribute('color', `${DEFAULTS.COLOR}`);
|
|
59
62
|
}
|
|
60
63
|
else {
|