@momentum-design/components 0.16.13 → 0.16.15
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 +96 -46
- package/dist/browser/index.js.map +4 -4
- package/dist/components/{labelandhelper/labelandhelper.component.d.ts → formfieldwrapper/formfieldwrapper.component.d.ts} +5 -5
- package/dist/components/{labelandhelper/labelandhelper.component.js → formfieldwrapper/formfieldwrapper.component.js} +13 -13
- package/dist/components/{labelandhelper/labelandhelper.constants.d.ts → formfieldwrapper/formfieldwrapper.constants.d.ts} +1 -1
- package/dist/components/{labelandhelper/labelandhelper.constants.js → formfieldwrapper/formfieldwrapper.constants.js} +1 -1
- package/dist/components/{labelandhelper/labelandhelper.types.d.ts → formfieldwrapper/formfieldwrapper.types.d.ts} +1 -1
- package/dist/components/{labelandhelper/labelandhelper.utils.d.ts → formfieldwrapper/formfieldwrapper.utils.d.ts} +1 -1
- package/dist/components/{labelandhelper/labelandhelper.utils.js → formfieldwrapper/formfieldwrapper.utils.js} +1 -1
- package/dist/components/formfieldwrapper/index.d.ts +9 -0
- package/dist/components/formfieldwrapper/index.js +6 -0
- package/dist/components/modalcontainer/index.d.ts +7 -0
- package/dist/components/modalcontainer/index.js +4 -0
- package/dist/components/modalcontainer/modalcontainer.component.d.ts +44 -0
- package/dist/components/modalcontainer/modalcontainer.component.js +85 -0
- package/dist/components/modalcontainer/modalcontainer.constants.d.ts +23 -0
- package/dist/components/modalcontainer/modalcontainer.constants.js +24 -0
- package/dist/components/modalcontainer/modalcontainer.styles.d.ts +2 -0
- package/dist/components/modalcontainer/modalcontainer.styles.js +45 -0
- package/dist/components/modalcontainer/modalcontainer.types.d.ts +5 -0
- package/dist/components/modalcontainer/modalcontainer.types.js +1 -0
- package/dist/custom-elements.json +335 -216
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/{labelandhelper → formfieldwrapper}/index.d.ts +3 -3
- package/dist/react/{labelandhelper → formfieldwrapper}/index.js +5 -5
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +3 -2
- package/dist/react/modalcontainer/index.d.ts +17 -0
- package/dist/react/modalcontainer/index.js +26 -0
- package/package.json +1 -1
- package/dist/components/labelandhelper/index.d.ts +0 -9
- package/dist/components/labelandhelper/index.js +0 -6
- /package/dist/components/{labelandhelper/labelandhelper.styles.d.ts → formfieldwrapper/formfieldwrapper.styles.d.ts} +0 -0
- /package/dist/components/{labelandhelper/labelandhelper.styles.js → formfieldwrapper/formfieldwrapper.styles.js} +0 -0
- /package/dist/components/{labelandhelper/labelandhelper.types.js → formfieldwrapper/formfieldwrapper.types.js} +0 -0
@@ -1,15 +1,15 @@
|
|
1
1
|
import { CSSResult, nothing } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
|
-
import type { ValidationType } from './
|
3
|
+
import type { ValidationType } from './formfieldwrapper.types';
|
4
4
|
/**
|
5
|
-
*
|
5
|
+
* formfieldwrapper is a component that contains the label and helper/validation text
|
6
6
|
* that can be configured in various ways to suit different use cases (most of the input related components).
|
7
7
|
* It is used as an internal component and is not intended to be used directly by consumers.
|
8
8
|
*
|
9
|
-
* @tagname mdc-
|
9
|
+
* @tagname mdc-formfieldwrapper
|
10
10
|
*
|
11
11
|
*/
|
12
|
-
declare class
|
12
|
+
declare class FormfieldWrapper extends Component {
|
13
13
|
/**
|
14
14
|
* The label of the input field. It is linked to the input field using the `for` attribute.
|
15
15
|
*/
|
@@ -69,4 +69,4 @@ declare class LabelAndHelper extends Component {
|
|
69
69
|
render(): import("lit-html").TemplateResult<1>;
|
70
70
|
static styles: Array<CSSResult>;
|
71
71
|
}
|
72
|
-
export default
|
72
|
+
export default FormfieldWrapper;
|
@@ -10,19 +10,19 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { v4 as uuidv4 } from 'uuid';
|
12
12
|
import { property } from 'lit/decorators.js';
|
13
|
-
import styles from './
|
13
|
+
import styles from './formfieldwrapper.styles';
|
14
14
|
import { Component } from '../../models';
|
15
|
-
import { DEFAULTS, MDC_TEXT_OPTIONS } from './
|
16
|
-
import { getHelperIcon } from './
|
15
|
+
import { DEFAULTS, MDC_TEXT_OPTIONS } from './formfieldwrapper.constants';
|
16
|
+
import { getHelperIcon } from './formfieldwrapper.utils';
|
17
17
|
/**
|
18
|
-
*
|
18
|
+
* formfieldwrapper is a component that contains the label and helper/validation text
|
19
19
|
* that can be configured in various ways to suit different use cases (most of the input related components).
|
20
20
|
* It is used as an internal component and is not intended to be used directly by consumers.
|
21
21
|
*
|
22
|
-
* @tagname mdc-
|
22
|
+
* @tagname mdc-formfieldwrapper
|
23
23
|
*
|
24
24
|
*/
|
25
|
-
class
|
25
|
+
class FormfieldWrapper extends Component {
|
26
26
|
constructor() {
|
27
27
|
super(...arguments);
|
28
28
|
/**
|
@@ -113,25 +113,25 @@ class LabelAndHelper extends Component {
|
|
113
113
|
`;
|
114
114
|
}
|
115
115
|
}
|
116
|
-
|
116
|
+
FormfieldWrapper.styles = [...Component.styles, ...styles];
|
117
117
|
__decorate([
|
118
118
|
property({ reflect: true, type: String }),
|
119
119
|
__metadata("design:type", String)
|
120
|
-
],
|
120
|
+
], FormfieldWrapper.prototype, "label", void 0);
|
121
121
|
__decorate([
|
122
122
|
property({ type: String }),
|
123
123
|
__metadata("design:type", Object)
|
124
|
-
],
|
124
|
+
], FormfieldWrapper.prototype, "id", void 0);
|
125
125
|
__decorate([
|
126
126
|
property({ reflect: true, attribute: 'help-text-type' }),
|
127
127
|
__metadata("design:type", String)
|
128
|
-
],
|
128
|
+
], FormfieldWrapper.prototype, "helpTextType", void 0);
|
129
129
|
__decorate([
|
130
130
|
property({ type: String, reflect: true, attribute: 'help-text' }),
|
131
131
|
__metadata("design:type", String)
|
132
|
-
],
|
132
|
+
], FormfieldWrapper.prototype, "helpText", void 0);
|
133
133
|
__decorate([
|
134
134
|
property({ type: String, attribute: 'label-info-text' }),
|
135
135
|
__metadata("design:type", String)
|
136
|
-
],
|
137
|
-
export default
|
136
|
+
], FormfieldWrapper.prototype, "labelInfoText", void 0);
|
137
|
+
export default FormfieldWrapper;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import utils from '../../utils/tag-name';
|
2
2
|
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
3
|
-
const TAG_NAME = utils.constructTagName('
|
3
|
+
const TAG_NAME = utils.constructTagName('formfieldwrapper');
|
4
4
|
const VALIDATION = {
|
5
5
|
ERROR: 'error',
|
6
6
|
WARNING: 'warning',
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { IconNames } from '../icon/icon.types';
|
2
|
-
import type { ValidationType } from './
|
2
|
+
import type { ValidationType } from './formfieldwrapper.types';
|
3
3
|
declare const getHelperIcon: (type: ValidationType) => IconNames | '';
|
4
4
|
export { getHelperIcon };
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { CSSResult } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
import type { ModalContainerColor, ModalContainerElevation, ModalContainerRole } from './modalcontainer.types';
|
4
|
+
/**
|
5
|
+
* The `mdc-modalcontainer` component is an element used to
|
6
|
+
* display a modal container that can further be used in popover.
|
7
|
+
*
|
8
|
+
* @tagname mdc-modalcontainer
|
9
|
+
*
|
10
|
+
* @cssproperty --mdc-modalcontainer-primary-background-color - primary background color of the modalcontainer
|
11
|
+
* @cssproperty --mdc-modalcontainer-border-color - border color of the modalcontainer
|
12
|
+
* @cssproperty --mdc-modalcontainer-inverted-background-color - inverted background color of the modalcontainer
|
13
|
+
* @cssproperty --mdc-modalcontainer-inverted-border-color - inverted border color of the modalcontainer
|
14
|
+
* @cssproperty --mdc-modalcontainer-inverted-text-color - inverted text color of the modalcontainer
|
15
|
+
*
|
16
|
+
* @slot - Default slot for modal container
|
17
|
+
*/
|
18
|
+
declare class Modalcontainer extends Component {
|
19
|
+
/**
|
20
|
+
* Color of the modalcontainer
|
21
|
+
* - **tonal**
|
22
|
+
* - **contrast**
|
23
|
+
* @default tonal
|
24
|
+
*/
|
25
|
+
color: ModalContainerColor;
|
26
|
+
/**
|
27
|
+
* Elevation of the modalcontainer where each value corresponds to a different drop shadow.
|
28
|
+
* - **0**
|
29
|
+
* - **1**
|
30
|
+
* - **2**
|
31
|
+
* - **3**
|
32
|
+
* - **4**
|
33
|
+
* @default 0
|
34
|
+
*/
|
35
|
+
elevation: ModalContainerElevation;
|
36
|
+
/**
|
37
|
+
* Role of the modalcontainer
|
38
|
+
* @default dialog
|
39
|
+
*/
|
40
|
+
role: ModalContainerRole;
|
41
|
+
render(): import("lit-html").TemplateResult<1>;
|
42
|
+
static styles: Array<CSSResult>;
|
43
|
+
}
|
44
|
+
export default Modalcontainer;
|
@@ -0,0 +1,85 @@
|
|
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 { ifDefined } from 'lit/directives/if-defined.js';
|
13
|
+
import styles from './modalcontainer.styles';
|
14
|
+
import { Component } from '../../models';
|
15
|
+
import { DEFAULTS } from './modalcontainer.constants';
|
16
|
+
/**
|
17
|
+
* The `mdc-modalcontainer` component is an element used to
|
18
|
+
* display a modal container that can further be used in popover.
|
19
|
+
*
|
20
|
+
* @tagname mdc-modalcontainer
|
21
|
+
*
|
22
|
+
* @cssproperty --mdc-modalcontainer-primary-background-color - primary background color of the modalcontainer
|
23
|
+
* @cssproperty --mdc-modalcontainer-border-color - border color of the modalcontainer
|
24
|
+
* @cssproperty --mdc-modalcontainer-inverted-background-color - inverted background color of the modalcontainer
|
25
|
+
* @cssproperty --mdc-modalcontainer-inverted-border-color - inverted border color of the modalcontainer
|
26
|
+
* @cssproperty --mdc-modalcontainer-inverted-text-color - inverted text color of the modalcontainer
|
27
|
+
*
|
28
|
+
* @slot - Default slot for modal container
|
29
|
+
*/
|
30
|
+
class Modalcontainer extends Component {
|
31
|
+
constructor() {
|
32
|
+
super(...arguments);
|
33
|
+
/**
|
34
|
+
* Color of the modalcontainer
|
35
|
+
* - **tonal**
|
36
|
+
* - **contrast**
|
37
|
+
* @default tonal
|
38
|
+
*/
|
39
|
+
this.color = DEFAULTS.COLOR;
|
40
|
+
/**
|
41
|
+
* Elevation of the modalcontainer where each value corresponds to a different drop shadow.
|
42
|
+
* - **0**
|
43
|
+
* - **1**
|
44
|
+
* - **2**
|
45
|
+
* - **3**
|
46
|
+
* - **4**
|
47
|
+
* @default 0
|
48
|
+
*/
|
49
|
+
this.elevation = DEFAULTS.ELEVATION;
|
50
|
+
/**
|
51
|
+
* Role of the modalcontainer
|
52
|
+
* @default dialog
|
53
|
+
*/
|
54
|
+
this.role = DEFAULTS.ROLE;
|
55
|
+
}
|
56
|
+
render() {
|
57
|
+
return html `
|
58
|
+
<div
|
59
|
+
id='mdc-modal-container'
|
60
|
+
class='mdc-modal-container'
|
61
|
+
?contrast="${this.color === 'contrast'}"
|
62
|
+
role="${this.role}"
|
63
|
+
aria-modal='true'
|
64
|
+
aria-label=${ifDefined(this.ariaLabel)}
|
65
|
+
data-elevation="${this.elevation}"
|
66
|
+
>
|
67
|
+
<slot></slot>
|
68
|
+
</div>
|
69
|
+
`;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
Modalcontainer.styles = [...Component.styles, ...styles];
|
73
|
+
__decorate([
|
74
|
+
property({ type: String, reflect: true }),
|
75
|
+
__metadata("design:type", String)
|
76
|
+
], Modalcontainer.prototype, "color", void 0);
|
77
|
+
__decorate([
|
78
|
+
property({ type: Number, reflect: true }),
|
79
|
+
__metadata("design:type", Number)
|
80
|
+
], Modalcontainer.prototype, "elevation", void 0);
|
81
|
+
__decorate([
|
82
|
+
property({ type: String }),
|
83
|
+
__metadata("design:type", String)
|
84
|
+
], Modalcontainer.prototype, "role", void 0);
|
85
|
+
export default Modalcontainer;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
declare const TAG_NAME: "mdc-modalcontainer";
|
2
|
+
declare const COLOR: {
|
3
|
+
readonly TONAL: "tonal";
|
4
|
+
readonly CONTRAST: "contrast";
|
5
|
+
};
|
6
|
+
declare const ELEVATION: {
|
7
|
+
readonly 0: 0;
|
8
|
+
readonly 1: 1;
|
9
|
+
readonly 2: 2;
|
10
|
+
readonly 3: 3;
|
11
|
+
readonly 4: 4;
|
12
|
+
};
|
13
|
+
declare const ROLE: {
|
14
|
+
readonly DIALOG: "dialog";
|
15
|
+
readonly ALERT_DIALOG: "alertdialog";
|
16
|
+
};
|
17
|
+
declare const DEFAULTS: {
|
18
|
+
readonly COLOR: "tonal";
|
19
|
+
readonly ELEVATION: 0;
|
20
|
+
readonly ROLE: "dialog";
|
21
|
+
readonly CHILDREN: "Lorem ipsum dolor sit amet";
|
22
|
+
};
|
23
|
+
export { TAG_NAME, COLOR, DEFAULTS, ELEVATION, ROLE };
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
const TAG_NAME = utils.constructTagName('modalcontainer');
|
3
|
+
const COLOR = {
|
4
|
+
TONAL: 'tonal',
|
5
|
+
CONTRAST: 'contrast',
|
6
|
+
};
|
7
|
+
const ELEVATION = {
|
8
|
+
0: 0,
|
9
|
+
1: 1,
|
10
|
+
2: 2,
|
11
|
+
3: 3,
|
12
|
+
4: 4,
|
13
|
+
};
|
14
|
+
const ROLE = {
|
15
|
+
DIALOG: 'dialog',
|
16
|
+
ALERT_DIALOG: 'alertdialog',
|
17
|
+
};
|
18
|
+
const DEFAULTS = {
|
19
|
+
COLOR: COLOR.TONAL,
|
20
|
+
ELEVATION: ELEVATION[0],
|
21
|
+
ROLE: ROLE.DIALOG,
|
22
|
+
CHILDREN: 'Lorem ipsum dolor sit amet',
|
23
|
+
};
|
24
|
+
export { TAG_NAME, COLOR, DEFAULTS, ELEVATION, ROLE };
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
import { hostFitContentStyles } from '../../utils/styles';
|
3
|
+
const styles = [
|
4
|
+
hostFitContentStyles,
|
5
|
+
css `
|
6
|
+
:host {
|
7
|
+
--mdc-modalcontainer-primary-background-color: var(--mds-color-theme-background-solid-primary-normal);
|
8
|
+
--mdc-modalcontainer-border-color: var(--mds-color-theme-outline-secondary-normal);
|
9
|
+
--mdc-modalcontainer-inverted-background-color: var(--mds-color-theme-inverted-background-normal);
|
10
|
+
--mdc-modalcontainer-inverted-border-color: var(--mds-color-theme-inverted-outline-primary-normal);
|
11
|
+
--mdc-modalcontainer-inverted-text-color: var(--mds-color-theme-inverted-text-primary-normal);
|
12
|
+
--mdc-modalcontainer-elevation-1: var(--mds-elevation-1);
|
13
|
+
--mdc-modalcontainer-elevation-2: var(--mds-elevation-2);
|
14
|
+
--mdc-modalcontainer-elevation-3: var(--mds-elevation-3);
|
15
|
+
--mdc-modalcontainer-elevation-4: var(--mds-elevation-4);
|
16
|
+
}
|
17
|
+
|
18
|
+
.mdc-modal-container {
|
19
|
+
padding: 0.75rem;
|
20
|
+
background-color: var(--mdc-modalcontainer-primary-background-color);
|
21
|
+
border-radius: 0.5rem;
|
22
|
+
border: 0.0625rem solid var(--mdc-modalcontainer-border-color);
|
23
|
+
}
|
24
|
+
|
25
|
+
.mdc-modal-container[contrast] {
|
26
|
+
background-color: var(--mdc-modalcontainer-inverted-background-color);
|
27
|
+
border: 0.0625rem solid var(--mdc-modalcontainer-inverted-border-color);
|
28
|
+
color: var(--mdc-modalcontainer-inverted-text-color);
|
29
|
+
}
|
30
|
+
|
31
|
+
.mdc-modal-container[data-elevation='1'] {
|
32
|
+
filter: var(--mdc-modalcontainer-elevation-1);
|
33
|
+
}
|
34
|
+
.mdc-modal-container[data-elevation='2'] {
|
35
|
+
filter: var(--mdc-modalcontainer-elevation-2);
|
36
|
+
}
|
37
|
+
.mdc-modal-container[data-elevation='3'] {
|
38
|
+
filter: var(--mdc-modalcontainer-elevation-3);
|
39
|
+
}
|
40
|
+
.mdc-modal-container[data-elevation='4'] {
|
41
|
+
filter: var(--mdc-modalcontainer-elevation-4);
|
42
|
+
}
|
43
|
+
`,
|
44
|
+
];
|
45
|
+
export default styles;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { ValueOf } from '../../utils/types';
|
2
|
+
import { COLOR, ELEVATION, ROLE } from './modalcontainer.constants';
|
3
|
+
export type ModalContainerColor = ValueOf<typeof COLOR>;
|
4
|
+
export type ModalContainerElevation = ValueOf<typeof ELEVATION>;
|
5
|
+
export type ModalContainerRole = ValueOf<typeof ROLE>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|