@mgdis/mg-components 6.17.0 → 6.19.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/cjs/{index-DCZEYvlH.js → index-Bp6wZzau.js} +5 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +438 -212
- package/dist/cjs/mg-alert.cjs.entry.js +2 -2
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
- package/dist/cjs/mg-input-combobox.cjs.entry.js +93 -80
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +35 -26
- package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-D7jmj_lh.js} +7 -0
- package/dist/cjs/mg-loader.cjs.entry.js +2 -2
- package/dist/cjs/mg-progress.cjs.entry.js +2 -2
- package/dist/collection/assets/icons/index.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +5 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +178 -18
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +36 -16
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +98 -78
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +41 -22
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +32 -12
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +30 -12
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +31 -12
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +41 -25
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +31 -12
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +60 -40
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +35 -33
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +36 -11
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +5 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +13 -4
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +40 -9
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-alert.js +1 -1
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-fieldset.d.ts +11 -0
- package/dist/components/mg-fieldset.js +209 -0
- package/dist/components/mg-form.js +4 -3
- package/dist/components/mg-icon2.js +1 -1
- package/dist/components/mg-illustrated-message.js +2 -2
- package/dist/components/mg-input-checkbox-paginated2.js +1 -1
- package/dist/components/mg-input-checkbox.js +29 -16
- package/dist/components/mg-input-combobox.js +92 -79
- package/dist/components/mg-input-date.js +34 -22
- package/dist/components/mg-input-numeric.js +25 -12
- package/dist/components/mg-input-password.js +23 -12
- package/dist/components/mg-input-radio.js +23 -11
- package/dist/components/mg-input-rich-text-editor.js +33 -24
- package/dist/components/mg-input-select2.js +24 -12
- package/dist/components/mg-input-text2.js +51 -39
- package/dist/components/mg-input-textarea.js +28 -33
- package/dist/components/mg-input-toggle.js +35 -10
- package/dist/components/mg-input2.js +119 -19
- package/dist/components/mg-item-more2.js +5 -1
- package/dist/components/mg-loader2.js +1 -1
- package/dist/components/mg-message2.js +2 -2
- package/dist/components/mg-modal.js +3 -3
- package/dist/components/mg-panel.js +37 -8
- package/dist/components/mg-popover-content2.js +2 -2
- package/dist/components/mg-popover2.js +2 -2
- package/dist/components/mg-progress.js +1 -1
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs2.js +1 -1
- package/dist/esm/{index-T6kOJXP1.js → index-BluNKQ3L.js} +5 -1
- package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +439 -213
- package/dist/esm/mg-alert.entry.js +3 -3
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-fieldset.entry.js +139 -0
- package/dist/esm/mg-input-combobox.entry.js +94 -81
- package/dist/esm/mg-input-rich-text-editor.entry.js +36 -27
- package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-DDnrE1hD.js} +6 -1
- package/dist/esm/mg-loader.entry.js +3 -3
- package/dist/esm/mg-progress.entry.js +3 -3
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-016bd291.entry.js +1 -0
- package/dist/mg-components/{p-397bf67b.entry.js → p-186a6139.entry.js} +1 -1
- package/dist/mg-components/p-66a1cb83.entry.js +1 -0
- package/dist/mg-components/p-6efd819f.entry.js +1 -0
- package/dist/mg-components/{p-c5da335e.entry.js → p-916dfb6d.entry.js} +1 -1
- package/dist/mg-components/p-BluNKQ3L.js +2 -0
- package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
- package/dist/mg-components/p-DDnrE1hD.js +1 -0
- package/dist/mg-components/{p-0e6b40d6.entry.js → p-d2c72f09.entry.js} +1 -1
- package/dist/mg-components/{p-5dc3a1fb.entry.js → p-d5a276eb.entry.js} +1 -1
- package/dist/types/assets/icons/index.d.ts +9 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +6 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +8 -7
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -3
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +5 -7
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -8
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
- package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
- package/dist/types/components.d.ts +168 -18
- package/ide/intellij/web-types.json +289 -22
- package/ide/vscode/css-custom-data.json +7 -3
- package/ide/vscode/html-custom-data.json +300 -8
- package/package.json +18 -18
- package/dist/mg-components/p-8a69175b.entry.js +0 -1
- package/dist/mg-components/p-CNgv8hc5.js +0 -1
- package/dist/mg-components/p-T6kOJXP1.js +0 -2
- package/dist/mg-components/p-d84d87ea.entry.js +0 -1
|
@@ -6,7 +6,7 @@ import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
|
6
6
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
7
7
|
import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
|
|
8
8
|
|
|
9
|
-
const mgInputToggleCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__toggle-item-container{overflow:hidden;box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border:
|
|
9
|
+
const mgInputToggleCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__toggle-item-container{overflow:hidden;box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-width:var(--mg-b-size-border);border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4))/var(--mg-c-input-toggle-border-radius-ratio));color:var(--mg-b-color-neutral-110);font-weight:unset;text-overflow:ellipsis;white-space:nowrap}.mg-c-input__toggle-item-container:first-of-type{border-style:solid;border-color:var(--mg-b-color-neutral-80);background-color:var(--mg-b-color-light);font-weight:600}.mg-c-input__button-toggle{display:flex;overflow:hidden;min-width:0;align-items:center;padding:.1rem;border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-b-color-neutral-80);border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*(var(--mg-b-size-4) + var(--mg-b-size-4) + var(--mg-c-input-border-width)))/var(--mg-c-input-toggle-border-radius-ratio));background-color:var(--mg-b-color-neutral-20);cursor:pointer;font-family:var(--mg-b-font-family);font-size:var(--mg-b-small-font-size);line-height:var(--mg-b-size-12)}.mg-c-input__button-toggle:disabled{cursor:default}.mg-c-input__button-toggle:focus{outline-offset:var(--mg-b-size-4)}.mg-c-input.mg-c-input--toggle:not(.mg-c-input--readonly) .mg-c-input__button-toggle{margin-top:var(--mg-b-size-4)}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__button-toggle{background-color:var(--mg-b-color-neutral-110)}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{border:unset;background-color:unset;color:var(--mg-b-color-light);font-weight:unset}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{border-style:solid;background-color:var(--mg-b-color-neutral-20);font-weight:600}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__button-toggle{width:100%;min-width:calc(var(--mg-b-size-20)*2);max-width:calc(var(--mg-b-size-20)*2)}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container{display:flex;overflow:unset;min-width:var(--mg-b-size-20);max-width:var(--mg-b-size-20);height:var(--mg-b-size-20);align-items:center;justify-content:center;padding:0;visibility:hidden}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:first-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:last-of-type{width:unset}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{min-width:unset;visibility:hidden}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{margin-left:auto;visibility:visible}.mg-c-input.mg-c-input--toggle-on-off.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:first-of-type ::slotted(*){display:none}";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* type Option validation function
|
|
@@ -41,7 +41,9 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
41
41
|
*/
|
|
42
42
|
this.labelHide = false;
|
|
43
43
|
/**
|
|
44
|
-
* Define if toggle have on/off style
|
|
44
|
+
* Define if toggle have on/off style,
|
|
45
|
+
* the left icon is hidden.
|
|
46
|
+
* Only available in combination with the "isIcon" prop.
|
|
45
47
|
*/
|
|
46
48
|
this.isOnOff = false;
|
|
47
49
|
/**
|
|
@@ -76,7 +78,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
76
78
|
// Set error message
|
|
77
79
|
this.errorMessage = undefined;
|
|
78
80
|
// Does have a custom error message
|
|
79
|
-
if (!this.valid && errorMessage
|
|
81
|
+
if (!this.valid && typeof errorMessage === 'string') {
|
|
80
82
|
this.errorMessage = errorMessage;
|
|
81
83
|
}
|
|
82
84
|
};
|
|
@@ -91,14 +93,31 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
91
93
|
*/
|
|
92
94
|
this.validateSlots = () => {
|
|
93
95
|
const slots = Array.from(this.element.children);
|
|
96
|
+
// validate slots
|
|
94
97
|
if (slots.length !== 2) {
|
|
95
|
-
|
|
98
|
+
if (this.isOnOff && this.isIcon) {
|
|
99
|
+
// ONLY slot="item-2" is required in with isOnOff && isIcon
|
|
100
|
+
if (this.element.querySelector('[slot="item-2"]') === null) {
|
|
101
|
+
throw new Error('<mg-input-toggle> an element with attribute slot="item-2" is required.');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
throw new Error('<mg-input-toggle> 2 slots are required.');
|
|
106
|
+
}
|
|
96
107
|
}
|
|
97
|
-
|
|
108
|
+
// update slots
|
|
109
|
+
if (!this.isIcon) {
|
|
98
110
|
// Due to text-overflow set to ellipsis
|
|
99
111
|
// we need to ensure that slot element have title to display value on mouse over
|
|
100
112
|
slots.forEach(slot => slot.setAttribute('title', slot.textContent));
|
|
101
113
|
}
|
|
114
|
+
else {
|
|
115
|
+
slots.forEach(slot => {
|
|
116
|
+
if (slot.nodeName === 'MG-ICON') {
|
|
117
|
+
slot.size = 'small';
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
102
121
|
};
|
|
103
122
|
/**
|
|
104
123
|
* Get checked item
|
|
@@ -139,10 +158,16 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
139
158
|
}
|
|
140
159
|
}
|
|
141
160
|
watchIsOnOff(newValue) {
|
|
142
|
-
if (newValue)
|
|
161
|
+
if (newValue) {
|
|
143
162
|
this.classCollection.add(this.classOnOff);
|
|
144
|
-
|
|
163
|
+
if (!this.isIcon) {
|
|
164
|
+
this.isOnOff = false;
|
|
165
|
+
console.warn('<mg-input-toggle> prop "isOnOff" must be used with "isIcon". Setting isOnOff to false.');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
145
169
|
this.classCollection.delete(this.classOnOff);
|
|
170
|
+
}
|
|
146
171
|
}
|
|
147
172
|
watchIsIcon(newValue) {
|
|
148
173
|
if (newValue)
|
|
@@ -190,7 +215,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
190
215
|
if (typeof valid !== 'boolean') {
|
|
191
216
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
|
|
192
217
|
}
|
|
193
|
-
else if (!isValidString(errorMessage)) {
|
|
218
|
+
else if (errorMessage !== undefined && !isValidString(errorMessage)) {
|
|
194
219
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
|
|
195
220
|
}
|
|
196
221
|
else {
|
|
@@ -267,7 +292,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
267
292
|
*/
|
|
268
293
|
render() {
|
|
269
294
|
const checkedItem = this.getCheckedItem(this.checked);
|
|
270
|
-
return (h("mg-input", { key: '
|
|
295
|
+
return (h("mg-input", { key: '4d87ed13bbd3d3a54303c21001247e1251417326', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked, ref: el => {
|
|
271
296
|
if (el !== null)
|
|
272
297
|
this.button = el;
|
|
273
298
|
} }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
|
|
@@ -291,7 +316,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
291
316
|
"label": [1],
|
|
292
317
|
"labelOnTop": [4, "label-on-top"],
|
|
293
318
|
"labelHide": [4, "label-hide"],
|
|
294
|
-
"isOnOff": [
|
|
319
|
+
"isOnOff": [1028, "is-on-off"],
|
|
295
320
|
"isIcon": [4, "is-icon"],
|
|
296
321
|
"readonly": [4],
|
|
297
322
|
"disabled": [4],
|
|
@@ -13,12 +13,17 @@ const widths = [2, 4, 16, 'full'];
|
|
|
13
13
|
* Possible tootltip postions
|
|
14
14
|
*/
|
|
15
15
|
const tooltipPositions = ['input', 'label'];
|
|
16
|
+
/**
|
|
17
|
+
* Possible label headings
|
|
18
|
+
*/
|
|
19
|
+
const labelHeadings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
16
20
|
const classFieldset = 'mg-c-input--fieldset';
|
|
17
21
|
const classDisabled = 'mg-c-input--disabled';
|
|
18
22
|
const classReadonly = 'mg-c-input--readonly';
|
|
19
23
|
const classVerticalList = 'mg-c-input--vertical-list';
|
|
24
|
+
const classDisplayCharacterLeft = 'mg-c-input--display-character-left';
|
|
20
25
|
|
|
21
|
-
const mgInputCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-input-border-width: Defines the width of the input border. Default value is `--mg-b-size-border`.\n * @prop --mg-c-input-border-radius: Defines the border radius of the input. Default value is `--mg-b-size-radius`.\n * @prop --mg-c-input-color-border: Defines the color of the input border. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-placeholder-color-text: Defines the color of the placeholder text. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-color-box-shadow-focus: Defines the shadow color of the input when focused. Default value is `rgba(0, 221, 255, 0.5)`.\n * @prop --mg-c-input-error-color-background: Defines the background color of the input error message. Default value is `color-mix(in srgb, var(--mg-b-color-danger), white 95%)`.\n * @prop --mg-c-input-toggle-border-radius-ratio: Defines the border radius ratio of the input toggle. Default value is `2`.\n * @prop --mg-c-input-check-size: Defines the size of the input check. Default value is `--mg-b-size-16`.\n */:host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;min-height:var(--mg-b-size-min-height);align-items:flex-start}.mg-c-input__input-container{width:100%;min-height:var(--mg-b-size-min-height)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-b-size-16);height:var(--mg-b-size-16);margin-left:var(--mg-b-size-8)}@media print{.mg-c-input__input-container mg-tooltip{display:none}}.mg-c-input__input{display:flex;min-height:var(--mg-b-size-min-height);align-items:center;justify-content:start}.mg-c-input__input mg-tooltip{align-self:baseline;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input ::slotted(.mg-c-input__button-toggle:disabled){opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input__title{display:flex;width:var(--mg-c-input-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);margin-right:var(--mg-c-input-title-horizontal-space, var(--mg-b-size-8));text-align:right}.mg-c-input__title slot[name=label]+mg-tooltip{margin-left:var(--mg-b-size-4)}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input__error{display:inline-block;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-b-size-radius);background:var(--mg-c-input-error-color-background);color:var(--mg-b-color-danger)}.mg-c-input__error ::slotted(*),.mg-c-input__help-text ::slotted(*){font-size:var(--mg-b-font-size-small);text-align:start}:host
|
|
26
|
+
const mgInputCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-input-border-width: Defines the width of the input border. Default value is `--mg-b-size-border`.\n * @prop --mg-c-input-border-radius: Defines the border radius of the input. Default value is `--mg-b-size-radius`.\n * @prop --mg-c-input-color-border: Defines the color of the input border. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-placeholder-color-text: Defines the color of the placeholder text. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-color-box-shadow-focus: Defines the shadow color of the input when focused. Default value is `rgba(0, 221, 255, 0.5)`.\n * @prop --mg-c-input-error-color-background: Defines the background color of the input error message. Default value is `color-mix(in srgb, var(--mg-b-color-danger), white 95%)`.\n * @prop --mg-c-input-toggle-border-radius-ratio: Defines the border radius ratio of the input toggle. Default value is `2`.\n * @prop --mg-c-input-check-size: Defines the size of the input check. Default value is `--mg-b-size-16`.\n */:host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;min-height:var(--mg-b-size-min-height);align-items:flex-start}.mg-c-input__input-container{width:100%;min-height:var(--mg-b-size-min-height)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-b-size-16);height:var(--mg-b-size-16);margin-left:var(--mg-b-size-8)}@media print{.mg-c-input__input-container mg-tooltip{display:none}}.mg-c-input__input{display:flex;min-height:var(--mg-b-size-min-height);align-items:center;justify-content:start}.mg-c-input__input mg-tooltip{align-self:baseline;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input ::slotted(.mg-c-input__button-toggle:disabled){opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input__title{display:flex;width:var(--mg-c-input-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);margin-right:var(--mg-c-input-title-horizontal-space, var(--mg-b-size-8));text-align:right}.mg-c-input__title slot[name=label]+mg-tooltip{margin-left:var(--mg-b-size-4)}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input__error{display:inline-block;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-b-size-radius);background:var(--mg-c-input-error-color-background);color:var(--mg-b-color-danger)}.mg-c-input__error ::slotted(*),.mg-c-input__help-text ::slotted(*){font-size:var(--mg-b-font-size-small);text-align:start}:host .mg-c-input__input+.mg-c-input__error,:host .mg-c-input__input+.mg-c-input__help-text{margin-top:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--readonly) .mg-c-input__input mg-tooltip{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}:host(.mg-c-input){display:flex;margin-bottom:var(--mg-c-input-margin-bottom, 0)}:host(.mg-c-input.mg-c-input--checkbox) .mg-c-input__input,:host(.mg-c-input.mg-c-input--toggle) .mg-c-input__input,:host(.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset;align-items:flex-start}:host(.mg-c-input.mg-c-input--checkbox,.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset}:host(.mg-c-input.mg-c-input--fieldset:not(.mg-c-input--checkbox-multi,.mg-c-input--readonly)) .mg-c-input__input-container mg-tooltip{margin-left:var(--mg-b-size-32)}:host(.mg-c-input.mg-c-input--toggle) .mg-c-input__input-container{min-width:0;flex:1}:host(.mg-c-input.mg-c-input--label-on-top){flex-direction:column}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}:host(.mg-c-input.mg-c-input--inputs-on-bottom) .mg-c-input__help-text{margin-top:var(--mg-b-size-4);margin-bottom:var(--mg-b-size-12)}:host(.mg-c-input.mg-c-input--inputs-on-bottom) .mg-c-input__error{margin-bottom:var(--mg-b-size-20)}:host(.mg-c-input.mg-c-input--inputs-on-bottom.mg-c-input--fieldset){--mg-c-input-title-width:var(--mg-c-form-inputs-title-width, calc(28 * var(--mg-b-size-8)));--mg-c-input-title-horizontal-space:var(--mg-b-size-32)}:host(.mg-c-input.mg-c-input--inputs-on-bottom.mg-c-input--fieldset) ::slotted(*){--mg-c-input-margin-bottom:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--label-border-display) .mg-c-input__title{border-bottom:var(--mg-b-size-border) solid var(--mg-c-divider-color-background)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__title{margin-bottom:0}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input-title__text{margin-top:var(--mg-b-font-size-8);margin-bottom:var(--mg-b-font-size-8)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text,:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__error{margin-top:0;margin-bottom:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text+.mg-c-input__input,:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__error+.mg-c-input__input{margin-top:var(--mg-b-size-12)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text+.mg-c-input__error{margin-top:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__title{margin-bottom:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text,:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__error{margin-bottom:0}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text+.mg-c-input__input,:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__error+.mg-c-input__input{margin-top:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text+.mg-c-input__error{margin-top:var(--mg-b-size-8)}@media screen and (max-width: 767px){:host(.mg-c-input){flex-direction:column}:host(.mg-c-input) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}}";
|
|
22
27
|
|
|
23
28
|
const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLElement {
|
|
24
29
|
constructor(registerHost) {
|
|
@@ -34,6 +39,9 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
34
39
|
this.classInput = 'mg-c-input';
|
|
35
40
|
this.classHasError = 'mg-c-input--has-error';
|
|
36
41
|
this.classLabelOnTop = 'mg-c-input--label-on-top';
|
|
42
|
+
this.classHasHeading = 'mg-c-input--has-heading';
|
|
43
|
+
this.classLabelBorderDisplay = 'mg-c-input--label-border-display';
|
|
44
|
+
this.classInputsOnBottom = 'mg-c-input--inputs-on-bottom';
|
|
37
45
|
/**
|
|
38
46
|
* Define if label is displayed on top
|
|
39
47
|
*/
|
|
@@ -42,6 +50,11 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
42
50
|
* Define if label is visible
|
|
43
51
|
*/
|
|
44
52
|
this.labelHide = false;
|
|
53
|
+
/**
|
|
54
|
+
* Define if label border is visible
|
|
55
|
+
* You must pair this mode with `labelOnTop`and `fieldset` class
|
|
56
|
+
*/
|
|
57
|
+
this.labelBorderDisplay = false;
|
|
45
58
|
/**
|
|
46
59
|
* Define tooltip position
|
|
47
60
|
*/
|
|
@@ -50,6 +63,10 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
50
63
|
* Define if input is required
|
|
51
64
|
*/
|
|
52
65
|
this.required = false;
|
|
66
|
+
/**
|
|
67
|
+
* Display inputs after help-text and error message
|
|
68
|
+
*/
|
|
69
|
+
this.inputsOnBottom = false;
|
|
53
70
|
/**
|
|
54
71
|
* Define aria-describedby ids to link with
|
|
55
72
|
*/
|
|
@@ -70,11 +87,44 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
70
87
|
* Element is disabled
|
|
71
88
|
*/
|
|
72
89
|
this.isVerticalList = false;
|
|
90
|
+
/************
|
|
91
|
+
* Methods *
|
|
92
|
+
************/
|
|
93
|
+
/**
|
|
94
|
+
* Update element aria-describedby
|
|
95
|
+
* @param element - element to update
|
|
96
|
+
* @param ariaDescribedbyIDs - ariaDescribedbyIDs references
|
|
97
|
+
*/
|
|
98
|
+
this.updateElementAriaDescribedby = (element, ariaDescribedbyIDs) => {
|
|
99
|
+
if (ariaDescribedbyIDs.size > 0) {
|
|
100
|
+
element.setAttribute('aria-describedby', Array.from(ariaDescribedbyIDs).join(' '));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
element.removeAttribute('aria-describedby');
|
|
104
|
+
}
|
|
105
|
+
};
|
|
73
106
|
/**
|
|
74
107
|
* Get tooltip node
|
|
75
108
|
* @returns mg-tooltip
|
|
76
109
|
*/
|
|
77
110
|
this.renderTooltip = () => (h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, h("mg-icon", { icon: "info-circle" })));
|
|
111
|
+
/**
|
|
112
|
+
* Get input container element
|
|
113
|
+
* @returns ordered elements
|
|
114
|
+
*/
|
|
115
|
+
this.inputContainerElements = () => {
|
|
116
|
+
const elements = [
|
|
117
|
+
this.helptextMessageSlotElement && (h("div", { class: "mg-c-input__help-text" }, h("slot", { name: this.slotHelpText }))),
|
|
118
|
+
!this.isDisabled && this.errorMessage && (h("div", { class: "mg-c-input__error", "aria-live": "assertive" }, h("slot", { name: this.slotError }))),
|
|
119
|
+
];
|
|
120
|
+
const inputSlot = (h("div", { class: "mg-c-input__input" }, h("slot", null), this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()));
|
|
121
|
+
if (this.inputsOnBottom) {
|
|
122
|
+
return [...elements, inputSlot];
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return [inputSlot, ...elements];
|
|
126
|
+
}
|
|
127
|
+
};
|
|
78
128
|
}
|
|
79
129
|
watchIdentifier(newValue) {
|
|
80
130
|
if (!isValidString(newValue)) {
|
|
@@ -101,6 +151,26 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
101
151
|
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
|
|
102
152
|
}
|
|
103
153
|
}
|
|
154
|
+
watchlabelHeading(newValue) {
|
|
155
|
+
if (this.isFieldset && this.labelOnTop && labelHeadings.includes(newValue)) {
|
|
156
|
+
this.element.classList.add(this.classHasHeading);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
if ((!this.isFieldset && newValue !== undefined) || typeof newValue === 'string') {
|
|
160
|
+
throw new Error(`<mg-input> prop "labelHeading" must be used with a fieldset and be one of: ${labelHeadings.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
161
|
+
}
|
|
162
|
+
this.labelHeading = undefined;
|
|
163
|
+
this.element.classList.remove(this.classHasHeading);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
watchLabelBorderDisplay(newValue) {
|
|
167
|
+
if (this.isFieldset && this.labelOnTop && newValue) {
|
|
168
|
+
this.element.classList.add(this.classLabelBorderDisplay);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.element.classList.remove(this.classLabelBorderDisplay);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
104
174
|
watchTooltipPosition(newValue) {
|
|
105
175
|
if (!tooltipPositions.includes(newValue)) {
|
|
106
176
|
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
@@ -120,7 +190,7 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
120
190
|
}
|
|
121
191
|
watchHelpText(newValue) {
|
|
122
192
|
var _a;
|
|
123
|
-
if (newValue && !this.isReadonly) {
|
|
193
|
+
if (isValidString(newValue) && !this.isReadonly) {
|
|
124
194
|
this.renderHelpText();
|
|
125
195
|
}
|
|
126
196
|
else {
|
|
@@ -128,6 +198,14 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
128
198
|
this.helptextMessageSlotElement = undefined;
|
|
129
199
|
}
|
|
130
200
|
}
|
|
201
|
+
watchInputsOnBottom(newValue) {
|
|
202
|
+
if (newValue) {
|
|
203
|
+
this.element.classList.add(this.classInputsOnBottom);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
this.element.classList.remove(this.classInputsOnBottom);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
131
209
|
watchAriaDescribedbyIDs() {
|
|
132
210
|
if (this.isReadonly) {
|
|
133
211
|
return;
|
|
@@ -143,23 +221,26 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
143
221
|
// a11y IDs
|
|
144
222
|
const ariaDescribedbyIDs = new Set(this.ariaDescribedbyIDs);
|
|
145
223
|
// Help text
|
|
146
|
-
if (this.helpText
|
|
224
|
+
if (isValidString(this.helpText)) {
|
|
147
225
|
this.renderHelpText();
|
|
148
226
|
if (!ariaDescribedbyIDs.has(this.helpTextId))
|
|
149
227
|
ariaDescribedbyIDs.add(this.helpTextId);
|
|
150
228
|
}
|
|
151
229
|
// Error Message
|
|
152
|
-
if (this.errorMessage
|
|
230
|
+
if (isValidString(this.errorMessage)) {
|
|
153
231
|
this.renderErrorMessage();
|
|
154
232
|
if (!ariaDescribedbyIDs.has(this.helpTextErrorId))
|
|
155
233
|
ariaDescribedbyIDs.add(this.helpTextErrorId);
|
|
156
234
|
}
|
|
157
|
-
this.element.querySelectorAll('input,select,textarea,[role="switch"]')
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
235
|
+
const inputs = this.element.querySelectorAll('input,select,textarea,[role="switch"]');
|
|
236
|
+
inputs.forEach((element) => {
|
|
237
|
+
this.updateElementAriaDescribedby(element, ariaDescribedbyIDs);
|
|
238
|
+
});
|
|
239
|
+
// use timeout to await for legend render for componentWillLoad hook
|
|
240
|
+
setTimeout(() => {
|
|
241
|
+
const legend = this.element.querySelector('legend');
|
|
242
|
+
if (legend !== null) {
|
|
243
|
+
this.updateElementAriaDescribedby(legend, ariaDescribedbyIDs);
|
|
163
244
|
}
|
|
164
245
|
});
|
|
165
246
|
}
|
|
@@ -189,9 +270,6 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
189
270
|
this.renderLabel();
|
|
190
271
|
}
|
|
191
272
|
}
|
|
192
|
-
/************
|
|
193
|
-
* Methods *
|
|
194
|
-
************/
|
|
195
273
|
/**
|
|
196
274
|
* Render input label
|
|
197
275
|
*/
|
|
@@ -211,11 +289,21 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
211
289
|
labelSlotElement.setAttribute(attr, val);
|
|
212
290
|
});
|
|
213
291
|
// create label element
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
292
|
+
if (labelHeadings.includes(this.labelHeading)) {
|
|
293
|
+
let label = this.element.shadowRoot.querySelector(this.labelHeading);
|
|
294
|
+
if (label === null) {
|
|
295
|
+
label = document.createElement(this.labelHeading);
|
|
296
|
+
label.classList.add('mg-c-input-title__text');
|
|
297
|
+
labelSlotElement.appendChild(label);
|
|
298
|
+
}
|
|
299
|
+
label.textContent = this.label;
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
labelSlotElement.textContent = this.label;
|
|
303
|
+
}
|
|
218
304
|
this.element.appendChild(labelSlotElement);
|
|
305
|
+
// update aria-describedby
|
|
306
|
+
this.watchAriaDescribedbyIDs();
|
|
219
307
|
}
|
|
220
308
|
/**
|
|
221
309
|
* Render error message
|
|
@@ -258,6 +346,9 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
258
346
|
this.watchTooltipPosition(this.tooltipPosition);
|
|
259
347
|
this.watchHelpText(this.helpText);
|
|
260
348
|
this.watchErrorMessage(this.errorMessage);
|
|
349
|
+
this.watchInputsOnBottom(this.inputsOnBottom);
|
|
350
|
+
this.watchlabelHeading(this.labelHeading);
|
|
351
|
+
this.watchLabelBorderDisplay(this.labelBorderDisplay);
|
|
261
352
|
}
|
|
262
353
|
/**
|
|
263
354
|
* Validate slots
|
|
@@ -274,16 +365,19 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
274
365
|
*/
|
|
275
366
|
render() {
|
|
276
367
|
const isGroup = this.isFieldset && !this.isReadonly;
|
|
277
|
-
return (h(Host, { key: '
|
|
368
|
+
return (h(Host, { key: 'fbab18280a709407c83f324127e8de6cbb05fe7c', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, h("div", { key: 'ac0924c244b9fa87d02e659a5710ee93d12a202f', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, h("slot", { key: 'c825af33ba0a6c209d02d6487422347f7d8acfed', name: this.slotLabel }), this.tooltip && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), h("div", { key: '805e1eedfdea132f3ea4fd11da761810a3d7c939', class: "mg-c-input__input-container" }, this.inputContainerElements())));
|
|
278
369
|
}
|
|
279
370
|
get element() { return this; }
|
|
280
371
|
static get watchers() { return {
|
|
281
372
|
"identifier": ["watchIdentifier", "watchAriaDescribedbyIDs"],
|
|
282
373
|
"labelOnTop": ["watchLabelOnTop", "watchLabelConfig"],
|
|
283
374
|
"labelHide": ["watchLabelConfig"],
|
|
375
|
+
"labelHeading": ["watchlabelHeading"],
|
|
376
|
+
"labelBorderDisplay": ["watchLabelBorderDisplay"],
|
|
284
377
|
"tooltipPosition": ["watchTooltipPosition"],
|
|
285
378
|
"errorMessage": ["watchErrorMessage", "watchAriaDescribedbyIDs"],
|
|
286
379
|
"helpText": ["watchHelpText", "watchAriaDescribedbyIDs"],
|
|
380
|
+
"inputsOnBottom": ["watchInputsOnBottom"],
|
|
287
381
|
"ariaDescribedbyIDs": ["watchAriaDescribedbyIDs"],
|
|
288
382
|
"class": ["watchClass", "watchLabel"],
|
|
289
383
|
"label": ["watchLabel"],
|
|
@@ -297,11 +391,14 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
297
391
|
"label": [1],
|
|
298
392
|
"labelOnTop": [4, "label-on-top"],
|
|
299
393
|
"labelHide": [4, "label-hide"],
|
|
394
|
+
"labelHeading": [1025, "label-heading"],
|
|
395
|
+
"labelBorderDisplay": [4, "label-border-display"],
|
|
300
396
|
"tooltip": [1],
|
|
301
397
|
"tooltipPosition": [1, "tooltip-position"],
|
|
302
398
|
"required": [4],
|
|
303
399
|
"errorMessage": [1, "error-message"],
|
|
304
400
|
"helpText": [1, "help-text"],
|
|
401
|
+
"inputsOnBottom": [4, "inputs-on-bottom"],
|
|
305
402
|
"ariaDescribedbyIDs": [1025, "aria-describedby-i-ds"],
|
|
306
403
|
"isFieldset": [32],
|
|
307
404
|
"isReadonly": [32],
|
|
@@ -311,9 +408,12 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
311
408
|
"identifier": ["watchIdentifier", "watchAriaDescribedbyIDs"],
|
|
312
409
|
"labelOnTop": ["watchLabelOnTop", "watchLabelConfig"],
|
|
313
410
|
"labelHide": ["watchLabelConfig"],
|
|
411
|
+
"labelHeading": ["watchlabelHeading"],
|
|
412
|
+
"labelBorderDisplay": ["watchLabelBorderDisplay"],
|
|
314
413
|
"tooltipPosition": ["watchTooltipPosition"],
|
|
315
414
|
"errorMessage": ["watchErrorMessage", "watchAriaDescribedbyIDs"],
|
|
316
415
|
"helpText": ["watchHelpText", "watchAriaDescribedbyIDs"],
|
|
416
|
+
"inputsOnBottom": ["watchInputsOnBottom"],
|
|
317
417
|
"ariaDescribedbyIDs": ["watchAriaDescribedbyIDs"],
|
|
318
418
|
"class": ["watchClass", "watchLabel"],
|
|
319
419
|
"label": ["watchLabel"],
|
|
@@ -356,4 +456,4 @@ function defineCustomElement() {
|
|
|
356
456
|
}
|
|
357
457
|
defineCustomElement();
|
|
358
458
|
|
|
359
|
-
export { MgInput as M, classDisabled as a, classFieldset as b, classReadonly as c, defineCustomElement as d,
|
|
459
|
+
export { MgInput as M, classDisabled as a, classFieldset as b, classReadonly as c, defineCustomElement as d, classDisplayCharacterLeft as e, classVerticalList as f, widths as w };
|
|
@@ -194,6 +194,10 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
194
194
|
* @param event - mg-item-loaded "item-loaded" custom event
|
|
195
195
|
*/
|
|
196
196
|
updateItemListener(event) {
|
|
197
|
+
// `<mg-action-more>` element doesn't need `data-has-focus` attribute
|
|
198
|
+
if (event.target.nodeName === 'MG-ACTION-MORE') {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
197
201
|
const itemToWatch = event.target.nodeName === 'MG-ITEM-MORE' ? event.target.shadowRoot.querySelector('mg-menu-item') : event.target;
|
|
198
202
|
['click', 'focus'].forEach(trigger => {
|
|
199
203
|
itemToWatch.addEventListener(trigger, () => {
|
|
@@ -254,7 +258,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
254
258
|
* @returns HTML Element
|
|
255
259
|
*/
|
|
256
260
|
render() {
|
|
257
|
-
return (h(Host, { key: '
|
|
261
|
+
return (h(Host, { key: '753833b01b86d6983f5d063f5598e2187b147a6e', role: "list", "aria-label": this.label }, h("slot", { key: '56702e49f5a97feddeb66e6271bd898061aa0d48' })));
|
|
258
262
|
}
|
|
259
263
|
get element() { return this; }
|
|
260
264
|
static get watchers() { return {
|
|
@@ -38,7 +38,7 @@ const MgLoader = /*@__PURE__*/ proxyCustomElement(class MgLoader extends HTMLEle
|
|
|
38
38
|
* @returns HTML Element
|
|
39
39
|
*/
|
|
40
40
|
render() {
|
|
41
|
-
return (h("div", { key: '
|
|
41
|
+
return (h("div", { key: '739b4cbacd8a8da056dbb1445c40fac2cf26766a', class: "mg-c-loader", "aria-live": "polite" }, h("mg-icon", { key: '95d3cbf26fcd6dbf0dad4853bf55aa66385f1aba', icon: "loader", spin: true }), h("span", { key: 'f6322cd3054d8976bd2ec24f86a2d6bb60ca7ae1', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgress)));
|
|
42
42
|
}
|
|
43
43
|
get element() { return this; }
|
|
44
44
|
static get watchers() { return {
|
|
@@ -98,9 +98,9 @@ const MgMessage = /*@__PURE__*/ proxyCustomElement(class MgMessage extends HTMLE
|
|
|
98
98
|
* @returns HTML Element
|
|
99
99
|
*/
|
|
100
100
|
render() {
|
|
101
|
-
return (h("div", { key: '
|
|
101
|
+
return (h("div", { key: 'f99bf527eb2c6005eeaec11f89aaa08f8865ea57', class: this.classCollection.join() }, h("mg-card", { key: 'beede3cd97b022d947c216b6bba454a104ba5790', shadow: true }, this.variantStyle === 'bar-left' && h("span", { key: '515828d725a996c9d57b39ad75e9373150a1b78a', class: "mg-c-message__bar" }), h("span", { key: '02ae41c66af25c2611b9b6cb8c87a1ad99346fa3', class: "mg-c-message__icon" }, h("mg-icon", { key: '3eadb40ed0dfa5ec51155608a67769c5fee3d402', icon: this.getIcon() })), h("div", { key: 'b832251e8f330d00b512bcd508ae9bf6e5f511cb', class: "mg-c-message__content" }, h("span", { key: 'c3520fc49bd5c3c187a83823050ceb9ca8c12d46', class: "mg-c-message__content-slot" }, h("slot", { key: 'f4064dff9536cbb76e45c5c4c1a89621da9531b2' })), this.hasActions && [
|
|
102
102
|
h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
|
|
103
|
-
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '
|
|
103
|
+
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '5585f7c14c2c3896cfdb5319414cd82f4d4b3a8b', name: "actions" })),
|
|
104
104
|
]))));
|
|
105
105
|
}
|
|
106
106
|
get element() { return this; }
|
|
@@ -10,7 +10,7 @@ import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
|
10
10
|
*/
|
|
11
11
|
const dialogRoles = ['dialog', 'alertdialog'];
|
|
12
12
|
|
|
13
|
-
const mgModalCss = "/*!\n * @prop --mg-c-modal-border-radius: Defines the border radius of the modal. Default value: `--mg-
|
|
13
|
+
const mgModalCss = "/*!\n * @prop --mg-c-modal-border-radius: Defines the border radius of the modal. Default value: `--mg-c-card-border-radius-default`.\n * @prop --mg-c-modal-title-font-size: Defines the font size of the modal title. Default value: `--mg-b-font-size-h3`.\n */:host{--mg-c-card-border-radius:var(--mg-c-modal-border-radius);--mg-c-card-spacing:var(--mg-b-size-16) var(--mg-b-size-24);--mg-c-card-border:none}.mg-c-modal{border:none;background:none;color:inherit}.mg-c-modal[open]{display:flex;padding:var(--mg-b-size-24) var(--mg-b-size-8)}.mg-c-modal::backdrop{background-color:var(--mg-b-color-light);opacity:.85}.mg-c-modal mg-card{display:flex;width:calc(75*var(--mg-b-size-8));max-width:100%;max-height:100%}.mg-c-modal__dialog{position:relative;display:flex;height:fit-content;max-height:100%;flex-direction:column;align-self:center;row-gap:var(--mg-b-size-24)}.mg-c-modal__title{margin:0;font-family:var(--mg-b-font-family-heading);font-size:var(--mg-c-modal-title-font-size);font-weight:600}.mg-c-modal__close-button{height:var(--mg-c-modal-title-font-size);margin-top:calc((var(--mg-b-size-min-height) - var(--mg-c-modal-title-font-size)*var(--mg-b-line-height))/2*-1);margin-right:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2*-1);margin-left:var(--mg-b-size-16);float:right}.mg-c-modal__content{padding:var(--mg-b-size-16);margin:calc(var(--mg-b-size-16)*-1);overflow-y:auto}.mg-c-modal ::slotted(*:not(mg-panel,mg-message,mg-modal)){--mg-c-card-border:var(--mg-c-card-border-default);--mg-c-card-spacing:var(--mg-c-card-spacing-default);--mg-c-card-border-radius:var(--mg-c-card-border-radius-default);--mg-c-card-color-background:var(--mg-c-card-color-background-default);--mg-c-card-box-shadow:var(--mg-c-card-box-shadow-default);--mg-c-card-max-width:unset;--mg-c-card-min-width:unset}";
|
|
14
14
|
|
|
15
15
|
const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class MgModal extends HTMLElement {
|
|
16
16
|
constructor(registerHost) {
|
|
@@ -120,11 +120,11 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class MgModal extends HTMLEle
|
|
|
120
120
|
* @returns HTML Element
|
|
121
121
|
*/
|
|
122
122
|
render() {
|
|
123
|
-
return (h("dialog", { key: '
|
|
123
|
+
return (h("dialog", { key: '2d99322fd3c80b8cbfea70589cf579e0c1c6f06b', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
|
|
124
124
|
if (el !== null) {
|
|
125
125
|
this.dialog = el;
|
|
126
126
|
}
|
|
127
|
-
} }, h("mg-card", { key: '
|
|
127
|
+
} }, h("mg-card", { key: '32692a6d41ef30b3d3e61ddcfea47350d374ed09', shadow: true }, h("div", { key: 'c87bb43bb069671b65a9759ee293e77975707597', class: "mg-c-modal__dialog" }, h("header", { key: '1272a946878efcf8c69f3b09852ba6938cbe31b0', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: '0704656c7c5ac4c8d405f2cd673e91f72763ee8f', class: "mg-c-modal__close-button" }, h("mg-button", { key: '4402971c763ee34145de5bd69d367fde68f9d1a2', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: '9e16add6a3e387971507a252671c895b6c94a586', icon: "cross" })))), h("h1", { key: '3e4fc2b4419398528565d382b728b8b752758ddd', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: '170ff6bd9592687baa4c561615f540ad1c7400e4', class: "mg-c-modal__content" }, h("slot", { key: 'cb710e2a57e4c997deac367169b56047af1200b1' })), this.hasActions && (h("footer", { key: '1e08d67caeaaaf75eb97faa11528719ea537c24c', class: "mg-c-modal__footer" }, h("slot", { key: '461ec8e4117477aef08dc6d346ad0bf6007ec12d', name: "actions" })))))));
|
|
128
128
|
}
|
|
129
129
|
get element() { return this; }
|
|
130
130
|
static get watchers() { return {
|