@momentum-design/components 0.117.4 → 0.118.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 +575 -505
- package/dist/browser/index.js.map +4 -4
- package/dist/components/announcementdialog/announcementdialog.component.d.ts +87 -0
- package/dist/components/announcementdialog/announcementdialog.component.js +131 -0
- package/dist/components/announcementdialog/announcementdialog.constants.d.ts +6 -0
- package/dist/components/announcementdialog/announcementdialog.constants.js +7 -0
- package/dist/components/announcementdialog/announcementdialog.styles.d.ts +2 -0
- package/dist/components/announcementdialog/announcementdialog.styles.js +52 -0
- package/dist/components/announcementdialog/announcementdialog.types.d.ts +6 -0
- package/dist/components/announcementdialog/announcementdialog.types.js +1 -0
- package/dist/components/announcementdialog/index.d.ts +9 -0
- package/dist/components/announcementdialog/index.js +6 -0
- package/dist/components/dialog/dialog.component.d.ts +14 -1
- package/dist/components/dialog/dialog.component.js +43 -27
- package/dist/components/dialog/dialog.styles.js +2 -0
- package/dist/components/dialog/dialog.types.d.ts +1 -1
- package/dist/components/list/list.component.d.ts +2 -0
- package/dist/components/list/list.component.js +15 -0
- package/dist/components/listitem/listitem.component.js +1 -2
- package/dist/components/select/select.component.js +8 -0
- package/dist/custom-elements.json +2625 -1329
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/announcementdialog/index.d.ts +75 -0
- package/dist/react/announcementdialog/index.js +82 -0
- package/dist/react/dialog/index.d.ts +1 -0
- package/dist/react/dialog/index.js +1 -0
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +5 -4
- package/dist/utils/mixins/lifecycle/lifecycle.contants.d.ts +3 -3
- package/package.json +1 -1
@@ -0,0 +1,87 @@
|
|
1
|
+
import { CSSResult } from 'lit';
|
2
|
+
import Dialog from '../dialog/dialog.component';
|
3
|
+
import type { IllustrationNames } from '../illustration/illustration.types';
|
4
|
+
import type { AnnouncementDialogSize } from './announcementdialog.types';
|
5
|
+
/**
|
6
|
+
* AnnouncementDialog component is a modal dialog that can be used to display announcements, extending the existing Dialog component.
|
7
|
+
* It can be used to create custom dialogs where a illustration, content and footer actions are provided by the consumer.
|
8
|
+
* The dialog is available in 4 sizes: medium, large, xlarge and fullscreen. It may also receive custom styling/sizing.
|
9
|
+
* The dialog interrupts the user and will block interaction with the rest of the application until it is closed.
|
10
|
+
*
|
11
|
+
* The dialog can be controlled solely through the `visible` property, no trigger element is required.
|
12
|
+
* If a `triggerId` is provided, the dialog will manage focus with that element, otherwise it will
|
13
|
+
* remember the previously focused element before the dialog was opened.
|
14
|
+
*
|
15
|
+
* The dialog is a controlled component, meaning it does not have its own state management for visibility.
|
16
|
+
* Use the `visible` property to control the visibility of the dialog.
|
17
|
+
* Use the `onClose` event to handle the close action of the dialog (fired when Close button is clicked
|
18
|
+
* or Escape is pressed).
|
19
|
+
*
|
20
|
+
* **Accessibility notes for consuming (have to be explicitly set when you consume the component)**
|
21
|
+
*
|
22
|
+
* - The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
|
23
|
+
* - Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
|
24
|
+
*
|
25
|
+
* **Note: Programmatic show/hide requires the ? prefix on the visible attribute**
|
26
|
+
* - Use `?visible=true/false` as an attribute instead of `visible=true/false`
|
27
|
+
* - Reference docs for more info: https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
|
28
|
+
*
|
29
|
+
* @dependency mdc-button
|
30
|
+
* @dependency mdc-illustration
|
31
|
+
* @dependency mdc-text
|
32
|
+
*
|
33
|
+
* @tagname mdc-announcementdialog
|
34
|
+
*
|
35
|
+
* @event shown - (React: onShown) Dispatched when the dialog is shown
|
36
|
+
* @event hidden - (React: onHidden) Dispatched when the dialog is hidden
|
37
|
+
* @event created - (React: onCreated) Dispatched when the dialog is created (added to the DOM)
|
38
|
+
* @event destroyed - (React: onDestroyed) Dispatched when the dialog is destroyed (removed from the DOM)
|
39
|
+
* @event close - (React: onClose) Dispatched when the Close Button is clicked or Escape key is pressed
|
40
|
+
* (this does not hide the dialog)
|
41
|
+
*
|
42
|
+
* @cssproperty --mdc-announcementdialog-illustration-background-color - background color of the illustration section
|
43
|
+
* @cssproperty --mdc-dialog-primary-background-color - primary background color of the dialog
|
44
|
+
* @cssproperty --mdc-dialog-border-color - border color of the dialog
|
45
|
+
* @cssproperty --mdc-dialog-header-text-color - text color of the header/title of the dialog
|
46
|
+
* @cssproperty --mdc-dialog-description-text-color - text color of the below header description of the dialog
|
47
|
+
* @cssproperty --mdc-dialog-elevation-3 - elevation of the dialog
|
48
|
+
* @cssproperty --mdc-dialog-width - width of the dialog
|
49
|
+
* @cssproperty --mdc-dialog-height - height of the dialog
|
50
|
+
*
|
51
|
+
* @csspart body - The main body container that holds the illustration and content sections
|
52
|
+
* @csspart illustration-container - The container for the illustration section
|
53
|
+
* @csspart content-container - The container for the content section
|
54
|
+
* @csspart header-text - The header text
|
55
|
+
*
|
56
|
+
* @slot header-prefix - Slot for the dialog header content. This can be used to pass custom header content.
|
57
|
+
* @slot dialog-body - Slot for the dialog body content
|
58
|
+
* @slot illustration-container - Slot for the illustration container section
|
59
|
+
* @slot content-container - Slot for the content (header, description, etc) section
|
60
|
+
* @slot description-container - Slot for the description in the content (below header) - pass in Text, Links etc as needed.
|
61
|
+
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
62
|
+
* @slot footer-button-secondary - This slot is for passing secondary variant of `mdc-button` component
|
63
|
+
* within the footer section.
|
64
|
+
* @slot footer-button-primary - This slot is for passing primary variant of
|
65
|
+
* `mdc-button` component within the footer section.
|
66
|
+
* @slot footer - This slot is for passing custom footer content. Only use this if really needed,
|
67
|
+
* using the footer-link and footer-button slots is preferred
|
68
|
+
*/
|
69
|
+
declare class AnnouncementDialog extends Dialog {
|
70
|
+
/**
|
71
|
+
* The illustration to display in the announcement dialog.
|
72
|
+
* This can be an image URL, icon name, or any other illustration identifier.
|
73
|
+
*
|
74
|
+
* Make sure to choose the right illustration respective the size (the filename includes the size information, i.e. threetwozero = 320px)
|
75
|
+
*/
|
76
|
+
illustration?: IllustrationNames;
|
77
|
+
/**
|
78
|
+
* The size of the announcement dialog, can be 'medium' (656px width), 'large' (992px width), 'xlarge' (90% width) or 'fullscreen' (100% width).
|
79
|
+
* @default medium
|
80
|
+
*/
|
81
|
+
size: AnnouncementDialogSize;
|
82
|
+
connectedCallback(): void;
|
83
|
+
protected renderHeader(): import("lit-html").TemplateResult<1>;
|
84
|
+
protected renderBody(): import("lit-html").TemplateResult<1>;
|
85
|
+
static styles: Array<CSSResult>;
|
86
|
+
}
|
87
|
+
export default AnnouncementDialog;
|
@@ -0,0 +1,131 @@
|
|
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 { ifDefined } from 'lit/directives/if-defined.js';
|
12
|
+
import { property } from 'lit/decorators.js';
|
13
|
+
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
14
|
+
import Dialog from '../dialog/dialog.component';
|
15
|
+
import { DIALOG_VARIANT } from '../dialog/dialog.constants';
|
16
|
+
import styles from './announcementdialog.styles';
|
17
|
+
import { DEFAULTS } from './announcementdialog.constants';
|
18
|
+
/**
|
19
|
+
* AnnouncementDialog component is a modal dialog that can be used to display announcements, extending the existing Dialog component.
|
20
|
+
* It can be used to create custom dialogs where a illustration, content and footer actions are provided by the consumer.
|
21
|
+
* The dialog is available in 4 sizes: medium, large, xlarge and fullscreen. It may also receive custom styling/sizing.
|
22
|
+
* The dialog interrupts the user and will block interaction with the rest of the application until it is closed.
|
23
|
+
*
|
24
|
+
* The dialog can be controlled solely through the `visible` property, no trigger element is required.
|
25
|
+
* If a `triggerId` is provided, the dialog will manage focus with that element, otherwise it will
|
26
|
+
* remember the previously focused element before the dialog was opened.
|
27
|
+
*
|
28
|
+
* The dialog is a controlled component, meaning it does not have its own state management for visibility.
|
29
|
+
* Use the `visible` property to control the visibility of the dialog.
|
30
|
+
* Use the `onClose` event to handle the close action of the dialog (fired when Close button is clicked
|
31
|
+
* or Escape is pressed).
|
32
|
+
*
|
33
|
+
* **Accessibility notes for consuming (have to be explicitly set when you consume the component)**
|
34
|
+
*
|
35
|
+
* - The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
|
36
|
+
* - Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
|
37
|
+
*
|
38
|
+
* **Note: Programmatic show/hide requires the ? prefix on the visible attribute**
|
39
|
+
* - Use `?visible=true/false` as an attribute instead of `visible=true/false`
|
40
|
+
* - Reference docs for more info: https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
|
41
|
+
*
|
42
|
+
* @dependency mdc-button
|
43
|
+
* @dependency mdc-illustration
|
44
|
+
* @dependency mdc-text
|
45
|
+
*
|
46
|
+
* @tagname mdc-announcementdialog
|
47
|
+
*
|
48
|
+
* @event shown - (React: onShown) Dispatched when the dialog is shown
|
49
|
+
* @event hidden - (React: onHidden) Dispatched when the dialog is hidden
|
50
|
+
* @event created - (React: onCreated) Dispatched when the dialog is created (added to the DOM)
|
51
|
+
* @event destroyed - (React: onDestroyed) Dispatched when the dialog is destroyed (removed from the DOM)
|
52
|
+
* @event close - (React: onClose) Dispatched when the Close Button is clicked or Escape key is pressed
|
53
|
+
* (this does not hide the dialog)
|
54
|
+
*
|
55
|
+
* @cssproperty --mdc-announcementdialog-illustration-background-color - background color of the illustration section
|
56
|
+
* @cssproperty --mdc-dialog-primary-background-color - primary background color of the dialog
|
57
|
+
* @cssproperty --mdc-dialog-border-color - border color of the dialog
|
58
|
+
* @cssproperty --mdc-dialog-header-text-color - text color of the header/title of the dialog
|
59
|
+
* @cssproperty --mdc-dialog-description-text-color - text color of the below header description of the dialog
|
60
|
+
* @cssproperty --mdc-dialog-elevation-3 - elevation of the dialog
|
61
|
+
* @cssproperty --mdc-dialog-width - width of the dialog
|
62
|
+
* @cssproperty --mdc-dialog-height - height of the dialog
|
63
|
+
*
|
64
|
+
* @csspart body - The main body container that holds the illustration and content sections
|
65
|
+
* @csspart illustration-container - The container for the illustration section
|
66
|
+
* @csspart content-container - The container for the content section
|
67
|
+
* @csspart header-text - The header text
|
68
|
+
*
|
69
|
+
* @slot header-prefix - Slot for the dialog header content. This can be used to pass custom header content.
|
70
|
+
* @slot dialog-body - Slot for the dialog body content
|
71
|
+
* @slot illustration-container - Slot for the illustration container section
|
72
|
+
* @slot content-container - Slot for the content (header, description, etc) section
|
73
|
+
* @slot description-container - Slot for the description in the content (below header) - pass in Text, Links etc as needed.
|
74
|
+
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
75
|
+
* @slot footer-button-secondary - This slot is for passing secondary variant of `mdc-button` component
|
76
|
+
* within the footer section.
|
77
|
+
* @slot footer-button-primary - This slot is for passing primary variant of
|
78
|
+
* `mdc-button` component within the footer section.
|
79
|
+
* @slot footer - This slot is for passing custom footer content. Only use this if really needed,
|
80
|
+
* using the footer-link and footer-button slots is preferred
|
81
|
+
*/
|
82
|
+
class AnnouncementDialog extends Dialog {
|
83
|
+
constructor() {
|
84
|
+
super(...arguments);
|
85
|
+
/**
|
86
|
+
* The size of the announcement dialog, can be 'medium' (656px width), 'large' (992px width), 'xlarge' (90% width) or 'fullscreen' (100% width).
|
87
|
+
* @default medium
|
88
|
+
*/
|
89
|
+
this.size = DEFAULTS.SIZE;
|
90
|
+
}
|
91
|
+
connectedCallback() {
|
92
|
+
super.connectedCallback();
|
93
|
+
this.variant = DIALOG_VARIANT.DEFAULT;
|
94
|
+
}
|
95
|
+
renderHeader() {
|
96
|
+
return html `${nothing}`;
|
97
|
+
}
|
98
|
+
renderBody() {
|
99
|
+
return html `
|
100
|
+
<div part="body">
|
101
|
+
<div part="illustration-container">
|
102
|
+
<slot name="illustration-container">
|
103
|
+
<mdc-illustration name="${ifDefined(this.illustration)}"></mdc-illustration>
|
104
|
+
</slot>
|
105
|
+
</div>
|
106
|
+
<div part="content-container">
|
107
|
+
<slot name="content-container">
|
108
|
+
<mdc-text
|
109
|
+
part="header-text"
|
110
|
+
tagname="${VALID_TEXT_TAGS[this.headerTagName.toUpperCase()]}"
|
111
|
+
type="${TYPE.HEADING_MIDSIZE_MEDIUM}"
|
112
|
+
>
|
113
|
+
${this.headerText}
|
114
|
+
</mdc-text>
|
115
|
+
<slot name="description-container"> </slot>
|
116
|
+
</slot>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
`;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
AnnouncementDialog.styles = [...Dialog.styles, ...styles];
|
123
|
+
__decorate([
|
124
|
+
property({ type: String, reflect: true }),
|
125
|
+
__metadata("design:type", String)
|
126
|
+
], AnnouncementDialog.prototype, "illustration", void 0);
|
127
|
+
__decorate([
|
128
|
+
property({ type: String, reflect: true }),
|
129
|
+
__metadata("design:type", String)
|
130
|
+
], AnnouncementDialog.prototype, "size", void 0);
|
131
|
+
export default AnnouncementDialog;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
const TAG_NAME = utils.constructTagName('announcementdialog');
|
3
|
+
const ANNOUNCEMENT_DIALOG_SIZE = ['medium', 'large', 'xlarge', 'fullscreen'];
|
4
|
+
const DEFAULTS = {
|
5
|
+
SIZE: 'medium',
|
6
|
+
};
|
7
|
+
export { TAG_NAME, DEFAULTS, ANNOUNCEMENT_DIALOG_SIZE };
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
const styles = css `
|
3
|
+
:host {
|
4
|
+
--mdc-announcementdialog-illustration-background-color: var(--mds-color-theme-background-solid-secondary-normal);
|
5
|
+
|
6
|
+
background-image: linear-gradient(
|
7
|
+
var(--mdc-announcementdialog-illustration-background-color) 0%,
|
8
|
+
var(--mdc-announcementdialog-illustration-background-color) 100%
|
9
|
+
);
|
10
|
+
background-size: 50% 100%;
|
11
|
+
background-position: left;
|
12
|
+
background-repeat: no-repeat;
|
13
|
+
max-height: 100vh;
|
14
|
+
}
|
15
|
+
:host(:dir(rtl)) {
|
16
|
+
background-position: right;
|
17
|
+
}
|
18
|
+
:host::part(body) {
|
19
|
+
margin-top: 2rem;
|
20
|
+
display: grid;
|
21
|
+
grid-template-columns: repeat(auto-fit, minmax(0px, 1fr));
|
22
|
+
}
|
23
|
+
:host::part(illustration-container) {
|
24
|
+
width: auto;
|
25
|
+
}
|
26
|
+
|
27
|
+
:host mdc-illustration {
|
28
|
+
width: auto;
|
29
|
+
margin-inline-start: 1rem;
|
30
|
+
margin-inline-end: 2rem;
|
31
|
+
}
|
32
|
+
:host::part(content-container) {
|
33
|
+
color: var(--mdc-dialog-description-text-color);
|
34
|
+
width: auto;
|
35
|
+
margin-inline-start: 2rem;
|
36
|
+
margin-inline-end: 1rem;
|
37
|
+
}
|
38
|
+
|
39
|
+
@media (max-width: 27rem) {
|
40
|
+
:host {
|
41
|
+
background-size: 0% 100%;
|
42
|
+
}
|
43
|
+
:host::part(illustration-container) {
|
44
|
+
display: none;
|
45
|
+
}
|
46
|
+
:host::part(content-container) {
|
47
|
+
margin-inline-start: 0;
|
48
|
+
margin-inline-end: 0;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
`;
|
52
|
+
export default [styles];
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { Events as DialogEvents } from '../dialog/dialog.types';
|
2
|
+
import { ANNOUNCEMENT_DIALOG_SIZE } from './announcementdialog.constants';
|
3
|
+
type AnnouncementDialogSize = (typeof ANNOUNCEMENT_DIALOG_SIZE)[number];
|
4
|
+
interface Events extends DialogEvents {
|
5
|
+
}
|
6
|
+
export type { Events, AnnouncementDialogSize };
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CSSResult, PropertyValues } from 'lit';
|
1
|
+
import { CSSResult, PropertyValues, nothing } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
3
|
import type { DialogRole, DialogSize, DialogVariant } from './dialog.types';
|
4
4
|
declare const Dialog_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/BackdropMixin").BackdropMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FooterMixin").FooterMixinInterface> & typeof Component;
|
@@ -46,6 +46,7 @@ declare const Dialog_base: import("../../utils/mixins/index.types").Constructor<
|
|
46
46
|
* @cssproperty --mdc-dialog-description-text-color - text color of the below header description of the dialog
|
47
47
|
* @cssproperty --mdc-dialog-elevation-3 - elevation of the dialog
|
48
48
|
* @cssproperty --mdc-dialog-width - width of the dialog
|
49
|
+
* @cssproperty --mdc-dialog-height - height of the dialog
|
49
50
|
*
|
50
51
|
* @slot header-prefix - Slot for the dialog header content. This can be used to pass custom header content.
|
51
52
|
* @slot dialog-body - Slot for the dialog body content
|
@@ -217,6 +218,18 @@ declare class Dialog extends Dialog_base {
|
|
217
218
|
* @internal
|
218
219
|
*/
|
219
220
|
private focusBackToTrigger;
|
221
|
+
/**
|
222
|
+
* Abstracting the renderHeader to allow for overrides of
|
223
|
+
* extending components
|
224
|
+
* @internal
|
225
|
+
*/
|
226
|
+
protected renderHeader(): import("lit-html").TemplateResult<1> | typeof nothing;
|
227
|
+
/**
|
228
|
+
* Abstracting the renderBody to allow for overrides of
|
229
|
+
* extending components
|
230
|
+
* @internal
|
231
|
+
*/
|
232
|
+
protected renderBody(): import("lit-html").TemplateResult<1>;
|
220
233
|
render(): import("lit-html").TemplateResult<1>;
|
221
234
|
static styles: Array<CSSResult>;
|
222
235
|
}
|
@@ -64,6 +64,7 @@ import styles from './dialog.styles';
|
|
64
64
|
* @cssproperty --mdc-dialog-description-text-color - text color of the below header description of the dialog
|
65
65
|
* @cssproperty --mdc-dialog-elevation-3 - elevation of the dialog
|
66
66
|
* @cssproperty --mdc-dialog-width - width of the dialog
|
67
|
+
* @cssproperty --mdc-dialog-height - height of the dialog
|
67
68
|
*
|
68
69
|
* @slot header-prefix - Slot for the dialog header content. This can be used to pass custom header content.
|
69
70
|
* @slot dialog-body - Slot for the dialog body content
|
@@ -359,31 +360,49 @@ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin
|
|
359
360
|
this.lastActiveElement.focus();
|
360
361
|
}
|
361
362
|
}
|
362
|
-
|
363
|
-
|
364
|
-
|
363
|
+
/**
|
364
|
+
* Abstracting the renderHeader to allow for overrides of
|
365
|
+
* extending components
|
366
|
+
* @internal
|
367
|
+
*/
|
368
|
+
renderHeader() {
|
369
|
+
return this.headerText
|
365
370
|
? html ` <div part="header-section">
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
371
|
+
<div part="header">
|
372
|
+
<slot name="header-prefix"></slot>
|
373
|
+
<mdc-text
|
374
|
+
part="header-text"
|
375
|
+
tagname="${VALID_TEXT_TAGS[this.headerTagName.toUpperCase()]}"
|
376
|
+
type="${TYPE.BODY_LARGE_BOLD}"
|
377
|
+
>
|
378
|
+
${this.headerText}
|
379
|
+
</mdc-text>
|
380
|
+
</div>
|
381
|
+
${this.descriptionText
|
377
382
|
? html `<mdc-text
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
383
|
+
part="description-text"
|
384
|
+
tagname="${VALID_TEXT_TAGS[this.descriptionTagName.toUpperCase()]}"
|
385
|
+
type="${TYPE.BODY_MIDSIZE_REGULAR}"
|
386
|
+
>
|
387
|
+
${this.descriptionText}
|
388
|
+
</mdc-text>`
|
384
389
|
: nothing}
|
385
|
-
|
386
|
-
: nothing
|
390
|
+
</div>`
|
391
|
+
: nothing;
|
392
|
+
}
|
393
|
+
/**
|
394
|
+
* Abstracting the renderBody to allow for overrides of
|
395
|
+
* extending components
|
396
|
+
* @internal
|
397
|
+
*/
|
398
|
+
renderBody() {
|
399
|
+
return html ` <div part="body">
|
400
|
+
<slot name="dialog-body"></slot>
|
401
|
+
</div>`;
|
402
|
+
}
|
403
|
+
render() {
|
404
|
+
return html `
|
405
|
+
${this.renderHeader()}
|
387
406
|
<mdc-button
|
388
407
|
part="dialog-close-btn"
|
389
408
|
prefix-icon="${DEFAULTS.CANCEL_ICON}"
|
@@ -392,10 +411,7 @@ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin
|
|
392
411
|
aria-label="${ifDefined(this.closeButtonAriaLabel) || ''}"
|
393
412
|
@click="${this.closeDialog}"
|
394
413
|
></mdc-button>
|
395
|
-
|
396
|
-
<slot name="dialog-body"></slot>
|
397
|
-
</div>
|
398
|
-
${this.renderFooter()}
|
414
|
+
${this.renderBody()} ${this.renderFooter()}
|
399
415
|
`;
|
400
416
|
}
|
401
417
|
}
|
@@ -418,7 +434,7 @@ __decorate([
|
|
418
434
|
], Dialog.prototype, "zIndex", void 0);
|
419
435
|
__decorate([
|
420
436
|
property({ type: String, reflect: true }),
|
421
|
-
__metadata("design:type",
|
437
|
+
__metadata("design:type", String)
|
422
438
|
], Dialog.prototype, "size", void 0);
|
423
439
|
__decorate([
|
424
440
|
property({ type: String, reflect: true }),
|
@@ -7,6 +7,7 @@ const styles = css `
|
|
7
7
|
--mdc-dialog-description-text-color: var(--mds-color-theme-text-secondary-normal);
|
8
8
|
--mdc-dialog-elevation-3: var(--mds-elevation-3);
|
9
9
|
--mdc-dialog-width: 27rem; /* Default to small */
|
10
|
+
--mdc-dialog-height: auto;
|
10
11
|
--mdc-dialog-padding: 1.5rem;
|
11
12
|
|
12
13
|
background-color: var(--mdc-dialog-primary-background-color);
|
@@ -60,6 +61,7 @@ const styles = css `
|
|
60
61
|
|
61
62
|
:host {
|
62
63
|
width: var(--mdc-dialog-width);
|
64
|
+
height: var(--mdc-dialog-height);
|
63
65
|
max-width: 100%;
|
64
66
|
}
|
65
67
|
|
@@ -2,7 +2,7 @@ import type { TypedCustomEvent, ValueOf } from '../../utils/types';
|
|
2
2
|
import type Dialog from './dialog.component';
|
3
3
|
import { DIALOG_ROLE, DIALOG_SIZE, DIALOG_VARIANT } from './dialog.constants';
|
4
4
|
type DialogRole = (typeof DIALOG_ROLE)[number];
|
5
|
-
type DialogSize =
|
5
|
+
type DialogSize = (typeof DIALOG_SIZE)[number];
|
6
6
|
type DialogVariant = ValueOf<typeof DIALOG_VARIANT>;
|
7
7
|
interface Events {
|
8
8
|
onShownEvent: TypedCustomEvent<Dialog, {
|
@@ -83,7 +83,22 @@ class List extends ListNavigationMixin(CaptureDestroyEventForChildElement(Compon
|
|
83
83
|
}
|
84
84
|
this.resetTabIndexes(newIndex);
|
85
85
|
};
|
86
|
+
/** @internal */
|
87
|
+
this.handleModifiedEvent = (event) => {
|
88
|
+
const item = event.target;
|
89
|
+
switch (event.detail.change) {
|
90
|
+
case 'enabled':
|
91
|
+
this.itemsStore.add(item);
|
92
|
+
break;
|
93
|
+
case 'disabled':
|
94
|
+
this.itemsStore.delete(item);
|
95
|
+
break;
|
96
|
+
default:
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
};
|
86
100
|
this.addEventListener(LIFE_CYCLE_EVENTS.CREATED, this.handleCreatedEvent);
|
101
|
+
this.addEventListener(LIFE_CYCLE_EVENTS.MODIFIED, this.handleModifiedEvent);
|
87
102
|
this.addEventListener(LIFE_CYCLE_EVENTS.DESTROYED, this.handleDestroyEvent);
|
88
103
|
// This must be initialized after the destroyed event listener
|
89
104
|
// to keep the element in the itemStore in order to move the focus correctly
|
@@ -147,12 +147,10 @@ class ListItem extends DisabledMixin(TabIndexMixin(LifeCycleMixin(Component))) {
|
|
147
147
|
[...this.leadingControlsSlot, ...this.trailingControlsSlot].forEach(element => {
|
148
148
|
if (disabled) {
|
149
149
|
element.setAttribute('disabled', '');
|
150
|
-
this.dispatchModifiedEvent('disabled');
|
151
150
|
ListItemEventManager.onDisableListItem(this);
|
152
151
|
}
|
153
152
|
else {
|
154
153
|
element.removeAttribute('disabled');
|
155
|
-
this.dispatchModifiedEvent('enabled');
|
156
154
|
ListItemEventManager.onEnableListItem(this);
|
157
155
|
}
|
158
156
|
});
|
@@ -164,6 +162,7 @@ class ListItem extends DisabledMixin(TabIndexMixin(LifeCycleMixin(Component))) {
|
|
164
162
|
if (changedProperties.has('disabled')) {
|
165
163
|
this.tabIndex = this.disabled ? -1 : 0;
|
166
164
|
this.disableSlottedChildren(this.disabled);
|
165
|
+
this.dispatchModifiedEvent(this.disabled ? 'disabled' : 'enabled');
|
167
166
|
}
|
168
167
|
if (changedProperties.has('softDisabled')) {
|
169
168
|
this.disableSlottedChildren(this.softDisabled);
|
@@ -258,6 +258,14 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
|
|
258
258
|
}
|
259
259
|
break;
|
260
260
|
}
|
261
|
+
case 'enabled': {
|
262
|
+
this.itemsStore.add(option);
|
263
|
+
break;
|
264
|
+
}
|
265
|
+
case 'disabled': {
|
266
|
+
this.itemsStore.delete(option);
|
267
|
+
break;
|
268
|
+
}
|
261
269
|
default:
|
262
270
|
break;
|
263
271
|
}
|