@mgdis/mg-components 5.8.2 → 5.9.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/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_31.cjs.entry.js +196 -63
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/collection/components/atoms/mg-card/mg-card.conf.js +8 -0
- package/dist/collection/components/atoms/mg-card/mg-card.css +54 -0
- package/dist/collection/components/atoms/mg-card/mg-card.js +106 -4
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +38 -7
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +70 -11
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +57 -21
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +12 -12
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +44 -5
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +12 -9
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +1 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +1 -0
- package/dist/collection/components/molecules/mg-details/mg-details.css +0 -3
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.css +1 -19
- package/dist/collection/components/molecules/mg-message/mg-message.js +9 -4
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +1 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
- package/dist/collection/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/collection/variables.css +7 -1
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-card2.js +60 -6
- package/dist/components/mg-details.js +2 -2
- package/dist/components/mg-icon2.js +66 -22
- package/dist/components/mg-input-numeric.js +12 -9
- package/dist/components/mg-menu-item2.js +2 -2
- package/dist/components/mg-message.js +2 -2
- package/dist/components/mg-modal.js +1 -1
- package/dist/components/mg-panel.js +1 -1
- package/dist/components/mg-popover2.js +1 -1
- package/dist/components/mg-tag.js +1 -1
- package/dist/components/mg-tooltip2.js +44 -5
- package/dist/components/popper.js +3 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +196 -63
- package/dist/esm/mg-components.js +1 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-9a93b7af.entry.js +1 -0
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/mg-components/variables.css +7 -1
- package/dist/types/components/atoms/mg-card/mg-card.conf.d.ts +16 -0
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +29 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +10 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +13 -5
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +21 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +5 -5
- package/dist/types/components/molecules/mg-message/mg-message.conf.d.ts +5 -1
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +6 -5
- package/dist/types/components.d.ts +35 -9
- package/package.json +5 -5
- package/dist/mg-components/p-0b68c4b4.entry.js +0 -1
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
}
|
|
23
23
|
.mg-tag.mg-tag--primary.mg-tag--soft {
|
|
24
24
|
font-weight: 400;
|
|
25
|
-
background-color: hsl(var(--color-dark-h), var(--color-dark-s),
|
|
26
|
-
border-color: hsl(var(--color-dark-h), var(--color-dark-s),
|
|
25
|
+
background-color: hsl(var(--color-dark-h), var(--color-dark-s), var(--mg-color-soft-l));
|
|
26
|
+
border-color: hsl(var(--color-dark-h), var(--color-dark-s), var(--mg-color-soft-l));
|
|
27
27
|
color: hsl(var(--color-dark));
|
|
28
28
|
}
|
|
29
29
|
.mg-tag.mg-tag--primary.mg-tag--soft ::slotted(mg-icon) {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
}
|
|
41
41
|
.mg-tag.mg-tag--secondary.mg-tag--soft {
|
|
42
42
|
font-weight: 400;
|
|
43
|
-
background-color: hsl(var(--color-light-h), var(--color-light-s),
|
|
44
|
-
border-color: hsl(var(--color-light-h), var(--color-light-s),
|
|
43
|
+
background-color: hsl(var(--color-light-h), var(--color-light-s), var(--mg-color-soft-l));
|
|
44
|
+
border-color: hsl(var(--color-light-h), var(--color-light-s), var(--mg-color-soft-l));
|
|
45
45
|
color: hsl(var(--color-dark));
|
|
46
46
|
}
|
|
47
47
|
.mg-tag.mg-tag--secondary.mg-tag--soft ::slotted(mg-icon) {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
.mg-tag.mg-tag--success.mg-tag--soft {
|
|
60
60
|
font-weight: 400;
|
|
61
|
-
background-color: hsl(var(--color-success-h), var(--color-success-s),
|
|
62
|
-
border-color: hsl(var(--color-success-h), var(--color-success-s),
|
|
61
|
+
background-color: hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l));
|
|
62
|
+
border-color: hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l));
|
|
63
63
|
color: hsl(var(--color-dark));
|
|
64
64
|
}
|
|
65
65
|
.mg-tag.mg-tag--success.mg-tag--soft ::slotted(mg-icon) {
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
}
|
|
77
77
|
.mg-tag.mg-tag--warning.mg-tag--soft {
|
|
78
78
|
font-weight: 400;
|
|
79
|
-
background-color: hsl(var(--color-warning-h), var(--color-warning-s),
|
|
80
|
-
border-color: hsl(var(--color-warning-h), var(--color-warning-s),
|
|
79
|
+
background-color: hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l));
|
|
80
|
+
border-color: hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l));
|
|
81
81
|
color: hsl(var(--color-dark));
|
|
82
82
|
}
|
|
83
83
|
.mg-tag.mg-tag--warning.mg-tag--soft ::slotted(mg-icon) {
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
}
|
|
95
95
|
.mg-tag.mg-tag--danger.mg-tag--soft {
|
|
96
96
|
font-weight: 400;
|
|
97
|
-
background-color: hsl(var(--color-danger-h), var(--color-danger-s),
|
|
98
|
-
border-color: hsl(var(--color-danger-h), var(--color-danger-s),
|
|
97
|
+
background-color: hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l));
|
|
98
|
+
border-color: hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l));
|
|
99
99
|
color: hsl(var(--color-dark));
|
|
100
100
|
}
|
|
101
101
|
.mg-tag.mg-tag--danger.mg-tag--soft ::slotted(mg-icon) {
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
}
|
|
113
113
|
.mg-tag.mg-tag--info.mg-tag--soft {
|
|
114
114
|
font-weight: 400;
|
|
115
|
-
background-color: hsl(var(--color-info-h), var(--color-info-s),
|
|
116
|
-
border-color: hsl(var(--color-info-h), var(--color-info-s),
|
|
115
|
+
background-color: hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l));
|
|
116
|
+
border-color: hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l));
|
|
117
117
|
color: hsl(var(--color-dark));
|
|
118
118
|
}
|
|
119
119
|
.mg-tag.mg-tag--info.mg-tag--soft ::slotted(mg-icon) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
|
2
|
-
import { createID, focusableElements } from '../../../utils/components.utils';
|
|
2
|
+
import { createID, focusableElements, getWindows } from '../../../utils/components.utils';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
4
|
import { Guard } from './mg-tooltip.conf';
|
|
5
5
|
export class MgTooltip {
|
|
@@ -16,6 +16,14 @@ export class MgTooltip {
|
|
|
16
16
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
17
17
|
// Update its position
|
|
18
18
|
this.popper.update();
|
|
19
|
+
// hide when click outside
|
|
20
|
+
// setTimeout is used to prevent event to trigger after creation
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
this.windows.forEach((localWindow) => {
|
|
23
|
+
localWindow.addEventListener('click', this.clickOutside, false);
|
|
24
|
+
localWindow.addEventListener('keydown', this.pressEscape, false);
|
|
25
|
+
});
|
|
26
|
+
}, 0);
|
|
19
27
|
};
|
|
20
28
|
/**
|
|
21
29
|
* Hide tooltip
|
|
@@ -27,6 +35,31 @@ export class MgTooltip {
|
|
|
27
35
|
this.tooltip.removeAttribute('data-show');
|
|
28
36
|
// Disable the event listeners
|
|
29
37
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
38
|
+
// Remove event listener
|
|
39
|
+
this.windows.forEach((localWindow) => {
|
|
40
|
+
localWindow.removeEventListener('click', this.clickOutside, false);
|
|
41
|
+
localWindow.removeEventListener('keyboard', this.pressEscape, false);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Check if clicked outside of component and hidde tooltip
|
|
46
|
+
*
|
|
47
|
+
* @param {MouseEvent} event mouse event
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
this.clickOutside = (event) => {
|
|
51
|
+
if (event.target.closest('mg-tooltip') !== this.element)
|
|
52
|
+
this.setDisplay(false);
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Check if 'Escape' key is pressed of component and hidde tooltip
|
|
56
|
+
*
|
|
57
|
+
* @param {KeyboardEvent} event keyboard event
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
this.pressEscape = (event) => {
|
|
61
|
+
if (event.code === 'Escape')
|
|
62
|
+
this.setDisplay(false);
|
|
30
63
|
};
|
|
31
64
|
/**
|
|
32
65
|
* Method to set display prop
|
|
@@ -130,10 +163,7 @@ export class MgTooltip {
|
|
|
130
163
|
this.resetGuard();
|
|
131
164
|
this.setDisplay(false);
|
|
132
165
|
});
|
|
133
|
-
document.addEventListener('keydown',
|
|
134
|
-
if (event.code === 'Escape')
|
|
135
|
-
this.setDisplay(false);
|
|
136
|
-
});
|
|
166
|
+
document.addEventListener('keydown', this.pressEscape);
|
|
137
167
|
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
138
168
|
['mouseenter', 'mouseleave'].forEach(eventType => {
|
|
139
169
|
const isMouseenter = eventType === 'mouseenter';
|
|
@@ -170,6 +200,15 @@ export class MgTooltip {
|
|
|
170
200
|
/*************
|
|
171
201
|
* Lifecycle *
|
|
172
202
|
*************/
|
|
203
|
+
/**
|
|
204
|
+
* set variables
|
|
205
|
+
*
|
|
206
|
+
* @returns {void}
|
|
207
|
+
*/
|
|
208
|
+
componentWillLoad() {
|
|
209
|
+
// Get windows to attach events
|
|
210
|
+
this.windows = getWindows(window);
|
|
211
|
+
}
|
|
173
212
|
/**
|
|
174
213
|
* Get slotted element
|
|
175
214
|
* Check if it already contain an interactive element, if not we need to add a tabIndex attribute
|
|
@@ -75,22 +75,23 @@ export class MgInputNumeric {
|
|
|
75
75
|
*/
|
|
76
76
|
this.getInputError = () => {
|
|
77
77
|
let inputError = null;
|
|
78
|
-
|
|
78
|
+
const hasNotEmptyValues = (toControl) => !toControl.some(value => [null, undefined].includes(value));
|
|
79
|
+
if (!hasNotEmptyValues([this.input]))
|
|
79
80
|
return inputError;
|
|
80
81
|
// required
|
|
81
82
|
if (!this.input.checkValidity() && this.input.validity.valueMissing) {
|
|
82
83
|
inputError = InputError.REQUIRED;
|
|
83
84
|
}
|
|
84
85
|
// Min & Max
|
|
85
|
-
else if (this.min
|
|
86
|
+
else if (hasNotEmptyValues([this.min, this.numericValue]) && this.numericValue < this.min && this.max === undefined) {
|
|
86
87
|
// Only a min value is set
|
|
87
88
|
inputError = InputError.MIN;
|
|
88
89
|
}
|
|
89
|
-
else if (this.max
|
|
90
|
+
else if (hasNotEmptyValues([this.max, this.numericValue]) && this.numericValue > this.max && this.min === undefined) {
|
|
90
91
|
// Only a max value is set
|
|
91
92
|
inputError = InputError.MAX;
|
|
92
93
|
}
|
|
93
|
-
else if ((this.min
|
|
94
|
+
else if (hasNotEmptyValues([this.min, this.max, this.numericValue]) && (this.numericValue < this.min || this.numericValue > this.max)) {
|
|
94
95
|
// both min and max values are set
|
|
95
96
|
inputError = InputError.MINMAX;
|
|
96
97
|
}
|
|
@@ -140,7 +141,8 @@ export class MgInputNumeric {
|
|
|
140
141
|
this.hasFocus = false;
|
|
141
142
|
}
|
|
142
143
|
validateValue(newValue) {
|
|
143
|
-
|
|
144
|
+
// has input value is always render as string we get a stringified value or a '' for nullish value, so we test string type
|
|
145
|
+
if (typeof newValue === 'string') {
|
|
144
146
|
// Split number and decimal
|
|
145
147
|
const [integer, decimal = ''] = newValue.replace('-', '').split(/[\.,]/);
|
|
146
148
|
// Regex
|
|
@@ -160,7 +162,7 @@ export class MgInputNumeric {
|
|
|
160
162
|
if (this.input !== undefined)
|
|
161
163
|
this.input.value = this.value;
|
|
162
164
|
// emit numeric value
|
|
163
|
-
this.numericValue =
|
|
165
|
+
this.numericValue = !['', null].includes(this.value) ? parseFloat(this.value.replace(',', '.')) : null;
|
|
164
166
|
this.valueChange.emit(this.numericValue);
|
|
165
167
|
// Set readonlyValue
|
|
166
168
|
this.readonlyValue = this.numericValue !== null ? this.formatValue(this.numericValue) : '';
|
|
@@ -205,7 +207,7 @@ export class MgInputNumeric {
|
|
|
205
207
|
* Displayed value in input
|
|
206
208
|
* Change on focus/blur
|
|
207
209
|
*
|
|
208
|
-
* @returns {
|
|
210
|
+
* @returns {MgInputNumeric['value'] | MgInputNumeric['readonlyValue']} display value
|
|
209
211
|
*/
|
|
210
212
|
displayValue() {
|
|
211
213
|
return this.hasFocus ? this.value : this.readonlyValue;
|
|
@@ -223,11 +225,12 @@ export class MgInputNumeric {
|
|
|
223
225
|
const locales = initLocales(this.element);
|
|
224
226
|
this.locale = locales.locale;
|
|
225
227
|
this.messages = locales.messages;
|
|
226
|
-
// Validate
|
|
227
|
-
this.validateValue(this.value);
|
|
228
|
+
// Validate component config
|
|
228
229
|
this.validateType(this.type);
|
|
229
230
|
this.validateIntegerLength(this.integerLength);
|
|
230
231
|
this.validateDecimalLength(this.decimalLength);
|
|
232
|
+
// validate value
|
|
233
|
+
this.validateValue(this.value);
|
|
231
234
|
this.validateAppendSlot();
|
|
232
235
|
// Check validity when component is ready
|
|
233
236
|
// return a promise to process action only in the FIRST render().
|
|
@@ -232,7 +232,7 @@ export class MgMenu {
|
|
|
232
232
|
"mutable": false,
|
|
233
233
|
"complexType": {
|
|
234
234
|
"original": "ItemMoreType",
|
|
235
|
-
"resolved": "{ size: \"regular\" | \"
|
|
235
|
+
"resolved": "{ size: \"regular\" | \"medium\" | \"large\"; icon: IconType; slotlabel: SlotLabelType; }",
|
|
236
236
|
"references": {
|
|
237
237
|
"ItemMoreType": {
|
|
238
238
|
"location": "import",
|
|
@@ -294,7 +294,7 @@ export class MgMenuItem {
|
|
|
294
294
|
[`${this.navigationButton}-chevron`]: true,
|
|
295
295
|
[`${this.navigationButton}-chevron--rotate`]: this.expanded === true,
|
|
296
296
|
'mg-a11y-animation': true,
|
|
297
|
-
} }, h("mg-icon", { icon: "chevron-down" })))));
|
|
297
|
+
} }, h("mg-icon", { icon: "chevron-down", size: "small" })))));
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
300
300
|
* Render
|
|
@@ -40,7 +40,7 @@ export class MgDetails {
|
|
|
40
40
|
* @returns {HTMLElement} HTML Element
|
|
41
41
|
*/
|
|
42
42
|
render() {
|
|
43
|
-
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|
|
43
|
+
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|
|
44
44
|
}
|
|
45
45
|
static get is() { return "mg-details"; }
|
|
46
46
|
static get encapsulation() { return "shadow"; }
|
|
@@ -9,34 +9,15 @@
|
|
|
9
9
|
display: inline-block;
|
|
10
10
|
min-height: var(--default-size);
|
|
11
11
|
}
|
|
12
|
-
.mg-message__bar {
|
|
13
|
-
position: absolute;
|
|
14
|
-
top: 0;
|
|
15
|
-
left: 0;
|
|
16
|
-
width: 0.3rem;
|
|
17
|
-
height: 100%;
|
|
18
|
-
}
|
|
19
|
-
.mg-message.mg-message--info .mg-message__bar {
|
|
20
|
-
background-color: hsl(var(--color-info));
|
|
21
|
-
}
|
|
22
12
|
.mg-message.mg-message--info .mg-message__icon {
|
|
23
13
|
color: hsl(var(--color-info));
|
|
24
14
|
}
|
|
25
|
-
.mg-message.mg-message--warning .mg-message__bar {
|
|
26
|
-
background-color: hsl(var(--color-warning));
|
|
27
|
-
}
|
|
28
15
|
.mg-message.mg-message--warning .mg-message__icon {
|
|
29
16
|
color: hsl(var(--color-warning));
|
|
30
17
|
}
|
|
31
|
-
.mg-message.mg-message--success .mg-message__bar {
|
|
32
|
-
background-color: hsl(var(--color-success));
|
|
33
|
-
}
|
|
34
18
|
.mg-message.mg-message--success .mg-message__icon {
|
|
35
19
|
color: hsl(var(--color-success));
|
|
36
20
|
}
|
|
37
|
-
.mg-message.mg-message--danger .mg-message__bar {
|
|
38
|
-
background-color: hsl(var(--color-danger));
|
|
39
|
-
}
|
|
40
21
|
.mg-message.mg-message--danger .mg-message__icon {
|
|
41
22
|
color: hsl(var(--color-danger));
|
|
42
23
|
}
|
|
@@ -87,6 +68,7 @@
|
|
|
87
68
|
--mg-card-border-radius: var(--mg-card-border-radius-default);
|
|
88
69
|
--mg-card-background: var(--mg-card-background-default);
|
|
89
70
|
--mg-card-box-shadow: var(--mg-card-box-shadow-default);
|
|
71
|
+
--mg-card-max-width: unset;
|
|
90
72
|
}
|
|
91
73
|
|
|
92
74
|
.mg-message,
|
|
@@ -158,7 +158,7 @@ export class MgMessage {
|
|
|
158
158
|
* @returns {HTMLElement} HTML Element
|
|
159
159
|
*/
|
|
160
160
|
render() {
|
|
161
|
-
return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("mg-card",
|
|
161
|
+
return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("mg-card", { variant: this.variant, "variant-style": "bar-left" }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))))));
|
|
162
162
|
}
|
|
163
163
|
static get is() { return "mg-message"; }
|
|
164
164
|
static get encapsulation() { return "shadow"; }
|
|
@@ -213,9 +213,14 @@ export class MgMessage {
|
|
|
213
213
|
"type": "string",
|
|
214
214
|
"mutable": false,
|
|
215
215
|
"complexType": {
|
|
216
|
-
"original": "
|
|
217
|
-
"resolved": "
|
|
218
|
-
"references": {
|
|
216
|
+
"original": "VariantType",
|
|
217
|
+
"resolved": "\"danger\" | \"info\" | \"success\" | \"warning\"",
|
|
218
|
+
"references": {
|
|
219
|
+
"VariantType": {
|
|
220
|
+
"location": "import",
|
|
221
|
+
"path": "./mg-message.conf"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
219
224
|
},
|
|
220
225
|
"required": false,
|
|
221
226
|
"optional": false,
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
color: hsl(var(--mg-popover-font-color));
|
|
18
18
|
}
|
|
19
19
|
.mg-popover mg-card {
|
|
20
|
+
--mg-card-max-width: var(--mg-popover-max-width);
|
|
20
21
|
position: relative;
|
|
21
22
|
}
|
|
22
23
|
.mg-popover[data-show] {
|
|
@@ -115,4 +116,5 @@
|
|
|
115
116
|
--mg-card-border-radius: var(--mg-card-border-radius-default);
|
|
116
117
|
--mg-card-background: var(--mg-card-background-default);
|
|
117
118
|
--mg-card-box-shadow: var(--mg-card-box-shadow-default);
|
|
119
|
+
--mg-card-max-width: unset;
|
|
118
120
|
}
|
|
@@ -98,6 +98,9 @@
|
|
|
98
98
|
/* Shadow */
|
|
99
99
|
--box-shadow: 0 0.3rem 0.8rem 0 hsl(var(--color-dark), 0.15);
|
|
100
100
|
|
|
101
|
+
/* Soft style */
|
|
102
|
+
--mg-color-soft-l: 90%;
|
|
103
|
+
|
|
101
104
|
/*
|
|
102
105
|
Global
|
|
103
106
|
*/
|
|
@@ -109,8 +112,10 @@
|
|
|
109
112
|
*/
|
|
110
113
|
--mg-icon-small-size: 1.2rem;
|
|
111
114
|
--mg-icon-regular-size: 1.6rem;
|
|
115
|
+
--mg-icon-medium-size: 2rem;
|
|
112
116
|
--mg-icon-large-size: 2.4rem;
|
|
113
|
-
--mg-icon-extra-large-size: 3.
|
|
117
|
+
--mg-icon-extra-large-size: 3.2rem;
|
|
118
|
+
--mg-icon-border-radius: 50%;
|
|
114
119
|
|
|
115
120
|
/*
|
|
116
121
|
<mg-button>
|
|
@@ -160,6 +165,7 @@
|
|
|
160
165
|
--mg-popover-background-color: var(--color-light);
|
|
161
166
|
--mg-popover-font-color: var(--color-font-dark);
|
|
162
167
|
--mg-popover-title-font-size: 1.4rem;
|
|
168
|
+
--mg-popover-max-width: 40rem;
|
|
163
169
|
|
|
164
170
|
/*
|
|
165
171
|
<mg-message>
|
|
@@ -10,7 +10,7 @@ import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
|
10
10
|
import { d as defineCustomElement$4 } from './mg-menu2.js';
|
|
11
11
|
import { d as defineCustomElement$2 } from './mg-popover2.js';
|
|
12
12
|
|
|
13
|
-
const mgActionMoreCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{--mg-popover-padding-vertical:1rem;--mg-popover-padding-horizontal:0}.mg-action-more__chevron{transition:200ms}.mg-action-more__chevron--rotate.mg-action-more__chevron{transform:rotate(180deg)}";
|
|
13
|
+
const mgActionMoreCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{--mg-popover-padding-vertical:1rem;--mg-popover-padding-horizontal:0;--mg-popover-max-width:unset}.mg-action-more__chevron{transition:200ms}.mg-action-more__chevron--rotate.mg-action-more__chevron{transform:rotate(180deg)}";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* MgActionMore['items'] type guard
|
|
@@ -1,26 +1,80 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { C as ClassList } from './components.utils.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* List available variants
|
|
6
|
+
*/
|
|
7
|
+
const variants = ['info', 'warning', 'success', 'danger', 'app'];
|
|
8
|
+
/**
|
|
9
|
+
* List available variant styles
|
|
10
|
+
*/
|
|
11
|
+
const variantStyles = ['bar-left', 'fill'];
|
|
12
|
+
|
|
13
|
+
const mgCardCss = ".mg-card{position:relative;width:100%;max-width:var(--mg-card-max-width);padding:var(--mg-card-padding, var(--mg-card-padding-default));overflow:var(--mg-card-overflow, var(--mg-card-overflow-default));box-sizing:border-box;z-index:inherit;background:var(--mg-card-background, var(--mg-card-background-default));border:var(--mg-card-border, var(--mg-card-border-default));border-radius:var(--mg-card-border-radius, var(--mg-card-border-radius-default));box-shadow:var(--mg-card-box-shadow, var(--mg-card-box-shadow-default))}.mg-card ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset}.mg-card.mg-card--info{overflow:hidden}.mg-card.mg-card--info.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-card.mg-card--info.mg-card--fill{background-color:hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l))}.mg-card.mg-card--warning{overflow:hidden}.mg-card.mg-card--warning.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--color-warning-l))}.mg-card.mg-card--warning.mg-card--fill{background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l))}.mg-card.mg-card--success{overflow:hidden}.mg-card.mg-card--success.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-card.mg-card--success.mg-card--fill{background-color:hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l))}.mg-card.mg-card--danger{overflow:hidden}.mg-card.mg-card--danger.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-card.mg-card--danger.mg-card--fill{background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l))}.mg-card.mg-card--app{overflow:hidden}.mg-card.mg-card--app.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-app-l))}.mg-card.mg-card--app.mg-card--fill{background-color:hsl(var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-soft-l))}.mg-card__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}";
|
|
4
14
|
|
|
5
15
|
const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
16
|
constructor() {
|
|
7
17
|
super();
|
|
8
18
|
this.__registerHost();
|
|
9
19
|
this.__attachShadow();
|
|
20
|
+
/*************
|
|
21
|
+
* Private *
|
|
22
|
+
*************/
|
|
23
|
+
this.name = 'mg-card';
|
|
24
|
+
this.baseClass = this.name;
|
|
25
|
+
this.variant = undefined;
|
|
26
|
+
this.variantStyle = undefined;
|
|
27
|
+
this.classList = new ClassList([this.baseClass]);
|
|
28
|
+
}
|
|
29
|
+
validateVariant(newValue, oldValue) {
|
|
30
|
+
if (newValue && !variants.includes(newValue))
|
|
31
|
+
throw new Error(`<${this.name}> prop "variant" must match VariantType type.`);
|
|
32
|
+
if (Boolean(newValue)) {
|
|
33
|
+
if (this.variantStyle === undefined)
|
|
34
|
+
this.variantStyle = 'bar-left';
|
|
35
|
+
this.classList.add(`${this.baseClass}--${newValue}`);
|
|
36
|
+
}
|
|
37
|
+
if (Boolean(oldValue))
|
|
38
|
+
this.classList.delete(`${this.baseClass}--${oldValue}`);
|
|
39
|
+
}
|
|
40
|
+
validateVariantStyle(newValue, oldValue) {
|
|
41
|
+
if (newValue && !variantStyles.includes(newValue))
|
|
42
|
+
throw new Error(`<${this.name}> prop "variantStyle" must match VariantStyleType type.`);
|
|
43
|
+
else if (Boolean(newValue) && !variants.includes(this.variant))
|
|
44
|
+
throw new Error(`<${this.name}> prop "variantStyle" must be paired with ${JSON.stringify(variants)} "variant" prop.`);
|
|
45
|
+
if (Boolean(newValue))
|
|
46
|
+
this.classList.add(`${this.baseClass}--${newValue}`);
|
|
47
|
+
if (Boolean(oldValue))
|
|
48
|
+
this.classList.delete(`${this.baseClass}--${oldValue}`);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Check if props are well configured on init
|
|
52
|
+
*
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
componentWillLoad() {
|
|
56
|
+
this.validateVariant(this.variant);
|
|
57
|
+
this.validateVariantStyle(this.variantStyle);
|
|
10
58
|
}
|
|
11
|
-
/*************
|
|
12
|
-
* Lifecycle *
|
|
13
|
-
*************/
|
|
14
59
|
/**
|
|
15
60
|
* Render
|
|
16
61
|
*
|
|
17
62
|
* @returns {HTMLElement} HTML Element
|
|
18
63
|
*/
|
|
19
64
|
render() {
|
|
20
|
-
|
|
65
|
+
var _a;
|
|
66
|
+
return (h("div", { class: this.classList.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && h("span", { class: "mg-card__bar" }), h("slot", null)));
|
|
21
67
|
}
|
|
68
|
+
static get watchers() { return {
|
|
69
|
+
"variant": ["validateVariant"],
|
|
70
|
+
"variantStyle": ["validateVariantStyle"]
|
|
71
|
+
}; }
|
|
22
72
|
static get style() { return mgCardCss; }
|
|
23
|
-
}, [1, "mg-card"
|
|
73
|
+
}, [1, "mg-card", {
|
|
74
|
+
"variant": [1],
|
|
75
|
+
"variantStyle": [1025, "variant-style"],
|
|
76
|
+
"classList": [32]
|
|
77
|
+
}]);
|
|
24
78
|
function defineCustomElement() {
|
|
25
79
|
if (typeof customElements === "undefined") {
|
|
26
80
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
3
3
|
|
|
4
|
-
const mgDetailsCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-details summary{display:flex;align-items:baseline;cursor:pointer}.mg-details__toggle{margin-left:1.5rem;flex-shrink:0;display:flex;align-items:center;align-self:flex-start;gap:0.6rem;min-height:calc(var(--font-size) * var(--line-height))}.mg-
|
|
4
|
+
const mgDetailsCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-details summary{display:flex;align-items:baseline;cursor:pointer}.mg-details__toggle{margin-left:1.5rem;flex-shrink:0;display:flex;align-items:center;align-self:flex-start;gap:0.6rem;min-height:calc(var(--font-size) * var(--line-height))}.mg-details__details{margin-top:1.5rem}";
|
|
5
5
|
|
|
6
6
|
const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -48,7 +48,7 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
48
48
|
* @returns {HTMLElement} HTML Element
|
|
49
49
|
*/
|
|
50
50
|
render() {
|
|
51
|
-
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|
|
51
|
+
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|
|
52
52
|
}
|
|
53
53
|
static get watchers() { return {
|
|
54
54
|
"toggleClosed": ["validateTitles"],
|