@momentum-design/components 0.89.1 → 0.91.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 +359 -308
- package/dist/browser/index.js.map +4 -4
- package/dist/components/listheader/index.d.ts +9 -0
- package/dist/components/listheader/index.js +6 -0
- package/dist/components/listheader/listheader.component.d.ts +45 -0
- package/dist/components/listheader/listheader.component.js +85 -0
- package/dist/components/listheader/listheader.constants.d.ts +2 -0
- package/dist/components/listheader/listheader.constants.js +3 -0
- package/dist/components/listheader/listheader.styles.d.ts +2 -0
- package/dist/components/listheader/listheader.styles.js +30 -0
- package/dist/components/menusection/index.d.ts +1 -0
- package/dist/components/menusection/index.js +1 -0
- package/dist/components/menusection/menusection.component.d.ts +11 -3
- package/dist/components/menusection/menusection.component.js +16 -8
- package/dist/components/menusection/menusection.styles.js +4 -2
- package/dist/custom-elements.json +1080 -940
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +3 -2
- package/dist/react/listheader/index.d.ts +15 -0
- package/dist/react/listheader/index.js +24 -0
- package/package.json +1 -1
@@ -0,0 +1,45 @@
|
|
1
|
+
import { CSSResult } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
import type { IconNames } from '../icon/icon.types';
|
4
|
+
/**
|
5
|
+
* Listheader component is used to display a header in a list.
|
6
|
+
* It can include icons before and after the header text, and allows for additional content via slots.
|
7
|
+
*
|
8
|
+
* @tagname mdc-listheader
|
9
|
+
*
|
10
|
+
* @slot default - to pass in actionable content like buttons or links
|
11
|
+
*
|
12
|
+
* @cssproperty --mdc-listheader-height - height of the header
|
13
|
+
* @cssproperty --mdc-listheader-padding - padding around the header content
|
14
|
+
* @cssproperty --mdc-listheader-gap - gap between content
|
15
|
+
*/
|
16
|
+
declare class Listheader extends Component {
|
17
|
+
/**
|
18
|
+
* Name of the icon rendered before the text
|
19
|
+
*
|
20
|
+
* If not provided, no icon will be rendered and text will be aligned to the start.
|
21
|
+
*/
|
22
|
+
prefixIcon?: IconNames;
|
23
|
+
/**
|
24
|
+
* Name of the icon rendered after the slot & text
|
25
|
+
*
|
26
|
+
* If not provided, no icon will be rendered and content will be aligned to the end.
|
27
|
+
*/
|
28
|
+
postfixIcon?: IconNames;
|
29
|
+
/**
|
30
|
+
* Text to be rendered in the header
|
31
|
+
*/
|
32
|
+
headerText?: string;
|
33
|
+
/**
|
34
|
+
* Disables the header, making it visually styled as disabled.
|
35
|
+
*
|
36
|
+
* NOTE: slot content will still be interactive unless individually disabled.
|
37
|
+
* Make sure to handle the disabled state of any actionable elements inside the slot.
|
38
|
+
*
|
39
|
+
* @default false
|
40
|
+
*/
|
41
|
+
disabled: boolean;
|
42
|
+
render(): import("lit-html").TemplateResult<1>;
|
43
|
+
static styles: Array<CSSResult>;
|
44
|
+
}
|
45
|
+
export default Listheader;
|
@@ -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, nothing } from 'lit';
|
11
|
+
import { property } from 'lit/decorators.js';
|
12
|
+
import { Component } from '../../models';
|
13
|
+
import styles from './listheader.styles';
|
14
|
+
/**
|
15
|
+
* Listheader component is used to display a header in a list.
|
16
|
+
* It can include icons before and after the header text, and allows for additional content via slots.
|
17
|
+
*
|
18
|
+
* @tagname mdc-listheader
|
19
|
+
*
|
20
|
+
* @slot default - to pass in actionable content like buttons or links
|
21
|
+
*
|
22
|
+
* @cssproperty --mdc-listheader-height - height of the header
|
23
|
+
* @cssproperty --mdc-listheader-padding - padding around the header content
|
24
|
+
* @cssproperty --mdc-listheader-gap - gap between content
|
25
|
+
*/
|
26
|
+
class Listheader extends Component {
|
27
|
+
constructor() {
|
28
|
+
super(...arguments);
|
29
|
+
/**
|
30
|
+
* Disables the header, making it visually styled as disabled.
|
31
|
+
*
|
32
|
+
* NOTE: slot content will still be interactive unless individually disabled.
|
33
|
+
* Make sure to handle the disabled state of any actionable elements inside the slot.
|
34
|
+
*
|
35
|
+
* @default false
|
36
|
+
*/
|
37
|
+
this.disabled = false;
|
38
|
+
}
|
39
|
+
render() {
|
40
|
+
return html `
|
41
|
+
${this.prefixIcon
|
42
|
+
? html `<mdc-icon
|
43
|
+
part="prefix-icon"
|
44
|
+
name="${this.prefixIcon}"
|
45
|
+
aria-hidden="true"
|
46
|
+
size="1"
|
47
|
+
length-unit="rem"
|
48
|
+
></mdc-icon>`
|
49
|
+
: nothing}
|
50
|
+
${this.headerText
|
51
|
+
? html `<mdc-text part="header-text" type="body-midsize-bold" tagname="span" aria-hidden="true"
|
52
|
+
>${this.headerText}</mdc-text
|
53
|
+
>`
|
54
|
+
: nothing}
|
55
|
+
<slot></slot>
|
56
|
+
${this.postfixIcon
|
57
|
+
? html `<mdc-icon
|
58
|
+
part="postfix-icon"
|
59
|
+
name="${this.postfixIcon}"
|
60
|
+
aria-hidden="true"
|
61
|
+
size="1"
|
62
|
+
length-unit="rem"
|
63
|
+
></mdc-icon>`
|
64
|
+
: nothing}
|
65
|
+
`;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
Listheader.styles = [...Component.styles, ...styles];
|
69
|
+
__decorate([
|
70
|
+
property({ type: String, attribute: 'prefix-icon' }),
|
71
|
+
__metadata("design:type", String)
|
72
|
+
], Listheader.prototype, "prefixIcon", void 0);
|
73
|
+
__decorate([
|
74
|
+
property({ type: String, attribute: 'postfix-icon' }),
|
75
|
+
__metadata("design:type", String)
|
76
|
+
], Listheader.prototype, "postfixIcon", void 0);
|
77
|
+
__decorate([
|
78
|
+
property({ type: String, attribute: 'header-text' }),
|
79
|
+
__metadata("design:type", String)
|
80
|
+
], Listheader.prototype, "headerText", void 0);
|
81
|
+
__decorate([
|
82
|
+
property({ type: Boolean, reflect: true }),
|
83
|
+
__metadata("design:type", Object)
|
84
|
+
], Listheader.prototype, "disabled", void 0);
|
85
|
+
export default Listheader;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
const styles = css `
|
3
|
+
:host {
|
4
|
+
--mdc-listheader-padding: 0.5rem 0.75rem;
|
5
|
+
--mdc-listheader-gap: 0.5rem;
|
6
|
+
--mdc-listheader-color-disabled: var(--mds-color-theme-text-primary-disabled);
|
7
|
+
|
8
|
+
display: flex;
|
9
|
+
align-items: center;
|
10
|
+
padding: var(--mdc-listheader-padding);
|
11
|
+
gap: var(--mdc-listheader-gap);
|
12
|
+
}
|
13
|
+
|
14
|
+
:host([disabled]) {
|
15
|
+
color: var(--mdc-listheader-color-disabled);
|
16
|
+
}
|
17
|
+
|
18
|
+
::slotted(*) {
|
19
|
+
flex-shrink: 0;
|
20
|
+
}
|
21
|
+
|
22
|
+
:host::part(header-text) {
|
23
|
+
width: 100%;
|
24
|
+
}
|
25
|
+
:host::part(prefix-icon),
|
26
|
+
:host::part(postfix-icon) {
|
27
|
+
flex-shrink: 0;
|
28
|
+
}
|
29
|
+
`;
|
30
|
+
export default [styles];
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { CSSResult, PropertyValues } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
|
+
import type { IconNames } from '../icon/icon.types';
|
3
4
|
/**
|
4
5
|
* `mdc-menusection` is a container element used to group a set of menu items.
|
5
6
|
*
|
@@ -17,8 +18,9 @@ import { Component } from '../../models';
|
|
17
18
|
*/
|
18
19
|
declare class MenuSection extends Component {
|
19
20
|
/**
|
20
|
-
* The
|
21
|
-
* This
|
21
|
+
* The aria-label for the section.
|
22
|
+
* This is used for accessibility purposes to describe the section.
|
23
|
+
* If not provided, it defaults to the `headerText`.
|
22
24
|
*/
|
23
25
|
ariaLabel: string | null;
|
24
26
|
/**
|
@@ -26,9 +28,15 @@ declare class MenuSection extends Component {
|
|
26
28
|
* This appears on the leading side of the list item.
|
27
29
|
*/
|
28
30
|
headerText: string | null;
|
31
|
+
/**
|
32
|
+
* Name of the icon rendered before the text
|
33
|
+
*
|
34
|
+
* If not provided, no icon will be rendered and text will be aligned to the start.
|
35
|
+
*/
|
36
|
+
prefixIcon?: IconNames;
|
29
37
|
connectedCallback(): void;
|
30
38
|
update(changedProperties: PropertyValues): void;
|
31
|
-
private
|
39
|
+
private renderHeader;
|
32
40
|
render(): import("lit-html").TemplateResult<1>;
|
33
41
|
static styles: CSSResult[];
|
34
42
|
}
|
@@ -9,9 +9,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
};
|
10
10
|
import { html } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
12
13
|
import { Component } from '../../models';
|
13
14
|
import { ROLE } from '../../utils/roles';
|
14
|
-
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
15
15
|
import styles from './menusection.styles';
|
16
16
|
/**
|
17
17
|
* `mdc-menusection` is a container element used to group a set of menu items.
|
@@ -32,8 +32,9 @@ class MenuSection extends Component {
|
|
32
32
|
constructor() {
|
33
33
|
super(...arguments);
|
34
34
|
/**
|
35
|
-
* The
|
36
|
-
* This
|
35
|
+
* The aria-label for the section.
|
36
|
+
* This is used for accessibility purposes to describe the section.
|
37
|
+
* If not provided, it defaults to the `headerText`.
|
37
38
|
*/
|
38
39
|
this.ariaLabel = null;
|
39
40
|
/**
|
@@ -57,16 +58,19 @@ class MenuSection extends Component {
|
|
57
58
|
this.ariaLabel = this.headerText || '';
|
58
59
|
}
|
59
60
|
}
|
60
|
-
|
61
|
+
renderHeader() {
|
61
62
|
if (this.headerText) {
|
62
|
-
return html
|
63
|
-
|
64
|
-
|
63
|
+
return html ` <mdc-listheader
|
64
|
+
part="header"
|
65
|
+
header-text="${this.headerText}"
|
66
|
+
prefix-icon="${ifDefined(this.prefixIcon)}"
|
67
|
+
>
|
68
|
+
</mdc-listheader>`;
|
65
69
|
}
|
66
70
|
return null;
|
67
71
|
}
|
68
72
|
render() {
|
69
|
-
return html `${this.
|
73
|
+
return html `${this.renderHeader()}<slot></slot>`;
|
70
74
|
}
|
71
75
|
}
|
72
76
|
MenuSection.styles = [...Component.styles, ...styles];
|
@@ -78,4 +82,8 @@ __decorate([
|
|
78
82
|
property({ type: String, reflect: true, attribute: 'header-text' }),
|
79
83
|
__metadata("design:type", Object)
|
80
84
|
], MenuSection.prototype, "headerText", void 0);
|
85
|
+
__decorate([
|
86
|
+
property({ type: String, attribute: 'prefix-icon' }),
|
87
|
+
__metadata("design:type", String)
|
88
|
+
], MenuSection.prototype, "prefixIcon", void 0);
|
81
89
|
export default MenuSection;
|