@momentum-design/components 0.129.25 → 0.129.27
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 +230 -213
- package/dist/browser/index.js.map +3 -3
- package/dist/components/announcementdialog/announcementdialog.component.d.ts +4 -9
- package/dist/components/announcementdialog/announcementdialog.component.js +4 -9
- package/dist/components/buttonlink/buttonlink.component.d.ts +1 -0
- package/dist/components/buttonlink/buttonlink.component.js +23 -0
- package/dist/components/checkbox/checkbox.component.d.ts +39 -39
- package/dist/components/checkbox/checkbox.component.js +39 -39
- package/dist/components/checkbox/checkbox.styles.js +10 -10
- package/dist/components/chip/chip.component.d.ts +7 -6
- package/dist/components/chip/chip.component.js +4 -12
- package/dist/components/dialog/dialog.constants.js +6 -4
- package/dist/components/linksimple/linksimple.component.d.ts +8 -0
- package/dist/components/linksimple/linksimple.component.js +2 -1
- package/dist/components/select/select.styles.js +0 -1
- package/dist/components/staticcheckbox/staticcheckbox.component.d.ts +19 -19
- package/dist/components/staticcheckbox/staticcheckbox.component.js +19 -19
- package/dist/components/staticcheckbox/staticcheckbox.styles.js +29 -29
- package/dist/components/staticchip/staticchip.component.d.ts +6 -4
- package/dist/components/staticchip/staticchip.component.js +3 -10
- package/dist/components/statictoggle/statictoggle.styles.js +1 -1
- package/dist/custom-elements.json +239 -251
- package/dist/react/announcementdialog/index.d.ts +4 -9
- package/dist/react/announcementdialog/index.js +4 -9
- package/dist/react/checkbox/index.d.ts +19 -26
- package/dist/react/checkbox/index.js +19 -26
- package/dist/react/chip/index.d.ts +3 -4
- package/dist/react/chip/index.js +3 -4
- package/dist/react/staticcheckbox/index.d.ts +11 -11
- package/dist/react/staticcheckbox/index.js +11 -11
- package/dist/react/staticchip/index.d.ts +2 -2
- package/dist/react/staticchip/index.js +2 -2
- package/package.json +1 -1
|
@@ -17,16 +17,11 @@ import type { AnnouncementDialogSize } from './announcementdialog.types';
|
|
|
17
17
|
* Use the `onClose` event to handle the close action of the dialog (fired when Close button is clicked
|
|
18
18
|
* or Escape is pressed).
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* ## Accessibility
|
|
21
|
+
* - You have to be explicitly set the following attributes:
|
|
22
|
+
* * The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
|
|
23
|
+
* * Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
|
|
21
24
|
*
|
|
22
|
-
* - The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
|
|
23
|
-
* - Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
|
|
24
|
-
*
|
|
25
|
-
* **Note: Programmatic show/hide requires the ? prefix on the visible attribute**
|
|
26
|
-
* - Use `?visible=true/false` as an attribute instead of `visible=true/false`
|
|
27
|
-
* - Reference docs for more info: https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
|
|
28
|
-
*
|
|
29
|
-
* @dependency mdc-button
|
|
30
25
|
* @dependency mdc-illustration
|
|
31
26
|
* @dependency mdc-text
|
|
32
27
|
*
|
|
@@ -30,16 +30,11 @@ import { DEFAULTS } from './announcementdialog.constants';
|
|
|
30
30
|
* Use the `onClose` event to handle the close action of the dialog (fired when Close button is clicked
|
|
31
31
|
* or Escape is pressed).
|
|
32
32
|
*
|
|
33
|
-
*
|
|
33
|
+
* ## Accessibility
|
|
34
|
+
* - You have to be explicitly set the following attributes:
|
|
35
|
+
* * The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
|
|
36
|
+
* * Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
|
|
34
37
|
*
|
|
35
|
-
* - The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
|
|
36
|
-
* - Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
|
|
37
|
-
*
|
|
38
|
-
* **Note: Programmatic show/hide requires the ? prefix on the visible attribute**
|
|
39
|
-
* - Use `?visible=true/false` as an attribute instead of `visible=true/false`
|
|
40
|
-
* - Reference docs for more info: https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
|
|
41
|
-
*
|
|
42
|
-
* @dependency mdc-button
|
|
43
38
|
* @dependency mdc-illustration
|
|
44
39
|
* @dependency mdc-text
|
|
45
40
|
*
|
|
@@ -68,6 +68,7 @@ declare class ButtonLink extends ButtonLink_base {
|
|
|
68
68
|
private setSoftDisabled;
|
|
69
69
|
update(changedProperties: PropertyValues): void;
|
|
70
70
|
protected renderAnchorContent(): import("lit-html").TemplateResult<1>;
|
|
71
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
71
72
|
static styles: Array<CSSResult>;
|
|
72
73
|
}
|
|
73
74
|
export default ButtonLink;
|
|
@@ -9,6 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { html } from 'lit';
|
|
11
11
|
import { property } from 'lit/decorators.js';
|
|
12
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
12
13
|
import Button from '../button/button.component';
|
|
13
14
|
import { ButtonComponentMixin } from '../../utils/mixins/ButtonComponentMixin';
|
|
14
15
|
import { DEFAULTS } from '../button/button.constants';
|
|
@@ -110,6 +111,28 @@ class ButtonLink extends ButtonComponentMixin(Linksimple) {
|
|
|
110
111
|
: ''}
|
|
111
112
|
`;
|
|
112
113
|
}
|
|
114
|
+
render() {
|
|
115
|
+
var _a;
|
|
116
|
+
return html `
|
|
117
|
+
<a
|
|
118
|
+
class="mdc-focus-ring"
|
|
119
|
+
part="anchor"
|
|
120
|
+
href="${ifDefined(this.href)}"
|
|
121
|
+
target="${this.target}"
|
|
122
|
+
rel="${ifDefined(this.rel)}"
|
|
123
|
+
download="${ifDefined(this.download)}"
|
|
124
|
+
ping="${ifDefined(this.ping)}"
|
|
125
|
+
hreflang="${ifDefined(this.hreflang)}"
|
|
126
|
+
type="${ifDefined(this.type)}"
|
|
127
|
+
referrerpolicy="${ifDefined(this.referrerpolicy)}"
|
|
128
|
+
role="button"
|
|
129
|
+
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
|
130
|
+
tabindex="${this.disabled ? -1 : 0}"
|
|
131
|
+
>
|
|
132
|
+
${this.renderAnchorContent()}
|
|
133
|
+
</a>
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
113
136
|
}
|
|
114
137
|
ButtonLink.styles = [...Button.styles, ...styles];
|
|
115
138
|
__decorate([
|
|
@@ -4,12 +4,25 @@ import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
|
|
4
4
|
import type { CheckboxValidationType } from './checkbox.types';
|
|
5
5
|
declare const Checkbox_base: import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* These are
|
|
7
|
+
* The Checkbox component allows users to select one or multiple options from a list, toggle features on/off,
|
|
8
|
+
* or indicate agreement in forms and settings. These are commonly used in forms, lists, and settings panels
|
|
9
|
+
* where users need to make selections or express preferences.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
+
* To create a group of checkboxes, use the `mdc-formfieldgroup` component.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
+
* **Note:** This component internally renders a native checkbox input element with custom styling.
|
|
14
|
+
*
|
|
15
|
+
* ## When to use
|
|
16
|
+
* Use checkboxes when users can select multiple options from a list, or when a single checkbox represents a binary choice (e.g., agreeing to terms).
|
|
17
|
+
*
|
|
18
|
+
* ## Accessibility
|
|
19
|
+
* - Provide clear labels that describe what the checkbox controls
|
|
20
|
+
* - Use `data-aria-label` when a visual label is not present
|
|
21
|
+
* - Keyboard navigation: Space to toggle, Tab to navigate, Enter to submit form
|
|
22
|
+
*
|
|
23
|
+
* ## Styling
|
|
24
|
+
* Use the `static-checkbox` part to apply custom styles to the checkbox visual element.
|
|
25
|
+
* This part exposes the underlying [StaticCheckbox](?path=/docs/components-decorator-staticcheckbox--docs) component for advanced styling.
|
|
13
26
|
*
|
|
14
27
|
* @dependency mdc-button
|
|
15
28
|
* @dependency mdc-icon
|
|
@@ -22,26 +35,6 @@ declare const Checkbox_base: import("../../utils/mixins/index.types").Constructo
|
|
|
22
35
|
* @event change - (React: onChange) Event that gets dispatched when the checkbox state changes.
|
|
23
36
|
* @event focus - (React: onFocus) Event that gets dispatched when the checkbox receives focus.
|
|
24
37
|
*
|
|
25
|
-
* @cssproperty --mdc-checkbox-background-color-hover - Allows customization of the background color on hover.
|
|
26
|
-
* @cssproperty --mdc-checkbox-checked-background-color-hover - Background color for a selected checkbox when hovered.
|
|
27
|
-
* @cssproperty --mdc-checkbox-checked-pressed-icon-color - Background color for a selected checkbox when pressed.
|
|
28
|
-
* @cssproperty --mdc-checkbox-pressed-icon-color - Background color for a selected checkbox when pressed.
|
|
29
|
-
* @cssproperty --mdc-checkbox-disabled-checked-icon-color - Background color for a selected checkbox when disabled.
|
|
30
|
-
* @cssproperty --mdc-label-font-size - Font size for the label text.
|
|
31
|
-
* @cssproperty --mdc-label-font-weight - Font weight for the label text.
|
|
32
|
-
* @cssproperty --mdc-label-line-height - Line height for the label text.
|
|
33
|
-
* @cssproperty --mdc-label-color - Color for the label text.
|
|
34
|
-
* @cssproperty --mdc-help-text-font-size - Font size for the help text.
|
|
35
|
-
* @cssproperty --mdc-help-text-font-weight - Font weight for the help text.
|
|
36
|
-
* @cssproperty --mdc-help-text-line-height - Line height for the help text.
|
|
37
|
-
* @cssproperty --mdc-help-text-color - Color for the help text.
|
|
38
|
-
* @cssproperty --mdc-required-indicator-color - Color for the required indicator text.
|
|
39
|
-
*
|
|
40
|
-
* @slot label - Slot for the label element. If not provided, the `label` property will be used to render the label.
|
|
41
|
-
* @slot toggletip - Slot for the toggletip info icon button. If not provided, the `toggletip-text` property will be used to render the info icon button and toggletip.
|
|
42
|
-
* @slot help-icon - Slot for the helper/validation icon. If not provided, the icon will be rendered based on the `helpTextType` property.
|
|
43
|
-
* @slot help-text - Slot for the helper/validation text. If not provided, the `helpText` property will be used to render the helper/validation text.
|
|
44
|
-
*
|
|
45
38
|
* @csspart label - The label element.
|
|
46
39
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
47
40
|
* @csspart required-indicator - The required indicator element that is displayed next to the label when the `required` property is set to true.
|
|
@@ -50,33 +43,34 @@ declare const Checkbox_base: import("../../utils/mixins/index.types").Constructo
|
|
|
50
43
|
* @csspart help-text - The helper/validation text element.
|
|
51
44
|
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
52
45
|
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
53
|
-
* @csspart checkbox-input - The native checkbox input element.
|
|
46
|
+
* @csspart checkbox-input - The native checkbox input element that provides the interactive functionality.
|
|
54
47
|
* @csspart text-container - The container for the label and helper text elements.
|
|
55
|
-
* @csspart static-checkbox - The
|
|
48
|
+
* @csspart static-checkbox - The staticcheckbox that provides the visual checkbox appearance.
|
|
56
49
|
*/
|
|
57
50
|
declare class Checkbox extends Checkbox_base implements AssociatedFormControl {
|
|
58
51
|
/**
|
|
59
|
-
* Determines whether the checkbox is selected or
|
|
60
|
-
*
|
|
52
|
+
* Determines whether the checkbox is checked (selected) or unchecked.
|
|
61
53
|
* @default false
|
|
62
54
|
*/
|
|
63
55
|
checked: boolean;
|
|
64
56
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* If
|
|
68
|
-
*
|
|
57
|
+
* Determines whether the checkbox is in an indeterminate (mixed) state.
|
|
58
|
+
* Typically used in nested checkbox groups where the parent checkbox represents partial selection.
|
|
59
|
+
* - If any child is unchecked, the parent appears indeterminate.
|
|
60
|
+
* - If all children share the same state (all checked or all unchecked), the parent is not indeterminate.
|
|
69
61
|
* @default false
|
|
70
62
|
*/
|
|
71
63
|
indeterminate: boolean;
|
|
72
64
|
/**
|
|
73
|
-
* Automatically
|
|
65
|
+
* Automatically focuses the checkbox when the page loads.
|
|
74
66
|
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
|
75
67
|
* @default false
|
|
76
68
|
*/
|
|
77
69
|
autofocus: boolean;
|
|
78
70
|
/**
|
|
79
|
-
*
|
|
71
|
+
* Determines the visual style of the helper text.
|
|
72
|
+
* - **default**: Standard helper text appearance
|
|
73
|
+
* - **error**: Error state with validation styling
|
|
80
74
|
* @default 'default'
|
|
81
75
|
*/
|
|
82
76
|
helpTextType: CheckboxValidationType;
|
|
@@ -85,16 +79,18 @@ declare class Checkbox extends Checkbox_base implements AssociatedFormControl {
|
|
|
85
79
|
* Updates the form value to reflect the current state of the checkbox.
|
|
86
80
|
* If checked, the value is set to either the user-provided value or 'on' if no value is provided.
|
|
87
81
|
* If unchecked, the value is set to null.
|
|
82
|
+
* @internal
|
|
88
83
|
*/
|
|
89
84
|
private setFormValue;
|
|
90
85
|
/**
|
|
91
86
|
* Manages the required state of the checkbox.
|
|
92
87
|
* If the checkbox is not checked and the required property is set, then the checkbox is invalid.
|
|
88
|
+
* @internal
|
|
93
89
|
*/
|
|
94
90
|
private manageRequired;
|
|
95
|
-
/**
|
|
96
|
-
* Resets the checkbox to its initial state.
|
|
97
|
-
*
|
|
91
|
+
/**
|
|
92
|
+
* Resets the checkbox to its initial unchecked state.
|
|
93
|
+
* @internal
|
|
98
94
|
*/
|
|
99
95
|
formResetCallback(): void;
|
|
100
96
|
/** @internal */
|
|
@@ -103,20 +99,24 @@ declare class Checkbox extends Checkbox_base implements AssociatedFormControl {
|
|
|
103
99
|
* Toggles the state of the checkbox element.
|
|
104
100
|
* If the element is not disabled, soft-disabled, or readonly, then
|
|
105
101
|
* the checked property is toggled and the indeterminate property is set to false.
|
|
102
|
+
* @internal
|
|
106
103
|
*/
|
|
107
104
|
private toggleState;
|
|
108
105
|
/**
|
|
109
106
|
* Handles the keydown event on the checkbox.
|
|
110
107
|
* When the user presses Enter, the form is submitted.
|
|
111
108
|
* @param event - The keyboard event.
|
|
109
|
+
* @internal
|
|
112
110
|
*/
|
|
113
111
|
private handleKeyDown;
|
|
114
112
|
/**
|
|
115
|
-
* Toggles the state of the checkbox element.
|
|
116
|
-
*
|
|
113
|
+
* Toggles the state of the checkbox element and dispatches the change event.
|
|
114
|
+
* @param event - The change event.
|
|
115
|
+
* @internal
|
|
117
116
|
*/
|
|
118
117
|
handleChange(event: Event): void;
|
|
119
118
|
update(changedProperties: PropertyValues): void;
|
|
119
|
+
/** @internal */
|
|
120
120
|
private renderLabelAndHelperText;
|
|
121
121
|
render(): import("lit-html").TemplateResult<1>;
|
|
122
122
|
static styles: Array<CSSResult>;
|
|
@@ -19,12 +19,25 @@ import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwra
|
|
|
19
19
|
import styles from './checkbox.styles';
|
|
20
20
|
import { CHECKBOX_VALIDATION } from './checkbox.constants';
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* These are
|
|
22
|
+
* The Checkbox component allows users to select one or multiple options from a list, toggle features on/off,
|
|
23
|
+
* or indicate agreement in forms and settings. These are commonly used in forms, lists, and settings panels
|
|
24
|
+
* where users need to make selections or express preferences.
|
|
24
25
|
*
|
|
25
|
-
*
|
|
26
|
+
* To create a group of checkboxes, use the `mdc-formfieldgroup` component.
|
|
26
27
|
*
|
|
27
|
-
*
|
|
28
|
+
* **Note:** This component internally renders a native checkbox input element with custom styling.
|
|
29
|
+
*
|
|
30
|
+
* ## When to use
|
|
31
|
+
* Use checkboxes when users can select multiple options from a list, or when a single checkbox represents a binary choice (e.g., agreeing to terms).
|
|
32
|
+
*
|
|
33
|
+
* ## Accessibility
|
|
34
|
+
* - Provide clear labels that describe what the checkbox controls
|
|
35
|
+
* - Use `data-aria-label` when a visual label is not present
|
|
36
|
+
* - Keyboard navigation: Space to toggle, Tab to navigate, Enter to submit form
|
|
37
|
+
*
|
|
38
|
+
* ## Styling
|
|
39
|
+
* Use the `static-checkbox` part to apply custom styles to the checkbox visual element.
|
|
40
|
+
* This part exposes the underlying [StaticCheckbox](?path=/docs/components-decorator-staticcheckbox--docs) component for advanced styling.
|
|
28
41
|
*
|
|
29
42
|
* @dependency mdc-button
|
|
30
43
|
* @dependency mdc-icon
|
|
@@ -37,26 +50,6 @@ import { CHECKBOX_VALIDATION } from './checkbox.constants';
|
|
|
37
50
|
* @event change - (React: onChange) Event that gets dispatched when the checkbox state changes.
|
|
38
51
|
* @event focus - (React: onFocus) Event that gets dispatched when the checkbox receives focus.
|
|
39
52
|
*
|
|
40
|
-
* @cssproperty --mdc-checkbox-background-color-hover - Allows customization of the background color on hover.
|
|
41
|
-
* @cssproperty --mdc-checkbox-checked-background-color-hover - Background color for a selected checkbox when hovered.
|
|
42
|
-
* @cssproperty --mdc-checkbox-checked-pressed-icon-color - Background color for a selected checkbox when pressed.
|
|
43
|
-
* @cssproperty --mdc-checkbox-pressed-icon-color - Background color for a selected checkbox when pressed.
|
|
44
|
-
* @cssproperty --mdc-checkbox-disabled-checked-icon-color - Background color for a selected checkbox when disabled.
|
|
45
|
-
* @cssproperty --mdc-label-font-size - Font size for the label text.
|
|
46
|
-
* @cssproperty --mdc-label-font-weight - Font weight for the label text.
|
|
47
|
-
* @cssproperty --mdc-label-line-height - Line height for the label text.
|
|
48
|
-
* @cssproperty --mdc-label-color - Color for the label text.
|
|
49
|
-
* @cssproperty --mdc-help-text-font-size - Font size for the help text.
|
|
50
|
-
* @cssproperty --mdc-help-text-font-weight - Font weight for the help text.
|
|
51
|
-
* @cssproperty --mdc-help-text-line-height - Line height for the help text.
|
|
52
|
-
* @cssproperty --mdc-help-text-color - Color for the help text.
|
|
53
|
-
* @cssproperty --mdc-required-indicator-color - Color for the required indicator text.
|
|
54
|
-
*
|
|
55
|
-
* @slot label - Slot for the label element. If not provided, the `label` property will be used to render the label.
|
|
56
|
-
* @slot toggletip - Slot for the toggletip info icon button. If not provided, the `toggletip-text` property will be used to render the info icon button and toggletip.
|
|
57
|
-
* @slot help-icon - Slot for the helper/validation icon. If not provided, the icon will be rendered based on the `helpTextType` property.
|
|
58
|
-
* @slot help-text - Slot for the helper/validation text. If not provided, the `helpText` property will be used to render the helper/validation text.
|
|
59
|
-
*
|
|
60
53
|
* @csspart label - The label element.
|
|
61
54
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
62
55
|
* @csspart required-indicator - The required indicator element that is displayed next to the label when the `required` property is set to true.
|
|
@@ -65,38 +58,40 @@ import { CHECKBOX_VALIDATION } from './checkbox.constants';
|
|
|
65
58
|
* @csspart help-text - The helper/validation text element.
|
|
66
59
|
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
67
60
|
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
68
|
-
* @csspart checkbox-input - The native checkbox input element.
|
|
61
|
+
* @csspart checkbox-input - The native checkbox input element that provides the interactive functionality.
|
|
69
62
|
* @csspart text-container - The container for the label and helper text elements.
|
|
70
|
-
* @csspart static-checkbox - The
|
|
63
|
+
* @csspart static-checkbox - The staticcheckbox that provides the visual checkbox appearance.
|
|
71
64
|
*/
|
|
72
65
|
class Checkbox extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
|
|
73
66
|
constructor() {
|
|
74
67
|
super(...arguments);
|
|
75
68
|
/**
|
|
76
|
-
* Determines whether the checkbox is selected or
|
|
77
|
-
*
|
|
69
|
+
* Determines whether the checkbox is checked (selected) or unchecked.
|
|
78
70
|
* @default false
|
|
79
71
|
*/
|
|
80
72
|
this.checked = false;
|
|
81
73
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* If
|
|
85
|
-
*
|
|
74
|
+
* Determines whether the checkbox is in an indeterminate (mixed) state.
|
|
75
|
+
* Typically used in nested checkbox groups where the parent checkbox represents partial selection.
|
|
76
|
+
* - If any child is unchecked, the parent appears indeterminate.
|
|
77
|
+
* - If all children share the same state (all checked or all unchecked), the parent is not indeterminate.
|
|
86
78
|
* @default false
|
|
87
79
|
*/
|
|
88
80
|
this.indeterminate = false;
|
|
89
81
|
/**
|
|
90
|
-
* Automatically
|
|
82
|
+
* Automatically focuses the checkbox when the page loads.
|
|
91
83
|
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
|
92
84
|
* @default false
|
|
93
85
|
*/
|
|
94
86
|
this.autofocus = false;
|
|
95
87
|
/**
|
|
96
|
-
*
|
|
88
|
+
* Determines the visual style of the helper text.
|
|
89
|
+
* - **default**: Standard helper text appearance
|
|
90
|
+
* - **error**: Error state with validation styling
|
|
97
91
|
* @default 'default'
|
|
98
92
|
*/
|
|
99
93
|
this.helpTextType = CHECKBOX_VALIDATION.DEFAULT;
|
|
94
|
+
/** @internal */
|
|
100
95
|
this.renderLabelAndHelperText = () => {
|
|
101
96
|
if (!this.label)
|
|
102
97
|
return nothing;
|
|
@@ -116,6 +111,7 @@ class Checkbox extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMix
|
|
|
116
111
|
* Updates the form value to reflect the current state of the checkbox.
|
|
117
112
|
* If checked, the value is set to either the user-provided value or 'on' if no value is provided.
|
|
118
113
|
* If unchecked, the value is set to null.
|
|
114
|
+
* @internal
|
|
119
115
|
*/
|
|
120
116
|
setFormValue() {
|
|
121
117
|
let actualValue = null;
|
|
@@ -131,6 +127,7 @@ class Checkbox extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMix
|
|
|
131
127
|
/**
|
|
132
128
|
* Manages the required state of the checkbox.
|
|
133
129
|
* If the checkbox is not checked and the required property is set, then the checkbox is invalid.
|
|
130
|
+
* @internal
|
|
134
131
|
*/
|
|
135
132
|
manageRequired() {
|
|
136
133
|
if (!this.checked && this.required) {
|
|
@@ -146,9 +143,9 @@ class Checkbox extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMix
|
|
|
146
143
|
this.internals.setValidity({});
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Resets the checkbox to its initial state.
|
|
151
|
-
*
|
|
146
|
+
/**
|
|
147
|
+
* Resets the checkbox to its initial unchecked state.
|
|
148
|
+
* @internal
|
|
152
149
|
*/
|
|
153
150
|
formResetCallback() {
|
|
154
151
|
this.checked = false;
|
|
@@ -164,6 +161,7 @@ class Checkbox extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMix
|
|
|
164
161
|
* Toggles the state of the checkbox element.
|
|
165
162
|
* If the element is not disabled, soft-disabled, or readonly, then
|
|
166
163
|
* the checked property is toggled and the indeterminate property is set to false.
|
|
164
|
+
* @internal
|
|
167
165
|
*/
|
|
168
166
|
toggleState() {
|
|
169
167
|
if (!this.disabled && !this.softDisabled && !this.readonly) {
|
|
@@ -175,6 +173,7 @@ class Checkbox extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMix
|
|
|
175
173
|
* Handles the keydown event on the checkbox.
|
|
176
174
|
* When the user presses Enter, the form is submitted.
|
|
177
175
|
* @param event - The keyboard event.
|
|
176
|
+
* @internal
|
|
178
177
|
*/
|
|
179
178
|
handleKeyDown(event) {
|
|
180
179
|
var _a;
|
|
@@ -186,8 +185,9 @@ class Checkbox extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMix
|
|
|
186
185
|
}
|
|
187
186
|
}
|
|
188
187
|
/**
|
|
189
|
-
* Toggles the state of the checkbox element.
|
|
190
|
-
*
|
|
188
|
+
* Toggles the state of the checkbox element and dispatches the change event.
|
|
189
|
+
* @param event - The change event.
|
|
190
|
+
* @internal
|
|
191
191
|
*/
|
|
192
192
|
handleChange(event) {
|
|
193
193
|
this.toggleState();
|
|
@@ -3,6 +3,9 @@ import { hostFocusRingStyles } from '../../utils/styles';
|
|
|
3
3
|
const styles = [
|
|
4
4
|
css `
|
|
5
5
|
:host {
|
|
6
|
+
--mdc-label-font-size: var(--mds-font-apps-body-midsize-regular-font-size);
|
|
7
|
+
--mdc-label-font-weight: var(--mds-font-apps-body-midsize-regular-font-weight);
|
|
8
|
+
--mdc-label-line-height: var(--mds-font-apps-body-midsize-regular-line-height);
|
|
6
9
|
flex-direction: row;
|
|
7
10
|
align-items: flex-start;
|
|
8
11
|
}
|
|
@@ -20,8 +23,8 @@ const styles = [
|
|
|
20
23
|
opacity: 0.1%;
|
|
21
24
|
overflow: visible;
|
|
22
25
|
z-index: 1;
|
|
23
|
-
width: var(--mdc-
|
|
24
|
-
height: var(--mdc-
|
|
26
|
+
width: var(--mdc-staticcheckbox-size);
|
|
27
|
+
height: var(--mdc-staticcheckbox-size);
|
|
25
28
|
border-radius: 0.125rem;
|
|
26
29
|
}
|
|
27
30
|
|
|
@@ -32,9 +35,6 @@ const styles = [
|
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
:host::part(label) {
|
|
35
|
-
--mdc-label-font-size: var(--mds-font-apps-body-midsize-regular-font-size);
|
|
36
|
-
--mdc-label-font-weight: var(--mds-font-apps-body-midsize-regular-font-weight);
|
|
37
|
-
--mdc-label-line-height: var(--mds-font-apps-body-midsize-regular-line-height);
|
|
38
38
|
word-break: break-word;
|
|
39
39
|
white-space: normal;
|
|
40
40
|
}
|
|
@@ -45,25 +45,25 @@ const styles = [
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
:host(:hover)::part(static-checkbox) {
|
|
48
|
-
--mdc-
|
|
48
|
+
--mdc-staticcheckbox-background-color: var(--mds-color-theme-control-inactive-hover);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
:host(:active)::part(static-checkbox) {
|
|
52
|
-
--mdc-
|
|
52
|
+
--mdc-staticcheckbox-background-color: var(--mds-color-theme-control-inactive-pressed);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
:host([checked]:hover)::part(static-checkbox),
|
|
56
56
|
:host([indeterminate]:hover)::part(static-checkbox) {
|
|
57
|
-
--mdc-
|
|
57
|
+
--mdc-staticcheckbox-background-color: var(--mds-color-theme-control-active-hover);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
:host([checked]:active)::part(static-checkbox),
|
|
61
61
|
:host([indeterminate]:active)::part(static-checkbox) {
|
|
62
|
-
--mdc-
|
|
62
|
+
--mdc-staticcheckbox-background-color: var(--mds-color-theme-control-active-pressed);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
:host([help-text-type='error'])::part(static-checkbox) {
|
|
66
|
-
--mdc-
|
|
66
|
+
--mdc-staticcheckbox-border-color: var(--mds-color-theme-outline-cancel-normal);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
:host([readonly]),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSResult } from 'lit';
|
|
1
|
+
import type { CSSResult } from 'lit';
|
|
2
2
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
|
3
3
|
import type { ColorType } from '../staticchip/staticchip.types';
|
|
4
4
|
declare const Chip_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/IconNameMixin").IconNameMixinInterface> & typeof Buttonsimple;
|
|
@@ -6,11 +6,11 @@ declare const Chip_base: import("../../utils/mixins/index.types").Constructor<im
|
|
|
6
6
|
* mdc-chip is an interactive element that can be used to represent a chip. It supports a leading icon along with label.
|
|
7
7
|
* Consumers can wrap this component around a tooltip to provide additional context.
|
|
8
8
|
*
|
|
9
|
-
* It is recommended to keep the label text for the chip component concise and compact
|
|
9
|
+
* It is recommended to keep the label text for the chip component concise and compact.<br/>
|
|
10
10
|
* For best results, we recommend limiting the <b>maximum length of the label text to 20 characters</b>,
|
|
11
11
|
* including empty spaces to split words.
|
|
12
12
|
*
|
|
13
|
-
* This component is built by extending Buttonsimple
|
|
13
|
+
* This component is built by extending `Buttonsimple`.
|
|
14
14
|
*
|
|
15
15
|
* @tagname mdc-chip
|
|
16
16
|
*
|
|
@@ -20,15 +20,14 @@ declare const Chip_base: import("../../utils/mixins/index.types").Constructor<im
|
|
|
20
20
|
* @cssproperty --mdc-chip-color - The color of the chip.
|
|
21
21
|
* @cssproperty --mdc-chip-border-color - The border color of the chip.
|
|
22
22
|
* @cssproperty --mdc-chip-background-color - The background color of the chip.
|
|
23
|
-
* @cssproperty --mdc-button-height - Height for button size
|
|
24
23
|
*
|
|
24
|
+
* @csspart icon - The icon part of the chip.
|
|
25
25
|
* @csspart label - The label part of the chip.
|
|
26
26
|
*
|
|
27
27
|
* @event click - (React: onClick) This event is dispatched when the chip is clicked.
|
|
28
28
|
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the chip.
|
|
29
29
|
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
|
30
30
|
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
|
31
|
-
*
|
|
32
31
|
*/
|
|
33
32
|
declare class Chip extends Chip_base {
|
|
34
33
|
/**
|
|
@@ -52,8 +51,10 @@ declare class Chip extends Chip_base {
|
|
|
52
51
|
*
|
|
53
52
|
* We recommend limiting the <b>maximum length of the label text to 20 characters</b>,
|
|
54
53
|
* including empty spaces to split words.
|
|
54
|
+
*
|
|
55
|
+
* @default undefined
|
|
55
56
|
*/
|
|
56
|
-
label
|
|
57
|
+
label?: string;
|
|
57
58
|
connectedCallback(): void;
|
|
58
59
|
/**
|
|
59
60
|
* Renders the icon element if available.
|
|
@@ -18,11 +18,11 @@ import styles from './chip.styles';
|
|
|
18
18
|
* mdc-chip is an interactive element that can be used to represent a chip. It supports a leading icon along with label.
|
|
19
19
|
* Consumers can wrap this component around a tooltip to provide additional context.
|
|
20
20
|
*
|
|
21
|
-
* It is recommended to keep the label text for the chip component concise and compact
|
|
21
|
+
* It is recommended to keep the label text for the chip component concise and compact.<br/>
|
|
22
22
|
* For best results, we recommend limiting the <b>maximum length of the label text to 20 characters</b>,
|
|
23
23
|
* including empty spaces to split words.
|
|
24
24
|
*
|
|
25
|
-
* This component is built by extending Buttonsimple
|
|
25
|
+
* This component is built by extending `Buttonsimple`.
|
|
26
26
|
*
|
|
27
27
|
* @tagname mdc-chip
|
|
28
28
|
*
|
|
@@ -32,15 +32,14 @@ import styles from './chip.styles';
|
|
|
32
32
|
* @cssproperty --mdc-chip-color - The color of the chip.
|
|
33
33
|
* @cssproperty --mdc-chip-border-color - The border color of the chip.
|
|
34
34
|
* @cssproperty --mdc-chip-background-color - The background color of the chip.
|
|
35
|
-
* @cssproperty --mdc-button-height - Height for button size
|
|
36
35
|
*
|
|
36
|
+
* @csspart icon - The icon part of the chip.
|
|
37
37
|
* @csspart label - The label part of the chip.
|
|
38
38
|
*
|
|
39
39
|
* @event click - (React: onClick) This event is dispatched when the chip is clicked.
|
|
40
40
|
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the chip.
|
|
41
41
|
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
|
42
42
|
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
|
43
|
-
*
|
|
44
43
|
*/
|
|
45
44
|
class Chip extends IconNameMixin(Buttonsimple) {
|
|
46
45
|
constructor() {
|
|
@@ -61,13 +60,6 @@ class Chip extends IconNameMixin(Buttonsimple) {
|
|
|
61
60
|
* @default default
|
|
62
61
|
*/
|
|
63
62
|
this.color = DEFAULTS.COLOR;
|
|
64
|
-
/**
|
|
65
|
-
* The visible label text of the chip.
|
|
66
|
-
*
|
|
67
|
-
* We recommend limiting the <b>maximum length of the label text to 20 characters</b>,
|
|
68
|
-
* including empty spaces to split words.
|
|
69
|
-
*/
|
|
70
|
-
this.label = '';
|
|
71
63
|
}
|
|
72
64
|
connectedCallback() {
|
|
73
65
|
super.connectedCallback();
|
|
@@ -103,6 +95,6 @@ __decorate([
|
|
|
103
95
|
], Chip.prototype, "color", void 0);
|
|
104
96
|
__decorate([
|
|
105
97
|
property({ type: String }),
|
|
106
|
-
__metadata("design:type",
|
|
98
|
+
__metadata("design:type", String)
|
|
107
99
|
], Chip.prototype, "label", void 0);
|
|
108
100
|
export default Chip;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import utils from '../../utils/tag-name';
|
|
2
|
+
import { ROLE } from '../../utils/roles';
|
|
3
|
+
import { VALID_TEXT_TAGS } from '../text/text.constants';
|
|
2
4
|
const TAG_NAME = utils.constructTagName('dialog');
|
|
3
5
|
const DIALOG_VARIANT = {
|
|
4
6
|
DEFAULT: 'default',
|
|
@@ -7,10 +9,10 @@ const DIALOG_VARIANT = {
|
|
|
7
9
|
const DEFAULTS = {
|
|
8
10
|
VISIBLE: false,
|
|
9
11
|
Z_INDEX: 1000,
|
|
10
|
-
ROLE:
|
|
12
|
+
ROLE: ROLE.DIALOG,
|
|
11
13
|
SIZE: 'small',
|
|
12
|
-
HEADER_TAG_NAME:
|
|
13
|
-
DESCRIPTION_TAG_NAME:
|
|
14
|
+
HEADER_TAG_NAME: VALID_TEXT_TAGS.H2,
|
|
15
|
+
DESCRIPTION_TAG_NAME: VALID_TEXT_TAGS.P,
|
|
14
16
|
CANCEL_ICON: 'cancel-bold',
|
|
15
17
|
VARIANT: DIALOG_VARIANT.DEFAULT,
|
|
16
18
|
DISABLE_ARIA_HAS_POPUP: false,
|
|
@@ -18,5 +20,5 @@ const DEFAULTS = {
|
|
|
18
20
|
HIDE_BACKDROP: false,
|
|
19
21
|
};
|
|
20
22
|
const DIALOG_SIZE = ['small', 'medium', 'large', 'xlarge', 'fullscreen'];
|
|
21
|
-
const DIALOG_ROLE = [
|
|
23
|
+
const DIALOG_ROLE = [ROLE.DIALOG, ROLE.ALERTDIALOG];
|
|
22
24
|
export { TAG_NAME, DEFAULTS, DIALOG_SIZE, DIALOG_ROLE, DIALOG_VARIANT };
|
|
@@ -98,5 +98,13 @@ declare class Linksimple extends Linksimple_base {
|
|
|
98
98
|
protected renderAnchorContent(): import("lit-html").TemplateResult<1>;
|
|
99
99
|
render(): import("lit-html").TemplateResult<1>;
|
|
100
100
|
static styles: Array<CSSResult>;
|
|
101
|
+
static shadowRootOptions: {
|
|
102
|
+
delegatesFocus: boolean;
|
|
103
|
+
clonable?: boolean;
|
|
104
|
+
customElementRegistry?: CustomElementRegistry;
|
|
105
|
+
mode: ShadowRootMode;
|
|
106
|
+
serializable?: boolean;
|
|
107
|
+
slotAssignment?: SlotAssignmentMode;
|
|
108
|
+
};
|
|
101
109
|
}
|
|
102
110
|
export default Linksimple;
|
|
@@ -112,7 +112,7 @@ class Linksimple extends DataAriaLabelMixin(DisabledMixin(Component)) {
|
|
|
112
112
|
<a
|
|
113
113
|
class="mdc-focus-ring"
|
|
114
114
|
part="anchor"
|
|
115
|
-
href="${this.href}"
|
|
115
|
+
href="${ifDefined(this.href)}"
|
|
116
116
|
target="${this.target}"
|
|
117
117
|
rel="${ifDefined(this.rel)}"
|
|
118
118
|
download="${ifDefined(this.download)}"
|
|
@@ -129,6 +129,7 @@ class Linksimple extends DataAriaLabelMixin(DisabledMixin(Component)) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
Linksimple.styles = [...Component.styles, ...styles];
|
|
132
|
+
Linksimple.shadowRootOptions = { ...Component.shadowRootOptions, delegatesFocus: true };
|
|
132
133
|
__decorate([
|
|
133
134
|
property({ type: Boolean, reflect: true }),
|
|
134
135
|
__metadata("design:type", Boolean)
|
|
@@ -57,7 +57,6 @@ const styles = css `
|
|
|
57
57
|
--mdc-select-background-color: var(--mds-color-theme-background-primary-active);
|
|
58
58
|
}
|
|
59
59
|
:host::part(base-text) {
|
|
60
|
-
height: 100%;
|
|
61
60
|
/* 2rem is the complete width of dropdown icon */
|
|
62
61
|
width: calc(100% - 2rem);
|
|
63
62
|
color: var(--mdc-select-text-color);
|