@momentum-design/components 0.53.8 → 0.54.0
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 +433 -406
- package/dist/browser/index.js.map +4 -4
- package/dist/components/checkbox/checkbox.component.d.ts +1 -9
- package/dist/components/checkbox/checkbox.component.js +7 -21
- package/dist/components/checkbox/checkbox.styles.js +30 -67
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/link/link.component.d.ts +29 -18
- package/dist/components/link/link.component.js +67 -39
- package/dist/components/link/link.styles.js +34 -48
- package/dist/components/link/link.types.d.ts +7 -1
- package/dist/components/radio/index.d.ts +1 -0
- package/dist/components/radio/index.js +1 -0
- package/dist/components/radio/radio.component.d.ts +3 -11
- package/dist/components/radio/radio.component.js +10 -16
- package/dist/components/radio/radio.styles.js +36 -111
- package/dist/components/staticcheckbox/index.d.ts +8 -0
- package/dist/components/staticcheckbox/index.js +5 -0
- package/dist/components/staticcheckbox/staticcheckbox.component.d.ts +42 -0
- package/dist/components/staticcheckbox/staticcheckbox.component.js +76 -0
- package/dist/components/staticcheckbox/staticcheckbox.constants.d.ts +3 -0
- package/dist/components/staticcheckbox/staticcheckbox.constants.js +4 -0
- package/dist/components/staticcheckbox/staticcheckbox.styles.d.ts +2 -0
- package/dist/components/staticcheckbox/staticcheckbox.styles.js +60 -0
- package/dist/components/staticradio/index.d.ts +7 -0
- package/dist/components/staticradio/index.js +4 -0
- package/dist/components/staticradio/staticradio.component.d.ts +41 -0
- package/dist/components/staticradio/staticradio.component.js +67 -0
- package/dist/components/staticradio/staticradio.constants.d.ts +2 -0
- package/dist/components/staticradio/staticradio.constants.js +3 -0
- package/dist/components/staticradio/staticradio.styles.d.ts +2 -0
- package/dist/components/staticradio/staticradio.styles.js +86 -0
- package/dist/custom-elements.json +1838 -1491
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/react/checkbox/index.d.ts +1 -9
- package/dist/react/checkbox/index.js +1 -9
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.js +4 -2
- package/dist/react/link/index.d.ts +13 -3
- package/dist/react/link/index.js +12 -3
- package/dist/react/radio/index.d.ts +3 -11
- package/dist/react/radio/index.js +3 -11
- package/dist/react/staticcheckbox/index.d.ts +25 -0
- package/dist/react/staticcheckbox/index.js +34 -0
- package/dist/react/staticradio/index.d.ts +24 -0
- package/dist/react/staticradio/index.js +33 -0
- package/package.json +1 -1
@@ -14,22 +14,14 @@ declare const Radio_base: import("../../utils/mixins/index.types").Constructor<i
|
|
14
14
|
* @event change - (React: onChange) Event that gets dispatched when the radio state changes.
|
15
15
|
* @event focus - (React: onFocus) Event that gets dispatched when the radio receives focus.
|
16
16
|
*
|
17
|
-
* @cssproperty --mdc-radio-inner-circle-size - size of the inner circle
|
18
17
|
* @cssproperty --mdc-radio-text-disabled-color - color of the label when disabled
|
19
|
-
* @cssproperty --mdc-radio-disabled-border-color - color of the radio button border when disabled
|
20
|
-
* @cssproperty --mdc-radio-normal-border-color - color of the radio button border when normal
|
21
|
-
* @cssproperty --mdc-radio-inner-circle-normal-background - background color of the inner circle when normal
|
22
|
-
* @cssproperty --mdc-radio-inner-circle-disabled-background - background color of the inner circle when disabled
|
23
|
-
* @cssproperty --mdc-radio-control-inactive-color - color of the radio button when inactive
|
24
18
|
* @cssproperty --mdc-radio-control-inactive-hover - color of the radio button when inactive and hovered
|
25
19
|
* @cssproperty --mdc-radio-control-inactive-pressed-color - color of the radio button when inactive and pressed
|
26
|
-
* @cssproperty --mdc-radio-control-inactive-disabled-background - background color of the radio button when
|
27
|
-
* inactive and disabled
|
28
|
-
* @cssproperty --mdc-radio-control-active-color - color of the radio button when active
|
29
20
|
* @cssproperty --mdc-radio-control-active-hover-color - color of the radio button when active and hovered
|
30
21
|
* @cssproperty --mdc-radio-control-active-pressed-color - color of the radio button when active and pressed
|
31
|
-
* @cssproperty --mdc-radio-
|
32
|
-
*
|
22
|
+
* @cssproperty --mdc-radio-disabled-border-color - color of the radio button when disabled
|
23
|
+
* @cssproperty --mdc-radio-control-active-disabled-background - color of the radio button when active and disabled
|
24
|
+
* @cssproperty --mdc-radio-control-inactive-disabled-background - color of the radio button when inactive and disabled
|
33
25
|
*
|
34
26
|
*/
|
35
27
|
declare class Radio extends Radio_base implements AssociatedFormControl {
|
@@ -28,22 +28,14 @@ import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwra
|
|
28
28
|
* @event change - (React: onChange) Event that gets dispatched when the radio state changes.
|
29
29
|
* @event focus - (React: onFocus) Event that gets dispatched when the radio receives focus.
|
30
30
|
*
|
31
|
-
* @cssproperty --mdc-radio-inner-circle-size - size of the inner circle
|
32
31
|
* @cssproperty --mdc-radio-text-disabled-color - color of the label when disabled
|
33
|
-
* @cssproperty --mdc-radio-disabled-border-color - color of the radio button border when disabled
|
34
|
-
* @cssproperty --mdc-radio-normal-border-color - color of the radio button border when normal
|
35
|
-
* @cssproperty --mdc-radio-inner-circle-normal-background - background color of the inner circle when normal
|
36
|
-
* @cssproperty --mdc-radio-inner-circle-disabled-background - background color of the inner circle when disabled
|
37
|
-
* @cssproperty --mdc-radio-control-inactive-color - color of the radio button when inactive
|
38
32
|
* @cssproperty --mdc-radio-control-inactive-hover - color of the radio button when inactive and hovered
|
39
33
|
* @cssproperty --mdc-radio-control-inactive-pressed-color - color of the radio button when inactive and pressed
|
40
|
-
* @cssproperty --mdc-radio-control-inactive-disabled-background - background color of the radio button when
|
41
|
-
* inactive and disabled
|
42
|
-
* @cssproperty --mdc-radio-control-active-color - color of the radio button when active
|
43
34
|
* @cssproperty --mdc-radio-control-active-hover-color - color of the radio button when active and hovered
|
44
35
|
* @cssproperty --mdc-radio-control-active-pressed-color - color of the radio button when active and pressed
|
45
|
-
* @cssproperty --mdc-radio-
|
46
|
-
*
|
36
|
+
* @cssproperty --mdc-radio-disabled-border-color - color of the radio button when disabled
|
37
|
+
* @cssproperty --mdc-radio-control-active-disabled-background - color of the radio button when active and disabled
|
38
|
+
* @cssproperty --mdc-radio-control-inactive-disabled-background - color of the radio button when inactive and disabled
|
47
39
|
*
|
48
40
|
*/
|
49
41
|
class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
@@ -279,8 +271,12 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
279
271
|
render() {
|
280
272
|
var _a;
|
281
273
|
return html `
|
282
|
-
|
283
|
-
|
274
|
+
<mdc-staticradio
|
275
|
+
class="mdc-focus-ring"
|
276
|
+
?checked="${this.checked}"
|
277
|
+
?disabled="${this.disabled}"
|
278
|
+
?readonly="${this.readonly}"
|
279
|
+
>
|
284
280
|
<input
|
285
281
|
id="${this.id}"
|
286
282
|
type="radio"
|
@@ -299,10 +295,8 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
299
295
|
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
|
300
296
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
301
297
|
/>
|
302
|
-
|
303
|
-
</div>
|
298
|
+
</mdc-staticradio>
|
304
299
|
${this.renderLabelAndHelperText()}
|
305
|
-
</div>
|
306
300
|
`;
|
307
301
|
}
|
308
302
|
}
|
@@ -2,141 +2,72 @@ import { css } from 'lit';
|
|
2
2
|
import { hostFitContentStyles, hostFocusRingStyles } from '../../utils/styles';
|
3
3
|
const styles = [hostFitContentStyles, css `
|
4
4
|
:host{
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
--mdc-radio-inner-circle-normal-background: var(--mds-color-theme-inverted-text-primary-normal);
|
10
|
-
--mdc-radio-inner-circle-disabled-background: var(--mds-color-theme-inverted-text-primary-disabled);
|
5
|
+
display: flex;
|
6
|
+
flex-direction: row;
|
7
|
+
align-items: start;
|
8
|
+
gap: 0.5rem;
|
11
9
|
|
12
|
-
--mdc-radio-
|
10
|
+
--mdc-radio-text-disabled-color: var(--mds-color-theme-text-primary-disabled);
|
13
11
|
--mdc-radio-control-inactive-hover: var(--mds-color-theme-control-inactive-hover);
|
14
12
|
--mdc-radio-control-inactive-pressed-color: var(--mds-color-theme-control-inactive-pressed);
|
15
|
-
--mdc-radio-control-inactive-disabled-background: var(--mds-color-theme-control-inactive-disabled);
|
16
|
-
|
17
|
-
--mdc-radio-control-active-color: var(--mds-color-theme-control-active-normal);
|
18
13
|
--mdc-radio-control-active-hover-color: var(--mds-color-theme-control-active-hover);
|
19
14
|
--mdc-radio-control-active-pressed-color: var(--mds-color-theme-control-active-pressed);
|
20
15
|
--mdc-radio-control-active-disabled-background: var(--mds-color-theme-control-active-disabled);
|
21
|
-
|
22
|
-
|
23
|
-
:host([readonly]) .mdc-radio__input,
|
24
|
-
:host([disabled]) .mdc-radio__input,
|
25
|
-
:host([disabled]) .mdc-label,
|
26
|
-
:host([readonly]) .mdc-label{
|
27
|
-
cursor: default;
|
28
|
-
}
|
29
|
-
|
30
|
-
.mdc-label {
|
31
|
-
cursor: pointer;
|
32
|
-
}
|
33
|
-
|
34
|
-
:host([disabled]) .mdc-radio__label-text,
|
35
|
-
:host([disabled]) .mdc-radio__help-text {
|
36
|
-
color: var(--mdc-radio-text-disabled-color);
|
37
|
-
}
|
38
|
-
|
39
|
-
:host([disabled]) .mdc-radio__icon,
|
40
|
-
:host([disabled]) .mdc-radio__container:hover .mdc-radio__icon,
|
41
|
-
:host([disabled][readonly]) .mdc-radio__icon,
|
42
|
-
:host([disabled][readonly]) .mdc-radio__container:hover .mdc-radio__icon {
|
43
|
-
border-color: var(--mdc-radio-disabled-border-color);
|
44
|
-
background: var(--mdc-radio-control-inactive-disabled-background);
|
45
|
-
}
|
46
|
-
|
47
|
-
:host([disabled][checked]) .mdc-radio__icon,
|
48
|
-
:host([disabled][checked]) .mdc-radio__container:hover .mdc-radio__icon,
|
49
|
-
:host([disabled][readonly][checked]) .mdc-radio__icon,
|
50
|
-
:host([disabled][readonly][checked]) .mdc-radio__container:hover .mdc-radio__icon {
|
51
|
-
border: var(--mdc-radio-control-active-disabled-background);
|
52
|
-
background: var(--mdc-radio-control-active-disabled-background);
|
53
|
-
}
|
54
|
-
|
55
|
-
:host([disabled][checked]) .mdc-radio__icon:after,
|
56
|
-
:host([disabled][checked]) .mdc-radio__container:hover .mdc-radio__icon:after,
|
57
|
-
:host([disabled][readonly][checked]) .mdc-radio__icon:after,
|
58
|
-
:host([disabled][readonly][checked]) .mdc-radio__container:hover .mdc-radio__icon:after {
|
59
|
-
background: var(--mdc-radio-inner-circle-disabled-background);
|
60
|
-
}
|
61
|
-
|
62
|
-
:host .mdc-radio__icon {
|
63
|
-
position: absolute;
|
64
|
-
top: 0;
|
65
|
-
left: 0;
|
66
|
-
width: 1rem;
|
67
|
-
height: 1rem;
|
68
|
-
border: 0.0625rem solid var(--mdc-radio-normal-border-color);
|
69
|
-
background-color: var(--mdc-radio-control-inactive-color);
|
70
|
-
border-radius: 50%;
|
16
|
+
--mdc-radio-control-inactive-disabled-background: var(--mds-color-theme-control-inactive-disabled);
|
17
|
+
--mdc-radio-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
|
71
18
|
}
|
72
19
|
|
73
|
-
:host([checked]) .mdc-radio__icon {
|
74
|
-
border-color: var(--mdc-radio-control-active-color);
|
75
|
-
background-color: var(--mdc-radio-control-active-color);
|
76
|
-
}
|
77
20
|
|
78
|
-
:host(
|
79
|
-
|
80
|
-
top: 50%;
|
81
|
-
left: 50%;
|
82
|
-
transform: translate(-50%, -50%);
|
83
|
-
width: var(--mdc-radio-inner-circle-size);
|
84
|
-
height: var(--mdc-radio-inner-circle-size);
|
85
|
-
border-radius: 50%;
|
86
|
-
background: var(--mdc-radio-inner-circle-normal-background);
|
21
|
+
:host(:hover)::part(radio-icon) {
|
22
|
+
background-color: var(--mdc-radio-control-inactive-hover);
|
87
23
|
}
|
88
24
|
|
89
|
-
:host
|
90
|
-
|
91
|
-
background-color: var(--mdc-radio-control-inactive-hover);
|
25
|
+
:host(:active)::part(radio-icon) {
|
26
|
+
background-color: var(--mdc-radio-control-inactive-pressed-color);
|
92
27
|
}
|
93
28
|
|
94
|
-
:host([checked]
|
29
|
+
:host([checked]:hover)::part(radio-icon) {
|
95
30
|
border-color: var(--mdc-radio-control-active-hover-color);
|
96
31
|
background-color: var(--mdc-radio-control-active-hover-color);
|
97
32
|
}
|
98
33
|
|
99
|
-
:host
|
100
|
-
border-color: var(--mdc-radio-normal-border-color);
|
101
|
-
background-color: var(--mdc-radio-control-inactive-pressed-color);
|
102
|
-
}
|
103
|
-
|
104
|
-
:host([checked]) .mdc-radio__input:active ~ .mdc-radio__icon {
|
34
|
+
:host([checked]:active)::part(radio-icon) {
|
105
35
|
border-color: var(--mdc-radio-control-active-pressed-color);
|
106
36
|
background-color: var(--mdc-radio-control-active-pressed-color);
|
107
37
|
}
|
108
38
|
|
109
|
-
:host([readonly])
|
110
|
-
|
111
|
-
|
112
|
-
background-color: var(--mdc-radio-control-inactive-color);
|
39
|
+
:host([readonly]:hover)::part(radio-icon) {
|
40
|
+
border-color: var(--mdc-staticradio-normal-border-color);
|
41
|
+
background-color: var(--mdc-staticradio-control-inactive-color);
|
113
42
|
}
|
114
43
|
|
115
|
-
:host([
|
116
|
-
|
44
|
+
:host([disabled]:hover)::part(radio-icon),
|
45
|
+
:host([disabled][readonly]:hover)::part(radio-icon) {
|
46
|
+
border-color: var(--mdc-radio-disabled-border-color);
|
47
|
+
background-color: var(--mdc-radio-control-inactive-disabled-background);
|
117
48
|
}
|
118
49
|
|
119
|
-
:host([
|
120
|
-
|
121
|
-
:host([readonly][checked]) .mdc-radio__container:active .mdc-radio__icon:after {
|
122
|
-
background-color: var(--mdc-radio-text-disabled-color);
|
50
|
+
:host([disabled][checked]:hover)::part(radio-icon){
|
51
|
+
background-color: var(--mdc-radio-control-active-disabled-background);
|
123
52
|
}
|
124
53
|
|
125
|
-
.mdc-
|
126
|
-
|
127
|
-
|
128
|
-
|
54
|
+
:host([readonly]) .mdc-radio__input,
|
55
|
+
:host([disabled]) .mdc-radio__input,
|
56
|
+
:host([disabled]) .mdc-label,
|
57
|
+
:host([readonly]) .mdc-label{
|
58
|
+
cursor: default;
|
129
59
|
}
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
width: 1rem;
|
134
|
-
height: 1rem;
|
135
|
-
margin: 0.125rem 0;
|
136
|
-
border-radius: 50%;
|
60
|
+
|
61
|
+
.mdc-label {
|
62
|
+
cursor: pointer;
|
137
63
|
}
|
138
64
|
|
139
|
-
.mdc-
|
65
|
+
:host([disabled]) .mdc-radio__label-text,
|
66
|
+
:host([disabled]) .mdc-radio__help-text {
|
67
|
+
color: var(--mdc-radio-text-disabled-color);
|
68
|
+
}
|
69
|
+
|
70
|
+
.mdc-radio__input{
|
140
71
|
position: absolute;
|
141
72
|
opacity: 0;
|
142
73
|
margin: 0;
|
@@ -145,12 +76,6 @@ const styles = [hostFitContentStyles, css `
|
|
145
76
|
cursor: pointer;
|
146
77
|
z-index: 2;
|
147
78
|
}
|
148
|
-
|
149
|
-
.mdc-radio__icon-container .mdc-radio__icon:after {
|
150
|
-
content: "";
|
151
|
-
position: absolute;
|
152
|
-
display: none;
|
153
|
-
}
|
154
79
|
|
155
80
|
.mdc-radio__label-container{
|
156
81
|
display: flex;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { CSSResult } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
declare const StaticCheckbox_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
|
4
|
+
/**
|
5
|
+
* This is a decorative component that is styled to look as a checkbox.
|
6
|
+
*
|
7
|
+
* It has 3 properties - checked, indeterminate and disabled.
|
8
|
+
*
|
9
|
+
* We are using the same styling that has been created for the `mdc-checkbox` component.
|
10
|
+
*
|
11
|
+
* @tagname mdc-staticcheckbox
|
12
|
+
*
|
13
|
+
* @dependency mdc-icon
|
14
|
+
*
|
15
|
+
* @cssproperty --mdc-staticcheckbox-border-color - Border color in high contrast.
|
16
|
+
* @cssproperty --mdc-staticcheckbox-checked-background-color - Background color for a selected checkbox.
|
17
|
+
* @cssproperty --mdc-staticcheckbox-disabled-background-color - Background color for a disabled checkbox.
|
18
|
+
* @cssproperty --mdc-checkbox-disabled-border-color - Border color for a disabled checkbox.
|
19
|
+
* @cssproperty --mdc-checkbox-disabled-checked-icon-color - Background color for a disabled, selected checkbox.
|
20
|
+
* @cssproperty --mdc-staticcheckbox-disabled-icon-color - Icon color for a disabled checkbox.
|
21
|
+
* @cssproperty --mdc-staticcheckbox-icon-background-color - Background color for an unselected checkbox.
|
22
|
+
* @cssproperty --mdc-staticcheckbox-icon-border-color - Default background color for an unselected checkbox.
|
23
|
+
* @cssproperty --mdc-staticcheckbox-icon-color - Icon color for an unselected checkbox.
|
24
|
+
*
|
25
|
+
*/
|
26
|
+
declare class StaticCheckbox extends StaticCheckbox_base {
|
27
|
+
/**
|
28
|
+
* Determines whether the checkbox is selected or unselected.
|
29
|
+
*
|
30
|
+
* @default false
|
31
|
+
*/
|
32
|
+
checked: boolean;
|
33
|
+
/**
|
34
|
+
* Determines whether the checkbox is in an indeterminate state.
|
35
|
+
*
|
36
|
+
* @default false
|
37
|
+
*/
|
38
|
+
indeterminate: boolean;
|
39
|
+
render(): import("lit-html").TemplateResult<1>;
|
40
|
+
static styles: Array<CSSResult>;
|
41
|
+
}
|
42
|
+
export default StaticCheckbox;
|
@@ -0,0 +1,76 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { html, nothing } from 'lit';
|
11
|
+
import { property } from 'lit/decorators.js';
|
12
|
+
import { Component } from '../../models';
|
13
|
+
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
14
|
+
import styles from './staticcheckbox.styles';
|
15
|
+
import { ICON_NAME } from './staticcheckbox.constants';
|
16
|
+
/**
|
17
|
+
* This is a decorative component that is styled to look as a checkbox.
|
18
|
+
*
|
19
|
+
* It has 3 properties - checked, indeterminate and disabled.
|
20
|
+
*
|
21
|
+
* We are using the same styling that has been created for the `mdc-checkbox` component.
|
22
|
+
*
|
23
|
+
* @tagname mdc-staticcheckbox
|
24
|
+
*
|
25
|
+
* @dependency mdc-icon
|
26
|
+
*
|
27
|
+
* @cssproperty --mdc-staticcheckbox-border-color - Border color in high contrast.
|
28
|
+
* @cssproperty --mdc-staticcheckbox-checked-background-color - Background color for a selected checkbox.
|
29
|
+
* @cssproperty --mdc-staticcheckbox-disabled-background-color - Background color for a disabled checkbox.
|
30
|
+
* @cssproperty --mdc-checkbox-disabled-border-color - Border color for a disabled checkbox.
|
31
|
+
* @cssproperty --mdc-checkbox-disabled-checked-icon-color - Background color for a disabled, selected checkbox.
|
32
|
+
* @cssproperty --mdc-staticcheckbox-disabled-icon-color - Icon color for a disabled checkbox.
|
33
|
+
* @cssproperty --mdc-staticcheckbox-icon-background-color - Background color for an unselected checkbox.
|
34
|
+
* @cssproperty --mdc-staticcheckbox-icon-border-color - Default background color for an unselected checkbox.
|
35
|
+
* @cssproperty --mdc-staticcheckbox-icon-color - Icon color for an unselected checkbox.
|
36
|
+
*
|
37
|
+
*/
|
38
|
+
class StaticCheckbox extends DisabledMixin(Component) {
|
39
|
+
constructor() {
|
40
|
+
super(...arguments);
|
41
|
+
/**
|
42
|
+
* Determines whether the checkbox is selected or unselected.
|
43
|
+
*
|
44
|
+
* @default false
|
45
|
+
*/
|
46
|
+
this.checked = false;
|
47
|
+
/**
|
48
|
+
* Determines whether the checkbox is in an indeterminate state.
|
49
|
+
*
|
50
|
+
* @default false
|
51
|
+
*/
|
52
|
+
this.indeterminate = false;
|
53
|
+
}
|
54
|
+
render() {
|
55
|
+
const checkboxIconContent = (this.checked || this.indeterminate) ? html `
|
56
|
+
<mdc-icon
|
57
|
+
class="icon"
|
58
|
+
name="${this.indeterminate ? ICON_NAME.INDETERMINATE : ICON_NAME.CHECKED}"
|
59
|
+
size="1"
|
60
|
+
length-unit="rem"
|
61
|
+
></mdc-icon>
|
62
|
+
` : nothing;
|
63
|
+
return html `<slot></slot>
|
64
|
+
<div part="icon-container">${checkboxIconContent}</div>`;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
StaticCheckbox.styles = [...Component.styles, ...styles];
|
68
|
+
__decorate([
|
69
|
+
property({ type: Boolean, reflect: true }),
|
70
|
+
__metadata("design:type", Object)
|
71
|
+
], StaticCheckbox.prototype, "checked", void 0);
|
72
|
+
__decorate([
|
73
|
+
property({ type: Boolean, reflect: true }),
|
74
|
+
__metadata("design:type", Object)
|
75
|
+
], StaticCheckbox.prototype, "indeterminate", void 0);
|
76
|
+
export default StaticCheckbox;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
const styles = [css `
|
3
|
+
:host{
|
4
|
+
margin: 0.125rem 0;
|
5
|
+
border-radius: 0.125rem;
|
6
|
+
--mdc-staticcheckbox-border-color: var(--mds-color-theme-outline-button-normal);
|
7
|
+
--mdc-staticcheckbox-checked-background-color: var(--mds-color-theme-control-active-normal);
|
8
|
+
--mdc-staticcheckbox-disabled-background-color: var(--mds-color-theme-control-inactive-disabled);
|
9
|
+
--mdc-staticcheckbox-disabled-icon-color: var(--mds-color-theme-text-primary-disabled);
|
10
|
+
--mdc-staticcheckbox-icon-background-color: var(--mds-color-theme-control-inactive-normal);
|
11
|
+
--mdc-staticcheckbox-icon-border-color: var(--mds-color-theme-outline-input-normal);
|
12
|
+
--mdc-staticcheckbox-icon-color: var(--mds-color-theme-inverted-text-primary-normal);
|
13
|
+
--mdc-staticcheckbox-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
|
14
|
+
--mdc-staticcheckbox-disabled-checked-icon-color: var(--mds-color-theme-control-active-disabled);
|
15
|
+
}
|
16
|
+
|
17
|
+
:host([checked])::part(icon-container),
|
18
|
+
:host([indeterminate])::part(icon-container) {
|
19
|
+
background: var(--mdc-staticcheckbox-checked-background-color);
|
20
|
+
border-color: transparent;
|
21
|
+
}
|
22
|
+
|
23
|
+
:host([disabled])::part(icon-container) {
|
24
|
+
border-color: var(--mdc-staticcheckbox-disabled-border-color);
|
25
|
+
background: var(--mdc-staticcheckbox-disabled-background-color);
|
26
|
+
}
|
27
|
+
|
28
|
+
:host([disabled][checked])::part(icon-container),
|
29
|
+
:host([disabled][indeterminate])::part(icon-container) {
|
30
|
+
background: var(--mdc-staticcheckbox-disabled-checked-icon-color);
|
31
|
+
border: 0.0625rem solid var(--mdc-staticcheckbox-disabled-border-color);
|
32
|
+
}
|
33
|
+
|
34
|
+
:host::part(icon-container) {
|
35
|
+
display: flex;
|
36
|
+
align-items: center;
|
37
|
+
border: 0.0625rem solid var(--mdc-staticcheckbox-icon-border-color);
|
38
|
+
background: var(--mdc-staticcheckbox-icon-background-color);
|
39
|
+
width: 1rem;
|
40
|
+
height: 1rem;
|
41
|
+
border-radius: 0.125rem;
|
42
|
+
}
|
43
|
+
|
44
|
+
.icon {
|
45
|
+
--mdc-icon-fill-color: var(--mdc-staticcheckbox-icon-color);
|
46
|
+
}
|
47
|
+
|
48
|
+
:host([disabled]) .icon {
|
49
|
+
--mdc-icon-fill-color: var(--mdc-staticcheckbox-disabled-icon-color);
|
50
|
+
}
|
51
|
+
|
52
|
+
/* High Contrast Mode */
|
53
|
+
@media (forced-colors: active) {
|
54
|
+
:host([checked])::part(icon-container)
|
55
|
+
:host([indeterminate])::part(icon-container) {
|
56
|
+
border: 0.0625rem solid var(--mdc-staticcheckbox-border-color);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
`];
|
60
|
+
export default styles;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { CSSResult } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
declare const StaticRadio_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
|
4
|
+
/**
|
5
|
+
* This is a decorative component that is styled to look as a radio.
|
6
|
+
* It has 2 properties - checked and disabled.
|
7
|
+
*
|
8
|
+
* We are using the same styling that has been created for the `mdc-radio` component.
|
9
|
+
*
|
10
|
+
* @tagname mdc-staticradio
|
11
|
+
*
|
12
|
+
* @cssproperty --mdc-staticradio-inner-circle-size - size of the inner circle
|
13
|
+
* @cssproperty --mdc-staticradio-text-disabled-color - color of the label when disabled
|
14
|
+
* @cssproperty --mdc-staticradio-normal-border-color - color of the radio button border when normal
|
15
|
+
* @cssproperty --mdc-staticradio-disabled-border-color - color of the radio button border when disabled
|
16
|
+
* @cssproperty --mdc-staticradio-inner-circle-normal-background - background color of the inner circle when normal
|
17
|
+
* @cssproperty --mdc-staticradio-inner-circle-disabled-background - background color of the inner circle when disabled
|
18
|
+
* @cssproperty --mdc-staticradio-control-inactive-color - color of the radio button when inactive
|
19
|
+
* @cssproperty --mdc-staticradio-control-inactive-disabled-background - background color of the radio button when
|
20
|
+
* inactive and disabled
|
21
|
+
* @cssproperty --mdc-staticradio-control-active-color - color of the radio button when active
|
22
|
+
* @cssproperty --mdc-staticradio-control-active-disabled-background - background color of the radio button
|
23
|
+
* when active and disabled
|
24
|
+
*/
|
25
|
+
declare class StaticRadio extends StaticRadio_base {
|
26
|
+
/**
|
27
|
+
* Determines whether the radio is selected or unselected.
|
28
|
+
*
|
29
|
+
* @default false
|
30
|
+
*/
|
31
|
+
checked: boolean;
|
32
|
+
/**
|
33
|
+
* Determines whether the radio is read-only.
|
34
|
+
*
|
35
|
+
* @default false
|
36
|
+
*/
|
37
|
+
readonly: boolean;
|
38
|
+
render(): import("lit-html").TemplateResult<1>;
|
39
|
+
static styles: Array<CSSResult>;
|
40
|
+
}
|
41
|
+
export default StaticRadio;
|
@@ -0,0 +1,67 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { html } from 'lit';
|
11
|
+
import { property } from 'lit/decorators.js';
|
12
|
+
import { Component } from '../../models';
|
13
|
+
import styles from './staticradio.styles';
|
14
|
+
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
15
|
+
/**
|
16
|
+
* This is a decorative component that is styled to look as a radio.
|
17
|
+
* It has 2 properties - checked and disabled.
|
18
|
+
*
|
19
|
+
* We are using the same styling that has been created for the `mdc-radio` component.
|
20
|
+
*
|
21
|
+
* @tagname mdc-staticradio
|
22
|
+
*
|
23
|
+
* @cssproperty --mdc-staticradio-inner-circle-size - size of the inner circle
|
24
|
+
* @cssproperty --mdc-staticradio-text-disabled-color - color of the label when disabled
|
25
|
+
* @cssproperty --mdc-staticradio-normal-border-color - color of the radio button border when normal
|
26
|
+
* @cssproperty --mdc-staticradio-disabled-border-color - color of the radio button border when disabled
|
27
|
+
* @cssproperty --mdc-staticradio-inner-circle-normal-background - background color of the inner circle when normal
|
28
|
+
* @cssproperty --mdc-staticradio-inner-circle-disabled-background - background color of the inner circle when disabled
|
29
|
+
* @cssproperty --mdc-staticradio-control-inactive-color - color of the radio button when inactive
|
30
|
+
* @cssproperty --mdc-staticradio-control-inactive-disabled-background - background color of the radio button when
|
31
|
+
* inactive and disabled
|
32
|
+
* @cssproperty --mdc-staticradio-control-active-color - color of the radio button when active
|
33
|
+
* @cssproperty --mdc-staticradio-control-active-disabled-background - background color of the radio button
|
34
|
+
* when active and disabled
|
35
|
+
*/
|
36
|
+
class StaticRadio extends DisabledMixin(Component) {
|
37
|
+
constructor() {
|
38
|
+
super(...arguments);
|
39
|
+
/**
|
40
|
+
* Determines whether the radio is selected or unselected.
|
41
|
+
*
|
42
|
+
* @default false
|
43
|
+
*/
|
44
|
+
this.checked = false;
|
45
|
+
/**
|
46
|
+
* Determines whether the radio is read-only.
|
47
|
+
*
|
48
|
+
* @default false
|
49
|
+
*/
|
50
|
+
this.readonly = false;
|
51
|
+
}
|
52
|
+
render() {
|
53
|
+
return html `
|
54
|
+
<slot></slot>
|
55
|
+
<span part="radio-icon" class="icon"></span>`;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
StaticRadio.styles = [...Component.styles, ...styles];
|
59
|
+
__decorate([
|
60
|
+
property({ type: Boolean, reflect: true }),
|
61
|
+
__metadata("design:type", Object)
|
62
|
+
], StaticRadio.prototype, "checked", void 0);
|
63
|
+
__decorate([
|
64
|
+
property({ type: Boolean, reflect: true }),
|
65
|
+
__metadata("design:type", Object)
|
66
|
+
], StaticRadio.prototype, "readonly", void 0);
|
67
|
+
export default StaticRadio;
|