@momentum-design/components 0.135.1 → 0.135.2
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 +4 -4
- package/dist/browser/index.js.map +2 -2
- package/dist/components/toast/toast.component.d.ts +3 -0
- package/dist/components/toast/toast.component.js +16 -4
- package/dist/components/toast/toast.styles.js +2 -2
- package/dist/custom-elements.json +10 -0
- package/package.json +1 -1
|
@@ -106,11 +106,14 @@ declare class Toast extends Toast_base {
|
|
|
106
106
|
* It is used to notify that the toast should be closed.
|
|
107
107
|
*/
|
|
108
108
|
private closeToast;
|
|
109
|
+
private updateDataExpanded;
|
|
109
110
|
private toggleDetailVisibility;
|
|
110
111
|
private updateDetailedSlotPresence;
|
|
111
112
|
private updateFooterButtonsPresence;
|
|
112
113
|
protected firstUpdated(changedProperties: PropertyValues): Promise<void>;
|
|
114
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
113
115
|
protected renderIcon(iconName: string): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
116
|
+
private canRenderToggleButton;
|
|
114
117
|
private shouldRenderToggleButton;
|
|
115
118
|
private renderToggleDetailButton;
|
|
116
119
|
protected renderHeader(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
@@ -93,15 +93,18 @@ class Toast extends FooterMixin(Component) {
|
|
|
93
93
|
});
|
|
94
94
|
this.dispatchEvent(closeEvent);
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
this.isDetailVisible
|
|
98
|
-
if (this.isDetailVisible) {
|
|
96
|
+
updateDataExpanded() {
|
|
97
|
+
if (this.isDetailVisible || !this.canRenderToggleButton()) {
|
|
99
98
|
this.setAttribute('data-expanded', 'true');
|
|
100
99
|
}
|
|
101
100
|
else {
|
|
102
101
|
this.removeAttribute('data-expanded');
|
|
103
102
|
}
|
|
104
103
|
}
|
|
104
|
+
toggleDetailVisibility() {
|
|
105
|
+
this.isDetailVisible = !this.isDetailVisible;
|
|
106
|
+
this.updateDataExpanded();
|
|
107
|
+
}
|
|
105
108
|
updateDetailedSlotPresence() {
|
|
106
109
|
var _a, _b;
|
|
107
110
|
this.hasDetailedSlot = (_b = (_a = this.detailedElements) === null || _a === void 0 ? void 0 : _a.some(el => { var _a; return (_a = el.textContent) === null || _a === void 0 ? void 0 : _a.trim(); })) !== null && _b !== void 0 ? _b : false;
|
|
@@ -118,11 +121,17 @@ class Toast extends FooterMixin(Component) {
|
|
|
118
121
|
async firstUpdated(changedProperties) {
|
|
119
122
|
super.firstUpdated(changedProperties);
|
|
120
123
|
this.updateDetailedSlotPresence();
|
|
124
|
+
this.updateDataExpanded();
|
|
121
125
|
await this.updateComplete;
|
|
122
126
|
if (hasOverflowMixin(this.headerTextElement)) {
|
|
123
127
|
this.hasOverflowingHeaderText = this.headerTextElement.isHeightOverflowing();
|
|
124
128
|
}
|
|
125
129
|
}
|
|
130
|
+
updated(changedProperties) {
|
|
131
|
+
if (changedProperties.has('showMoreText') || changedProperties.has('showLessText')) {
|
|
132
|
+
this.updateDataExpanded();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
126
135
|
renderIcon(iconName) {
|
|
127
136
|
if (!iconName)
|
|
128
137
|
return nothing;
|
|
@@ -130,8 +139,11 @@ class Toast extends FooterMixin(Component) {
|
|
|
130
139
|
<mdc-icon name="${iconName}" size="${DEFAULTS.PREFIX_ICON_SIZE}" part="toast-prefix-icon"></mdc-icon>
|
|
131
140
|
`;
|
|
132
141
|
}
|
|
142
|
+
canRenderToggleButton() {
|
|
143
|
+
return !!(this.showMoreText && this.showLessText);
|
|
144
|
+
}
|
|
133
145
|
shouldRenderToggleButton() {
|
|
134
|
-
return
|
|
146
|
+
return this.canRenderToggleButton() && (this.hasDetailedSlot || this.hasOverflowingHeaderText);
|
|
135
147
|
}
|
|
136
148
|
renderToggleDetailButton() {
|
|
137
149
|
if (!this.shouldRenderToggleButton())
|
|
@@ -55,7 +55,7 @@ const styles = css `
|
|
|
55
55
|
:host::part(toast-header) {
|
|
56
56
|
display: -webkit-box;
|
|
57
57
|
-webkit-box-orient: vertical;
|
|
58
|
-
-webkit-line-clamp:
|
|
58
|
+
-webkit-line-clamp: 3;
|
|
59
59
|
align-self: stretch;
|
|
60
60
|
overflow: hidden;
|
|
61
61
|
text-overflow: ellipsis;
|
|
@@ -72,7 +72,7 @@ const styles = css `
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
:host([data-expanded='true'])::part(toast-header) {
|
|
75
|
-
-webkit-line-clamp:
|
|
75
|
+
-webkit-line-clamp: 6;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
:host::part(footer) {
|
|
@@ -50613,6 +50613,11 @@
|
|
|
50613
50613
|
"attribute": "aria-label",
|
|
50614
50614
|
"reflects": true
|
|
50615
50615
|
},
|
|
50616
|
+
{
|
|
50617
|
+
"kind": "method",
|
|
50618
|
+
"name": "canRenderToggleButton",
|
|
50619
|
+
"privacy": "private"
|
|
50620
|
+
},
|
|
50616
50621
|
{
|
|
50617
50622
|
"kind": "field",
|
|
50618
50623
|
"name": "closeButtonAriaLabel",
|
|
@@ -50777,6 +50782,11 @@
|
|
|
50777
50782
|
"name": "toggleDetailVisibility",
|
|
50778
50783
|
"privacy": "private"
|
|
50779
50784
|
},
|
|
50785
|
+
{
|
|
50786
|
+
"kind": "method",
|
|
50787
|
+
"name": "updateDataExpanded",
|
|
50788
|
+
"privacy": "private"
|
|
50789
|
+
},
|
|
50780
50790
|
{
|
|
50781
50791
|
"kind": "method",
|
|
50782
50792
|
"name": "updateDetailedSlotPresence",
|