@momentum-design/components 0.53.9 → 0.54.1
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 +350 -314
- package/dist/browser/index.js.map +4 -4
- package/dist/components/buttonsimple/buttonsimple.component.js +4 -2
- 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/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 +306 -70
- 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 +2 -0
- package/dist/react/index.js +2 -0
- 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
@@ -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;
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
const styles = [css `
|
3
|
+
:host{
|
4
|
+
display: block;
|
5
|
+
position: relative;
|
6
|
+
width: 1rem;
|
7
|
+
height: 1rem;
|
8
|
+
margin: 0.125rem 0;
|
9
|
+
border-radius: 50%;
|
10
|
+
|
11
|
+
--mdc-staticradio-inner-circle-size: 0.375rem;
|
12
|
+
--mdc-staticradio-text-disabled-color: var(--mds-color-theme-text-primary-disabled);
|
13
|
+
--mdc-staticradio-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
|
14
|
+
--mdc-staticradio-normal-border-color: var(--mds-color-theme-outline-input-normal);
|
15
|
+
--mdc-staticradio-inner-circle-normal-background: var(--mds-color-theme-inverted-text-primary-normal);
|
16
|
+
--mdc-staticradio-inner-circle-disabled-background: var(--mds-color-theme-inverted-text-primary-disabled);
|
17
|
+
--mdc-staticradio-control-inactive-color: var(--mds-color-theme-control-inactive-normal);
|
18
|
+
--mdc-staticradio-control-inactive-disabled-background: var(--mds-color-theme-control-inactive-disabled);
|
19
|
+
--mdc-staticradio-control-active-color: var(--mds-color-theme-control-active-normal);
|
20
|
+
--mdc-staticradio-control-active-disabled-background: var(--mds-color-theme-control-active-disabled);
|
21
|
+
}
|
22
|
+
|
23
|
+
.icon:after {
|
24
|
+
content: "";
|
25
|
+
position: absolute;
|
26
|
+
display: none;
|
27
|
+
}
|
28
|
+
|
29
|
+
:host([disabled]) .icon,
|
30
|
+
:host([disabled][readonly]) .icon {
|
31
|
+
border-color: var(--mdc-staticradio-disabled-border-color);
|
32
|
+
background: var(--mdc-staticradio-control-inactive-disabled-background);
|
33
|
+
}
|
34
|
+
|
35
|
+
:host([disabled][checked]) .icon,
|
36
|
+
:host([disabled][readonly][checked]) .icon {
|
37
|
+
border: var(--mdc-staticradio-control-active-disabled-background);
|
38
|
+
background: var(--mdc-staticradio-control-active-disabled-background);
|
39
|
+
}
|
40
|
+
|
41
|
+
:host([disabled][checked]) .icon:after,
|
42
|
+
:host([disabled][readonly][checked]) .icon:after {
|
43
|
+
background: var(--mdc-staticradio-inner-circle-disabled-background);
|
44
|
+
}
|
45
|
+
|
46
|
+
.icon {
|
47
|
+
position: absolute;
|
48
|
+
top: 0;
|
49
|
+
left: 0;
|
50
|
+
width: 1rem;
|
51
|
+
height: 1rem;
|
52
|
+
border: 0.0625rem solid var(--mdc-staticradio-normal-border-color);
|
53
|
+
background-color: var(--mdc-staticradio-control-inactive-color);
|
54
|
+
border-radius: 50%;
|
55
|
+
}
|
56
|
+
|
57
|
+
:host([checked]) .icon {
|
58
|
+
border-color: var(--mdc-staticradio-control-active-color);
|
59
|
+
background-color: var(--mdc-staticradio-control-active-color);
|
60
|
+
}
|
61
|
+
|
62
|
+
:host([checked]) .icon:after {
|
63
|
+
display: block;
|
64
|
+
top: 50%;
|
65
|
+
left: 50%;
|
66
|
+
transform: translate(-50%, -50%);
|
67
|
+
width: var(--mdc-staticradio-inner-circle-size);
|
68
|
+
height: var(--mdc-staticradio-inner-circle-size);
|
69
|
+
border-radius: 50%;
|
70
|
+
background: var(--mdc-staticradio-inner-circle-normal-background);
|
71
|
+
}
|
72
|
+
|
73
|
+
:host([readonly]) .icon{
|
74
|
+
border-color: var(--mdc-staticradio-normal-border-color);
|
75
|
+
background-color: var(--mdc-staticradio-control-inactive-color);
|
76
|
+
}
|
77
|
+
|
78
|
+
:host([readonly][checked]) .icon {
|
79
|
+
border-color: var(--mdc-staticradio-normal-border-color);
|
80
|
+
}
|
81
|
+
|
82
|
+
:host([readonly][checked]) .icon:after{
|
83
|
+
background-color: var(--mdc-staticradio-text-disabled-color);
|
84
|
+
}
|
85
|
+
`];
|
86
|
+
export default styles;
|