@momentum-design/components 0.84.3 → 0.84.5
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/README.md +8 -3
- package/dist/browser/index.js +2241 -2299
- package/dist/browser/index.js.map +4 -4
- package/dist/components/alertchip/alertchip.component.d.ts +1 -1
- package/dist/components/alertchip/alertchip.component.js +2 -2
- package/dist/components/alertchip/alertchip.styles.js +22 -23
- package/dist/components/alertchip/alertchip.types.d.ts +1 -1
- package/dist/components/animation/animation.component.js +1 -1
- package/dist/components/animation/animation.styles.js +8 -5
- package/dist/components/appheader/appheader.component.js +12 -13
- package/dist/components/appheader/appheader.styles.js +0 -1
- package/dist/components/avatar/avatar.component.js +3 -16
- package/dist/components/avatar/avatar.constants.d.ts +1 -1
- package/dist/components/avatar/avatar.constants.js +1 -1
- package/dist/components/avatar/avatar.styles.js +129 -122
- package/dist/components/avatar/avatar.types.d.ts +1 -1
- package/dist/components/avatar/avatar.utils.d.ts +1 -1
- package/dist/components/avatar/avatar.utils.js +1 -1
- package/dist/components/avatarbutton/avatarbutton.component.d.ts +2 -2
- package/dist/components/avatarbutton/avatarbutton.component.js +2 -2
- package/dist/components/avatarbutton/avatarbutton.styles.js +34 -30
- package/dist/components/badge/badge.styles.js +9 -7
- package/dist/components/brandvisual/brandvisual.component.js +4 -4
- package/dist/components/bullet/bullet.component.d.ts +1 -1
- package/dist/components/bullet/bullet.component.js +2 -2
- package/dist/components/bullet/bullet.styles.js +3 -3
- package/dist/components/button/button.component.js +10 -4
- package/dist/components/button/button.utils.js +1 -1
- package/dist/components/buttongroup/buttongroup.component.js +1 -1
- package/dist/components/buttongroup/buttongroup.styles.js +68 -68
- package/dist/components/buttonlink/buttonlink.component.d.ts +5 -5
- package/dist/components/buttonlink/buttonlink.component.js +9 -9
- package/dist/components/buttonsimple/buttonsimple.component.js +2 -2
- package/dist/components/buttonsimple/buttonsimple.constants.d.ts +1 -1
- package/dist/components/buttonsimple/buttonsimple.constants.js +1 -1
- package/dist/components/buttonsimple/buttonsimple.styles.js +62 -57
- package/dist/components/card/card.component.d.ts +6 -6
- package/dist/components/card/card.component.js +15 -16
- package/dist/components/card/card.styles.js +24 -22
- package/dist/components/cardbutton/cardbutton.component.js +9 -12
- package/dist/components/cardbutton/cardbutton.styles.js +1 -1
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +6 -6
- package/dist/components/cardcheckbox/cardcheckbox.component.js +30 -29
- package/dist/components/cardcheckbox/cardcheckbox.styles.js +10 -10
- package/dist/components/cardradio/cardradio.component.d.ts +12 -12
- package/dist/components/cardradio/cardradio.component.js +27 -30
- package/dist/components/cardradio/cardradio.styles.js +8 -8
- package/dist/components/checkbox/checkbox.component.js +7 -9
- package/dist/components/checkbox/checkbox.styles.js +62 -60
- package/dist/components/chip/chip.component.d.ts +1 -1
- package/dist/components/chip/chip.component.js +6 -11
- package/dist/components/chip/chip.styles.js +4 -2
- package/dist/components/dialog/dialog.component.d.ts +7 -2
- package/dist/components/dialog/dialog.component.js +43 -33
- package/dist/components/dialog/dialog.constants.d.ts +1 -0
- package/dist/components/dialog/dialog.constants.js +1 -0
- package/dist/components/dialog/dialog.styles.js +10 -12
- package/dist/components/divider/divider.component.js +6 -8
- package/dist/components/divider/divider.constants.d.ts +1 -1
- package/dist/components/divider/divider.constants.js +1 -1
- package/dist/components/divider/divider.styles.js +5 -20
- package/dist/components/filterchip/filterchip.styles.js +4 -2
- package/dist/components/formfieldgroup/formfieldgroup.component.js +1 -4
- package/dist/components/formfieldgroup/formfieldgroup.styles.js +1 -2
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +19 -17
- package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +2 -1
- package/dist/components/formfieldwrapper/formfieldwrapper.subcomponent.js +4 -4
- package/dist/components/icon/icon.component.js +7 -7
- package/dist/components/icon/icon.utils.d.ts +1 -1
- package/dist/components/icon/icon.utils.js +7 -7
- package/dist/components/iconprovider/iconprovider.component.js +7 -7
- package/dist/components/input/input.component.d.ts +5 -5
- package/dist/components/input/input.component.js +64 -62
- package/dist/components/input/input.styles.js +128 -117
- package/dist/components/inputchip/inputchip.component.js +14 -19
- package/dist/components/inputchip/inputchip.styles.js +5 -3
- package/dist/components/link/link.component.d.ts +1 -1
- package/dist/components/link/link.component.js +4 -8
- package/dist/components/link/link.constants.d.ts +1 -1
- package/dist/components/link/link.constants.js +1 -1
- package/dist/components/link/link.styles.js +12 -12
- package/dist/components/linksimple/linksimple.component.js +2 -4
- package/dist/components/linksimple/linksimple.styles.js +59 -57
- package/dist/components/list/list.component.js +12 -9
- package/dist/components/listitem/listitem.component.js +15 -11
- package/dist/components/listitem/listitem.styles.js +11 -6
- package/dist/components/marker/marker.component.js +1 -1
- package/dist/components/marker/marker.styles.js +2 -2
- package/dist/components/menubar/menubar.component.d.ts +19 -19
- package/dist/components/menubar/menubar.component.js +19 -19
- package/dist/components/menuitem/menuitem.component.js +15 -15
- package/dist/components/menuitem/menuitem.styles.js +3 -2
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +1 -1
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +4 -11
- package/dist/components/menuitemradio/menuitemradio.component.js +1 -1
- package/dist/components/menupopover/menupopover.component.js +11 -11
- package/dist/components/menupopover/menupopover.utils.d.ts +1 -1
- package/dist/components/menupopover/menupopover.utils.js +3 -8
- package/dist/components/navitem/navitem.component.js +11 -19
- package/dist/components/navitem/navitem.styles.js +147 -143
- package/dist/components/navitemlist/navitemlist.component.js +2 -2
- package/dist/components/optgroup/optgroup.component.js +12 -9
- package/dist/components/option/option.component.js +11 -11
- package/dist/components/option/option.styles.js +1 -1
- package/dist/components/popover/popover.component.js +4 -4
- package/dist/components/popover/popover.stack.js +1 -1
- package/dist/components/popover/popover.styles.js +0 -1
- package/dist/components/popover/popover.utils.js +3 -4
- package/dist/components/presence/presence.component.d.ts +4 -4
- package/dist/components/presence/presence.component.js +4 -4
- package/dist/components/progressbar/progressbar.component.js +3 -4
- package/dist/components/progressbar/progressbar.styles.js +77 -71
- package/dist/components/progressspinner/progressspiner.utils.js +4 -4
- package/dist/components/progressspinner/progressspinner.component.js +38 -37
- package/dist/components/progressspinner/progressspinner.styles.js +1 -1
- package/dist/components/radio/radio.component.d.ts +41 -41
- package/dist/components/radio/radio.component.js +84 -83
- package/dist/components/radio/radio.styles.js +77 -75
- package/dist/components/radiogroup/radiogroup.component.js +1 -1
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +2 -2
- package/dist/components/screenreaderannouncer/screenreaderannouncer.styles.js +8 -6
- package/dist/components/searchfield/searchfield.component.js +23 -17
- package/dist/components/searchfield/searchfield.styles.js +11 -13
- package/dist/components/select/select.component.js +20 -23
- package/dist/components/select/select.styles.js +9 -9
- package/dist/components/sidenavigation/sidenavigation.component.d.ts +6 -6
- package/dist/components/sidenavigation/sidenavigation.component.js +39 -29
- package/dist/components/sidenavigation/sidenavigation.context.js +5 -5
- package/dist/components/sidenavigation/sidenavigation.styles.js +53 -53
- package/dist/components/skeleton/skeleton.component.js +1 -4
- package/dist/components/skeleton/skeleton.constants.d.ts +1 -1
- package/dist/components/skeleton/skeleton.constants.js +1 -1
- package/dist/components/skeleton/skeleton.styles.js +4 -4
- package/dist/components/spinner/spinner.component.d.ts +7 -7
- package/dist/components/spinner/spinner.component.js +9 -9
- package/dist/components/spinner/spinner.styles.js +58 -53
- package/dist/components/staticcheckbox/staticcheckbox.component.js +10 -8
- package/dist/components/staticcheckbox/staticcheckbox.styles.js +52 -51
- package/dist/components/staticradio/staticradio.component.d.ts +8 -8
- package/dist/components/staticradio/staticradio.component.js +10 -11
- package/dist/components/staticradio/staticradio.styles.js +77 -75
- package/dist/components/statictoggle/statictoggle.component.d.ts +3 -3
- package/dist/components/statictoggle/statictoggle.component.js +3 -3
- package/dist/components/statictoggle/statictoggle.styles.js +71 -68
- package/dist/components/tab/tab.component.d.ts +1 -1
- package/dist/components/tab/tab.component.js +2 -2
- package/dist/components/tab/tab.styles.js +247 -245
- package/dist/components/tablist/tablist.component.js +11 -15
- package/dist/components/tablist/tablist.styles.js +27 -25
- package/dist/components/tablist/tablist.types.d.ts +1 -1
- package/dist/components/tablist/tablist.utils.js +4 -4
- package/dist/components/text/fonts.styles.js +49 -49
- package/dist/components/text/text.component.js +21 -11
- package/dist/components/text/text.types.d.ts +1 -1
- package/dist/components/textarea/textarea.component.d.ts +31 -31
- package/dist/components/textarea/textarea.component.js +54 -61
- package/dist/components/textarea/textarea.styles.js +123 -122
- package/dist/components/themeprovider/themeprovider.component.js +1 -1
- package/dist/components/themeprovider/themeprovider.styles.js +4 -4
- package/dist/components/toggle/toggle.component.d.ts +35 -35
- package/dist/components/toggle/toggle.component.js +62 -63
- package/dist/components/toggle/toggle.styles.js +77 -69
- package/dist/components/toggletip/toggletip.component.d.ts +7 -7
- package/dist/components/toggletip/toggletip.component.js +3 -2
- package/dist/components/tooltip/tooltip.component.js +1 -1
- package/dist/components/tooltip/tooltip.styles.js +0 -1
- package/dist/components/virtualizedlist/virtualizedlist.component.js +6 -14
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.d.ts +1 -1
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +14 -11
- package/dist/components/virtualizedlist/virtualizedlist.styles.js +4 -4
- package/dist/custom-elements.json +239 -228
- package/dist/index.js +1 -0
- package/dist/models/component/index.d.ts +1 -1
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +1 -1
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +3 -3
- package/dist/utils/mixins/ButtonComponentMixin.js +10 -10
- package/dist/utils/mixins/CardAndDialogFooterMixin.js +21 -22
- package/dist/utils/mixins/FocusTrapMixin.js +15 -12
- package/dist/utils/mixins/IconNameMixin.d.ts +1 -1
- package/dist/utils/mixins/MenuMixin.js +23 -23
- package/dist/utils/mixins/PreventScrollMixin.d.ts +1 -1
- package/dist/utils/styles/index.js +12 -12
- package/package.json +1 -1
@@ -6,83 +6,85 @@ const styles = css `
|
|
6
6
|
border-radius: 0.5rem;
|
7
7
|
border: 1px solid var(--mds-color-theme-outline-primary-normal);
|
8
8
|
box-shadow: none;
|
9
|
-
|
9
|
+
transition: box-shadow 0.2s;
|
10
10
|
}
|
11
|
-
:host([variant='ghost']){
|
11
|
+
:host([variant='ghost']) {
|
12
12
|
border-color: transparent;
|
13
13
|
}
|
14
|
-
:host([orientation=
|
14
|
+
:host([orientation='horizontal']) {
|
15
15
|
max-width: 40rem;
|
16
16
|
}
|
17
17
|
|
18
|
-
:host([orientation=
|
18
|
+
:host([orientation='vertical']) {
|
19
19
|
max-width: 20rem;
|
20
20
|
flex-direction: column;
|
21
21
|
}
|
22
|
-
|
23
|
-
:host([orientation=
|
22
|
+
|
23
|
+
:host([orientation='vertical'])::part(image) {
|
24
24
|
height: 12.5rem;
|
25
25
|
width: 100%;
|
26
26
|
border-top-left-radius: 0.5rem;
|
27
27
|
border-top-right-radius: 0.5rem;
|
28
28
|
}
|
29
|
-
|
30
|
-
:host([orientation=
|
29
|
+
|
30
|
+
:host([orientation='horizontal'])::part(image) {
|
31
31
|
width: 10rem;
|
32
32
|
height: 100%;
|
33
33
|
border-top-left-radius: 0.5rem;
|
34
34
|
border-bottom-left-radius: 0.5rem;
|
35
35
|
}
|
36
36
|
|
37
|
-
:host::part(header){
|
37
|
+
:host::part(header) {
|
38
38
|
display: flex;
|
39
39
|
gap: 0.5rem;
|
40
40
|
}
|
41
41
|
|
42
|
-
:host::part(icon){
|
42
|
+
:host::part(icon) {
|
43
43
|
margin-top: 0.25rem;
|
44
44
|
}
|
45
45
|
|
46
|
-
:host::part(body){
|
46
|
+
:host::part(body) {
|
47
47
|
width: 100%;
|
48
48
|
padding: 1.5rem;
|
49
49
|
display: flex;
|
50
50
|
flex-direction: column;
|
51
51
|
}
|
52
52
|
|
53
|
-
::slotted([slot='body']){
|
53
|
+
::slotted([slot='body']) {
|
54
54
|
padding-bottom: 0.5rem;
|
55
55
|
margin-top: 0.75rem;
|
56
56
|
}
|
57
57
|
|
58
|
-
:host([variant='promotional']){
|
58
|
+
:host([variant='promotional']) {
|
59
59
|
border-color: var(--mds-color-theme-outline-promotion-normal);
|
60
60
|
}
|
61
61
|
|
62
|
-
:host(:dir(ltr))::part(icon-button),
|
62
|
+
:host(:dir(ltr))::part(icon-button),
|
63
|
+
:host(:dir(ltr))::part(footer) {
|
63
64
|
margin-left: auto;
|
64
65
|
}
|
65
66
|
|
66
|
-
:host(:dir(rtl))::part(icon-button),
|
67
|
+
:host(:dir(rtl))::part(icon-button),
|
68
|
+
:host(:dir(rtl))::part(footer) {
|
67
69
|
margin-right: auto;
|
68
70
|
}
|
69
71
|
|
70
|
-
:host::part(icon-button),
|
72
|
+
:host::part(icon-button),
|
73
|
+
:host::part(footer) {
|
71
74
|
display: flex;
|
72
75
|
gap: 0.5rem;
|
73
76
|
align-items: center;
|
74
77
|
justify-content: center;
|
75
78
|
}
|
76
79
|
|
77
|
-
:host::part(footer){
|
80
|
+
:host::part(footer) {
|
78
81
|
gap: 1rem;
|
79
82
|
}
|
80
|
-
|
81
|
-
::slotted([slot='footer-link']),
|
82
|
-
::slotted([slot='footer-button-primary']),
|
83
|
-
::slotted([slot='footer-button-secondary']){
|
83
|
+
|
84
|
+
::slotted([slot='footer-link']),
|
85
|
+
::slotted([slot='footer-button-primary']),
|
86
|
+
::slotted([slot='footer-button-secondary']) {
|
84
87
|
margin-bottom: 0.5rem;
|
85
88
|
}
|
86
|
-
|
87
89
|
`;
|
88
90
|
export default [hostFitContentStyles, styles];
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { html, nothing } from 'lit';
|
2
|
-
import styles from './cardbutton.styles';
|
3
2
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
4
3
|
import Card from '../card/card.component';
|
5
4
|
import { CardComponentMixin } from '../../utils/mixins/CardComponentMixin';
|
5
|
+
import styles from './cardbutton.styles';
|
6
6
|
/**
|
7
7
|
* cardbutton component looks like a card and behaves as a button component.
|
8
8
|
*
|
@@ -40,21 +40,18 @@ class CardButton extends CardComponentMixin(Buttonsimple) {
|
|
40
40
|
if (!this.cardTitle) {
|
41
41
|
return nothing;
|
42
42
|
}
|
43
|
-
return html `<div part="header"
|
44
|
-
${this.renderIcon()}
|
45
|
-
${this.renderTitle()}
|
46
|
-
</div>`;
|
43
|
+
return html `<div part="header">${this.renderIcon()} ${this.renderTitle()}</div>`;
|
47
44
|
}
|
48
45
|
render() {
|
49
46
|
return html `
|
50
47
|
${this.renderImage()}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
<div part="body">
|
49
|
+
${this.renderHeader()}
|
50
|
+
<slot name="before-body"></slot>
|
51
|
+
<slot name="body"></slot>
|
52
|
+
<slot name="after-body"></slot>
|
53
|
+
</div>
|
54
|
+
`;
|
58
55
|
}
|
59
56
|
}
|
60
57
|
CardButton.styles = [...Card.styles, ...styles];
|
@@ -34,14 +34,14 @@ declare const CardCheckbox_base: import("../../utils/mixins/index.types").Constr
|
|
34
34
|
*/
|
35
35
|
declare class CardCheckbox extends CardCheckbox_base {
|
36
36
|
/**
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
* The checked state of the card
|
38
|
+
* @default false
|
39
|
+
*/
|
40
40
|
checked: boolean;
|
41
41
|
/**
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
* The selection type of the card. It can either be set to 'check' or 'checkbox'
|
43
|
+
* @default 'check'
|
44
|
+
*/
|
45
45
|
selectionType: SelectionType;
|
46
46
|
constructor();
|
47
47
|
connectedCallback(): void;
|
@@ -9,12 +9,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
};
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
|
-
import styles from './cardcheckbox.styles';
|
13
12
|
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
14
13
|
import { TabIndexMixin } from '../../utils/mixins/TabIndexMixin';
|
15
14
|
import Card from '../card/card.component';
|
16
|
-
import { CHECK_MARK, DEFAULTS, SELECTION_TYPE } from './cardcheckbox.constants';
|
17
15
|
import { ROLE } from '../../utils/roles';
|
16
|
+
import { CHECK_MARK, DEFAULTS, SELECTION_TYPE } from './cardcheckbox.constants';
|
17
|
+
import styles from './cardcheckbox.styles';
|
18
18
|
/**
|
19
19
|
* cardcheckbox component extends `mdc-card` and supports checkbox selection interaction addtionally.
|
20
20
|
*
|
@@ -49,14 +49,14 @@ class CardCheckbox extends DisabledMixin(TabIndexMixin(Card)) {
|
|
49
49
|
constructor() {
|
50
50
|
super();
|
51
51
|
/**
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
* The checked state of the card
|
53
|
+
* @default false
|
54
|
+
*/
|
55
55
|
this.checked = false;
|
56
56
|
/**
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
* The selection type of the card. It can either be set to 'check' or 'checkbox'
|
58
|
+
* @default 'check'
|
59
|
+
*/
|
60
60
|
this.selectionType = DEFAULTS.SELECTION_TYPE;
|
61
61
|
this.addEventListener('click', this.toggleChecked);
|
62
62
|
this.addEventListener('keydown', this.toggleOnEnter);
|
@@ -110,17 +110,22 @@ class CardCheckbox extends DisabledMixin(TabIndexMixin(Card)) {
|
|
110
110
|
const ICON_NAME = this.checked ? CHECK_MARK.CHECKED : CHECK_MARK.DEFAULT;
|
111
111
|
switch (this.selectionType) {
|
112
112
|
case SELECTION_TYPE.CHECK: {
|
113
|
-
return html `<mdc-icon
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
return html `<mdc-icon
|
114
|
+
part="check check-icon"
|
115
|
+
size="${DEFAULTS.ICON_SIZE}"
|
116
|
+
length-unit="${DEFAULTS.ICON_LENGTH_UNIT}"
|
117
|
+
name="${ICON_NAME}"
|
118
|
+
></mdc-icon>`;
|
117
119
|
}
|
118
120
|
case SELECTION_TYPE.CHECKBOX: {
|
119
|
-
return html `<mdc-staticcheckbox
|
120
|
-
|
121
|
-
|
121
|
+
return html `<mdc-staticcheckbox
|
122
|
+
part="check"
|
123
|
+
?checked="${this.checked}"
|
124
|
+
?disabled="${this.disabled}"
|
125
|
+
></mdc-staticcheckbox>`;
|
122
126
|
}
|
123
|
-
default:
|
127
|
+
default:
|
128
|
+
return nothing;
|
124
129
|
}
|
125
130
|
}
|
126
131
|
/**
|
@@ -131,22 +136,18 @@ class CardCheckbox extends DisabledMixin(TabIndexMixin(Card)) {
|
|
131
136
|
if (!this.cardTitle) {
|
132
137
|
return nothing;
|
133
138
|
}
|
134
|
-
return html `<div part="header"
|
135
|
-
${this.renderIcon()}
|
136
|
-
${this.renderTitle()}
|
137
|
-
${this.renderSelection()}
|
138
|
-
</div>`;
|
139
|
+
return html `<div part="header">${this.renderIcon()} ${this.renderTitle()} ${this.renderSelection()}</div>`;
|
139
140
|
}
|
140
141
|
render() {
|
141
142
|
return html `
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
143
|
+
${this.renderImage()}
|
144
|
+
<div part="body">
|
145
|
+
${this.renderHeader()}
|
146
|
+
<slot name="before-body"></slot>
|
147
|
+
<slot name="body"></slot>
|
148
|
+
<slot name="after-body"></slot>
|
149
|
+
</div>
|
150
|
+
`;
|
150
151
|
}
|
151
152
|
}
|
152
153
|
CardCheckbox.styles = [...Card.styles, ...styles];
|
@@ -6,11 +6,11 @@ const styles = css `
|
|
6
6
|
user-select: none;
|
7
7
|
}
|
8
8
|
|
9
|
-
:host(:dir(ltr))::part(check){
|
9
|
+
:host(:dir(ltr))::part(check) {
|
10
10
|
margin-left: auto;
|
11
11
|
}
|
12
12
|
|
13
|
-
:host(:dir(rtl))::part(check){
|
13
|
+
:host(:dir(rtl))::part(check) {
|
14
14
|
margin-right: auto;
|
15
15
|
}
|
16
16
|
|
@@ -22,25 +22,25 @@ const styles = css `
|
|
22
22
|
background-color: var(--mds-color-theme-background-primary-active);
|
23
23
|
}
|
24
24
|
|
25
|
-
:host([checked]){
|
25
|
+
:host([checked]) {
|
26
26
|
border: 1px solid var(--mds-color-theme-outline-input-active);
|
27
27
|
box-shadow: 0 0 0 1px var(--mds-color-theme-outline-input-active);
|
28
28
|
background-color: var(--mds-color-theme-background-primary-active);
|
29
29
|
}
|
30
30
|
|
31
|
-
:host([checked]:hover){
|
31
|
+
:host([checked]:hover) {
|
32
32
|
background-color: var(--mds-color-theme-background-primary-hover);
|
33
33
|
}
|
34
34
|
|
35
|
-
:host([checked]:active){
|
35
|
+
:host([checked]:active) {
|
36
36
|
background-color: var(--mds-color-theme-background-primary-ghost);
|
37
37
|
}
|
38
38
|
|
39
|
-
:host::part(check-icon){
|
39
|
+
:host::part(check-icon) {
|
40
40
|
color: var(--mds-color-theme-text-secondary-normal);
|
41
41
|
}
|
42
42
|
|
43
|
-
:host([checked])::part(check-icon){
|
43
|
+
:host([checked])::part(check-icon) {
|
44
44
|
color: var(--mds-color-theme-text-accent-normal);
|
45
45
|
}
|
46
46
|
|
@@ -50,11 +50,11 @@ const styles = css `
|
|
50
50
|
border-color: var(--mds-color-theme-outline-primary-disabled);
|
51
51
|
}
|
52
52
|
|
53
|
-
:host([disabled])::part(image){
|
53
|
+
:host([disabled])::part(image) {
|
54
54
|
opacity: 0.5;
|
55
55
|
}
|
56
|
-
|
57
|
-
:host([disabled])::part(check-icon){
|
56
|
+
|
57
|
+
:host([disabled])::part(check-icon) {
|
58
58
|
color: var(--mds-color-theme-text-primary-disabled);
|
59
59
|
}
|
60
60
|
`;
|
@@ -33,26 +33,26 @@ declare const CardRadio_base: import("../../utils/mixins/index.types").Construct
|
|
33
33
|
*/
|
34
34
|
declare class CardRadio extends CardRadio_base {
|
35
35
|
/**
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
* The checked state of the card
|
37
|
+
* @default false
|
38
|
+
*/
|
39
39
|
checked: boolean;
|
40
40
|
/**
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
* The name of the radio.
|
42
|
+
* @default ''
|
43
|
+
*/
|
44
44
|
name: string;
|
45
45
|
constructor();
|
46
46
|
connectedCallback(): void;
|
47
47
|
/**
|
48
|
-
|
49
|
-
|
48
|
+
* Returns all cards within the same group (name).
|
49
|
+
*/
|
50
50
|
private getAllCardsWithinSameGroup;
|
51
51
|
/**
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
* Handles the change event on the radio element.
|
53
|
+
* This will toggle the state of the radio element.
|
54
|
+
* Dispatches the change event.
|
55
|
+
*/
|
56
56
|
private toggleChecked;
|
57
57
|
setDisabled(disabled: boolean): void;
|
58
58
|
update(changedProperties: PropertyValues<CardRadio>): void;
|
@@ -10,11 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
/* eslint-disable no-param-reassign */
|
11
11
|
import { html, nothing } from 'lit';
|
12
12
|
import { property } from 'lit/decorators.js';
|
13
|
-
import styles from './cardradio.styles';
|
14
13
|
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
15
14
|
import { TabIndexMixin } from '../../utils/mixins/TabIndexMixin';
|
16
15
|
import Card from '../card/card.component';
|
17
16
|
import { ROLE } from '../../utils/roles';
|
17
|
+
import styles from './cardradio.styles';
|
18
18
|
/**
|
19
19
|
* cardradio component extends `mdc-card` and supports radio selection interaction addtionally.
|
20
20
|
*
|
@@ -49,14 +49,14 @@ class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
49
49
|
constructor() {
|
50
50
|
super();
|
51
51
|
/**
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
* The checked state of the card
|
53
|
+
* @default false
|
54
|
+
*/
|
55
55
|
this.checked = false;
|
56
56
|
/**
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
* The name of the radio.
|
58
|
+
* @default ''
|
59
|
+
*/
|
60
60
|
this.name = '';
|
61
61
|
this.addEventListener('click', this.toggleChecked);
|
62
62
|
this.addEventListener('keydown', this.toggleOnEnter);
|
@@ -67,24 +67,24 @@ class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
67
67
|
this.role = ROLE.RADIO;
|
68
68
|
}
|
69
69
|
/**
|
70
|
-
|
71
|
-
|
70
|
+
* Returns all cards within the same group (name).
|
71
|
+
*/
|
72
72
|
getAllCardsWithinSameGroup() {
|
73
73
|
return Array.from(document.querySelectorAll(`mdc-cardradio[name="${this.name}"]`));
|
74
74
|
}
|
75
75
|
/**
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
* Handles the change event on the radio element.
|
77
|
+
* This will toggle the state of the radio element.
|
78
|
+
* Dispatches the change event.
|
79
|
+
*/
|
80
80
|
toggleChecked() {
|
81
81
|
if (this.disabled)
|
82
82
|
return;
|
83
83
|
const cards = this.getAllCardsWithinSameGroup();
|
84
|
-
cards.forEach(
|
84
|
+
cards.forEach(card => {
|
85
85
|
/**
|
86
86
|
* Uncheck all cards in the same group (name)
|
87
|
-
|
87
|
+
*/
|
88
88
|
card.checked = false;
|
89
89
|
});
|
90
90
|
this.checked = true;
|
@@ -114,7 +114,7 @@ class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
114
114
|
if (this.disabled)
|
115
115
|
return;
|
116
116
|
const cards = this.getAllCardsWithinSameGroup();
|
117
|
-
const enabledCards = cards.filter(
|
117
|
+
const enabledCards = cards.filter(card => !card.disabled);
|
118
118
|
const currentIndex = enabledCards.indexOf(this);
|
119
119
|
if (['ArrowDown', 'ArrowRight'].includes(event.key)) {
|
120
120
|
// Move focus to the next radio
|
@@ -148,23 +148,20 @@ class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
148
148
|
return nothing;
|
149
149
|
}
|
150
150
|
return html `<div part="header">
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
?checked="${this.checked}"
|
155
|
-
?disabled="${this.disabled}"></mdc-staticradio>
|
156
|
-
</div>`;
|
151
|
+
${this.renderIcon()} ${this.renderTitle()}
|
152
|
+
<mdc-staticradio part="check" ?checked="${this.checked}" ?disabled="${this.disabled}"></mdc-staticradio>
|
153
|
+
</div>`;
|
157
154
|
}
|
158
155
|
render() {
|
159
156
|
return html `
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
157
|
+
${this.renderImage()}
|
158
|
+
<div part="body">
|
159
|
+
${this.renderHeader()}
|
160
|
+
<slot name="before-body"></slot>
|
161
|
+
<slot name="body"></slot>
|
162
|
+
<slot name="after-body"></slot>
|
163
|
+
</div>
|
164
|
+
`;
|
168
165
|
}
|
169
166
|
}
|
170
167
|
CardRadio.styles = [...Card.styles, ...styles];
|
@@ -6,11 +6,11 @@ const styles = css `
|
|
6
6
|
user-select: none;
|
7
7
|
}
|
8
8
|
|
9
|
-
:host(:dir(ltr))::part(check){
|
9
|
+
:host(:dir(ltr))::part(check) {
|
10
10
|
margin-left: auto;
|
11
11
|
}
|
12
12
|
|
13
|
-
:host(:dir(rtl))::part(check){
|
13
|
+
:host(:dir(rtl))::part(check) {
|
14
14
|
margin-right: auto;
|
15
15
|
}
|
16
16
|
|
@@ -22,25 +22,25 @@ const styles = css `
|
|
22
22
|
background-color: var(--mds-color-theme-background-primary-active);
|
23
23
|
}
|
24
24
|
|
25
|
-
:host([checked]){
|
25
|
+
:host([checked]) {
|
26
26
|
border: 1px solid var(--mds-color-theme-outline-input-active);
|
27
27
|
box-shadow: 0 0 0 1px var(--mds-color-theme-outline-input-active);
|
28
28
|
background-color: var(--mds-color-theme-background-primary-active);
|
29
29
|
}
|
30
30
|
|
31
|
-
:host([checked]:hover){
|
31
|
+
:host([checked]:hover) {
|
32
32
|
background-color: var(--mds-color-theme-background-primary-hover);
|
33
33
|
}
|
34
34
|
|
35
|
-
:host([checked]:active){
|
35
|
+
:host([checked]:active) {
|
36
36
|
background-color: var(--mds-color-theme-background-primary-ghost);
|
37
37
|
}
|
38
38
|
|
39
|
-
:host::part(check-icon){
|
39
|
+
:host::part(check-icon) {
|
40
40
|
color: var(--mds-color-theme-text-secondary-normal);
|
41
41
|
}
|
42
42
|
|
43
|
-
:host([checked])::part(check-icon){
|
43
|
+
:host([checked])::part(check-icon) {
|
44
44
|
color: var(--mds-color-theme-text-accent-normal);
|
45
45
|
}
|
46
46
|
|
@@ -50,7 +50,7 @@ const styles = css `
|
|
50
50
|
border-color: var(--mds-color-theme-outline-primary-disabled);
|
51
51
|
}
|
52
52
|
|
53
|
-
:host([disabled])::part(image){
|
53
|
+
:host([disabled])::part(image) {
|
54
54
|
opacity: 0.5;
|
55
55
|
}
|
56
56
|
`;
|
@@ -66,10 +66,7 @@ class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
66
66
|
this.renderLabelAndHelperText = () => {
|
67
67
|
if (!this.label)
|
68
68
|
return nothing;
|
69
|
-
return html `<div class="text-container"
|
70
|
-
${this.renderLabel()}
|
71
|
-
${this.renderHelperText()}
|
72
|
-
</div>`;
|
69
|
+
return html `<div class="text-container">${this.renderLabel()} ${this.renderHelperText()}</div>`;
|
73
70
|
};
|
74
71
|
}
|
75
72
|
connectedCallback() {
|
@@ -165,11 +162,12 @@ class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
165
162
|
render() {
|
166
163
|
var _a;
|
167
164
|
return html `
|
168
|
-
<mdc-staticcheckbox
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
165
|
+
<mdc-staticcheckbox
|
166
|
+
class="mdc-focus-ring"
|
167
|
+
?checked="${this.checked}"
|
168
|
+
?indeterminate="${this.indeterminate}"
|
169
|
+
?disabled="${this.disabled}"
|
170
|
+
>
|
173
171
|
<input
|
174
172
|
id="${this.id}"
|
175
173
|
type="checkbox"
|