@mgdis/mg-components 6.22.1 → 6.24.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-Dz2LAZQT.js → index-BEF-cqV9.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_36.cjs.entry.js +178 -79
- package/dist/cjs/mg-alert.cjs.entry.js +6 -2
- package/dist/cjs/mg-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-fieldset.cjs.entry.js +4 -3
- package/dist/cjs/mg-input-combobox.cjs.entry.js +10 -8
- package/dist/cjs/mg-input-file.cjs.entry.js +5 -4
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +8291 -6518
- package/dist/cjs/mg-input.conf-wgTh7iBb.js +84 -0
- package/dist/cjs/mg-loader.cjs.entry.js +1 -1
- 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 -1
- package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +5 -2
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +10 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js +3 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js +14 -6
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +8 -5
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -2
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +11 -11
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +3 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +10 -7
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +4 -2
- package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +5 -3
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +3 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +3 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +3 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +3 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +54 -26
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +5 -3
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +3 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +3 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +4 -2
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +25 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +3 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +3 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +4 -2
- package/dist/collection/components/molecules/mg-message/mg-message.js +39 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +16 -4
- 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 +10 -2
- 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/index3.js +1 -1
- package/dist/components/index4.js +1 -0
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-alert.js +1 -1
- package/dist/components/mg-badge2.js +1 -1
- package/dist/components/mg-breadcrumb.js +1 -1
- package/dist/components/mg-button2.js +1 -1
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-character-left2.js +1 -1
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-divider2.js +1 -1
- package/dist/components/mg-fieldset.js +1 -1
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-icon2.js +1 -1
- package/dist/components/mg-illustrated-message.js +1 -1
- package/dist/components/mg-input-checkbox.js +1 -1
- package/dist/components/mg-input-combobox.js +1 -1
- package/dist/components/mg-input-date.js +1 -1
- package/dist/components/mg-input-file.js +1 -1
- package/dist/components/mg-input-numeric.js +1 -1
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-radio.js +1 -1
- package/dist/components/mg-input-rich-text-editor.js +288 -289
- package/dist/components/mg-input-select2.js +1 -1
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-textarea.js +1 -1
- package/dist/components/mg-input-title2.js +1 -1
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-input2.js +1 -1
- package/dist/components/mg-item-more2.js +1 -1
- package/dist/components/mg-loader2.js +1 -1
- package/dist/components/mg-menu-item2.js +1 -1
- package/dist/components/mg-message2.js +1 -1
- package/dist/components/mg-modal.js +1 -1
- package/dist/components/mg-pagination.js +1 -1
- package/dist/components/mg-panel.js +1 -1
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-popover2.js +1 -1
- package/dist/components/mg-progress.js +1 -1
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-table.js +1 -1
- package/dist/components/mg-tabs2.js +1 -1
- package/dist/components/mg-tooltip2.js +1 -1
- package/dist/custom-elements.json +8828 -0
- package/dist/esm/{index-C3jUhxdI.js → index-DshvCiTL.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_36.entry.js +178 -79
- package/dist/esm/mg-alert.entry.js +6 -2
- package/dist/esm/mg-breadcrumb.entry.js +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-fieldset.entry.js +4 -3
- package/dist/esm/mg-input-combobox.entry.js +10 -8
- package/dist/esm/mg-input-file.entry.js +5 -4
- package/dist/esm/mg-input-rich-text-editor.entry.js +8291 -6518
- package/dist/esm/mg-input.conf-DOi9lJXy.js +73 -0
- package/dist/esm/mg-loader.entry.js +1 -1
- package/dist/esm/mg-progress.entry.js +2 -2
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-c1aeb277.entry.js → p-08d3d957.entry.js} +1 -1
- package/dist/mg-components/{p-661da56b.entry.js → p-13feb37a.entry.js} +1 -1
- package/dist/mg-components/{p-8e256086.entry.js → p-7c63e469.entry.js} +1 -1
- package/dist/mg-components/p-7fd3e519.entry.js +1 -0
- package/dist/mg-components/p-9953b835.entry.js +1 -0
- package/dist/mg-components/p-9c0a9fc7.entry.js +1657 -0
- package/dist/mg-components/p-DOi9lJXy.js +1 -0
- package/dist/mg-components/p-a338088e.entry.js +1 -0
- package/dist/mg-components/p-cdb01923.entry.js +1 -0
- package/dist/mg-components/p-d0b6d8f5.entry.js +1 -0
- package/dist/types/assets/icons/index.d.ts +2 -0
- package/dist/types/components/atoms/internals/mg-input-title/mg-input-title.d.ts +4 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +12 -6
- package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +4 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +6 -0
- package/dist/types/components.d.ts +22 -0
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/ide/intellij/web-types.json +207 -3472
- package/ide/vscode/css-custom-data.json +1 -1
- package/ide/vscode/html-custom-data.json +58 -314
- package/package.json +32 -27
- package/dist/cjs/mg-input.conf-BNpeATnq.js +0 -35
- package/dist/esm/mg-input.conf-C9rmNQIL.js +0 -25
- package/dist/mg-components/p-06fbdb2f.entry.js +0 -1
- package/dist/mg-components/p-188b9ca9.entry.js +0 -1
- package/dist/mg-components/p-4667078d.entry.js +0 -1
- package/dist/mg-components/p-5a859ecf.entry.js +0 -1658
- package/dist/mg-components/p-C9rmNQIL.js +0 -1
- package/dist/mg-components/p-b0b8c58f.entry.js +0 -1
- package/dist/mg-components/p-bbcef41c.entry.js +0 -1
- /package/dist/mg-components/{p-C3jUhxdI.js → p-DshvCiTL.js} +0 -0
|
@@ -106,11 +106,11 @@ export class MgModal {
|
|
|
106
106
|
* @returns HTML Element
|
|
107
107
|
*/
|
|
108
108
|
render() {
|
|
109
|
-
return (h("dialog", { key: '
|
|
109
|
+
return (h("dialog", { key: '7e07f2e52ec70012b98a8cf1097a9a3fde516e90', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
|
|
110
110
|
if (el !== null) {
|
|
111
111
|
this.dialog = el;
|
|
112
112
|
}
|
|
113
|
-
} }, h("mg-card", { key: '
|
|
113
|
+
} }, h("mg-card", { key: '8c1465a6bb2ee834dfb5e56c847ed989de3e7f85', shadow: true }, h("div", { key: '5897cc498704d96f11e0c164f6ca9f466dd796e2', class: "mg-c-modal__dialog" }, h("header", { key: '362442dfe15aa7a1a0ee9c5d108eeb4d06267216', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: '3e67791bec888b3d79433ecdfc61f47d6b3be8ec', class: "mg-c-modal__close-button" }, h("mg-button", { key: '7d7c4b9947737392e178ce125f77bb6c7d376322', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: '27d293b26e3b2e7b36cf92fc02ed7ffae90da736', icon: "cross" })))), h("h1", { key: 'fa0a8c9db3a3cd0e7facf944dd0e23786b59191d', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: '60079c102f0db39e5b05613ed0b03db167740d47', class: "mg-c-modal__content" }, h("slot", { key: '5c52b794b06d07c2206aa05e4ca809f369c06811' })), this.hasActions && (h("footer", { key: '793cf6f99e16b10f5af17691194fd2dd6101a3b7', class: "mg-c-modal__footer" }, h("slot", { key: '7d2b3b264a7bf167d5066b14db8fed880e985013', name: "actions" })))))));
|
|
114
114
|
}
|
|
115
115
|
static get is() { return "mg-modal"; }
|
|
116
116
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import {
|
|
2
|
+
import { ClassList, createID, isValidString, isValideID, toString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
|
+
import { normalizeBooleanAttributes } from "@mgdis/core-ui-helpers/dist/stencil";
|
|
3
4
|
import { initLocales } from "../../../locales";
|
|
4
5
|
import { expandToggleDisplays, titlePositions } from "./mg-panel.conf";
|
|
5
6
|
/**
|
|
@@ -172,6 +173,11 @@ export class MgPanel {
|
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
validateTitlePosition(newValue) {
|
|
176
|
+
if (String(newValue) === '') {
|
|
177
|
+
// Reactive frameworks (e.g. Vue) may pass "" instead of undefined when the prop is reset.
|
|
178
|
+
this.titlePosition = 'left';
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
175
181
|
if (!titlePositions.includes(newValue))
|
|
176
182
|
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
177
183
|
}
|
|
@@ -179,6 +185,11 @@ export class MgPanel {
|
|
|
179
185
|
this.expandedChange.emit(newValue);
|
|
180
186
|
}
|
|
181
187
|
validateExpandToggleDisplay(newValue) {
|
|
188
|
+
if (String(newValue) === '') {
|
|
189
|
+
// Reactive frameworks (e.g. Vue) may pass "" instead of undefined when the prop is reset.
|
|
190
|
+
this.expandToggleDisplay = 'text';
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
182
193
|
if (!expandToggleDisplays.includes(newValue))
|
|
183
194
|
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
184
195
|
if (newValue === 'icon' && this.titleEditable)
|
|
@@ -196,6 +207,7 @@ export class MgPanel {
|
|
|
196
207
|
componentWillLoad() {
|
|
197
208
|
// Get locales
|
|
198
209
|
this.messages = initLocales(this.element).messages;
|
|
210
|
+
normalizeBooleanAttributes(this);
|
|
199
211
|
// Validate
|
|
200
212
|
this.watchIdentifier(this.identifier);
|
|
201
213
|
this.validateTitlePattern(this.titlePattern);
|
|
@@ -224,7 +236,7 @@ export class MgPanel {
|
|
|
224
236
|
*/
|
|
225
237
|
render() {
|
|
226
238
|
const headerId = `${this.identifier}-header`;
|
|
227
|
-
return (h("section", { key: '
|
|
239
|
+
return (h("section", { key: '39d956a9b2c54b794c7ab9f2896dd1152834e8ef', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '13d0facc8eb2f4cf0c5cfc7580aafd49d3debf9a', shadow: this.shadow }, h("header", { key: 'e008bee0a091c655b41712f8f9dff3beadaf437d', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: 'a2efbe980ed634f9aeb296eb4c0f7a3f117a8e51', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '20849cd8295bed06e647e5befd3906e787dae698' })))));
|
|
228
240
|
}
|
|
229
241
|
static get is() { return "mg-panel"; }
|
|
230
242
|
static get encapsulation() { return "shadow"; }
|
|
@@ -339,7 +351,7 @@ export class MgPanel {
|
|
|
339
351
|
},
|
|
340
352
|
"titlePosition": {
|
|
341
353
|
"type": "string",
|
|
342
|
-
"mutable":
|
|
354
|
+
"mutable": true,
|
|
343
355
|
"complexType": {
|
|
344
356
|
"original": "TitlePositionType",
|
|
345
357
|
"resolved": "\"left\" | \"right\"",
|
|
@@ -386,7 +398,7 @@ export class MgPanel {
|
|
|
386
398
|
},
|
|
387
399
|
"expandToggleDisplay": {
|
|
388
400
|
"type": "string",
|
|
389
|
-
"mutable":
|
|
401
|
+
"mutable": true,
|
|
390
402
|
"complexType": {
|
|
391
403
|
"original": "ExpandToggleDisplayType",
|
|
392
404
|
"resolved": "\"icon\" | \"text\"",
|
package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js
CHANGED
|
@@ -46,7 +46,7 @@ export class MgPopoverContent {
|
|
|
46
46
|
* @returns HTML Element
|
|
47
47
|
*/
|
|
48
48
|
render() {
|
|
49
|
-
return (h(Host, { key: '
|
|
49
|
+
return (h(Host, { key: 'e3de7dc2ddf9cba900f1980a6237e95f7a5daea1' }, h("mg-card", { key: '775c623b0cfd3f5cb08ce34281ac558a5dfd52df', class: this.classCollection.join(), shadow: true }, this.closeButton && (h("mg-button", { key: '48269416813e32ef03cc4f02dae4e42fb542b053', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: 'd947151a3751052261c3a1d67eca570b6f991d80', icon: "cross" }))), h("div", { key: '6c447184b41381b2563dcee874153a55521ff7aa', class: "mg-c-popover-content__title" }, h("slot", { key: '5b05e6c30fa020a8765f83d7008b4b9ecad63433', name: "title" })), h("slot", { key: '386dbb305a8862cb55f8b06aa35d08b65051a07d', name: "content" })), h("slot", { key: '16093d6e34d8558677222da720142b7afe443adf', name: "arrow" })));
|
|
50
50
|
}
|
|
51
51
|
static get is() { return "mg-popover-content"; }
|
|
52
52
|
static get encapsulation() { return "shadow"; }
|
|
@@ -38,7 +38,15 @@ export class MgPopover {
|
|
|
38
38
|
* @param event - mouse event
|
|
39
39
|
*/
|
|
40
40
|
this.clickOutside = (event) => {
|
|
41
|
-
|
|
41
|
+
// `click` is a composed event, so `composedPath()` lists every node it travels
|
|
42
|
+
// through, including across shadow boundaries. Relying on it instead of
|
|
43
|
+
// `event.target` keeps the popover open when it (or its guarded trigger) is
|
|
44
|
+
// nested inside another component's shadow DOM: there `event.target` is
|
|
45
|
+
// retargeted to the outer shadow host and `closest()` cannot reach the popover
|
|
46
|
+
// nor the `data-mg-popover-guard` element.
|
|
47
|
+
const path = event.composedPath();
|
|
48
|
+
const isInside = path.includes(this.element) || path.some(node => node instanceof HTMLElement && node.dataset.mgPopoverGuard === this.identifier);
|
|
49
|
+
if (!this.disabled && !isInside) {
|
|
42
50
|
this.display = false;
|
|
43
51
|
}
|
|
44
52
|
};
|
|
@@ -242,7 +250,7 @@ export class MgPopover {
|
|
|
242
250
|
* @returns HTML Element
|
|
243
251
|
*/
|
|
244
252
|
render() {
|
|
245
|
-
return (h(Host, { key: '
|
|
253
|
+
return (h(Host, { key: '422ac3fe8b6d3784bd667074096996ffe6f52cb6' }, h("slot", { key: 'c8a2b51b1ca454f823d73ed2e72fff9aa1162b3f' }), h("slot", { key: '3f7c21389b13c497204de5415613c90aeabe3c86', name: "content" })));
|
|
246
254
|
}
|
|
247
255
|
static get is() { return "mg-popover"; }
|
|
248
256
|
static get encapsulation() { return "shadow"; }
|
|
@@ -65,7 +65,7 @@ export class MgProgress {
|
|
|
65
65
|
* @returns HTML Element
|
|
66
66
|
*/
|
|
67
67
|
render() {
|
|
68
|
-
return (h(Host, { key: '
|
|
68
|
+
return (h(Host, { key: 'd5027418b3a6fe08cd7e6800fd1cb01a268750f6', role: this.ariaRole, "aria-label": this.label, "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max }, h("div", { key: '963659f80b05db089d564095a6eaa5558ece4ffd', class: "mg-c-progress" }, h("div", { key: 'ad019298b3d3ecf3df00946af3e7b897910bbaf7', class: { 'mg-c-progress__bar': true, 'mg-c-progress__bar--active': this.value > this.min } }, h("div", { key: '921f637985dc611a606ebc4c62da4ba188b3d407', class: "mg-c-progress__fill", style: {
|
|
69
69
|
width: `${Math.round(((this.value - this.min) / (this.max - this.min)) * 100)}%`,
|
|
70
70
|
} })))));
|
|
71
71
|
}
|
|
@@ -36,7 +36,7 @@ export class MgSkipLinks {
|
|
|
36
36
|
* @returns HTML Element
|
|
37
37
|
*/
|
|
38
38
|
render() {
|
|
39
|
-
return (h("nav", { key: '
|
|
39
|
+
return (h("nav", { key: 'ddae15101123757391d8dced8c88854c852563c1', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { key: 'df27b144dbf68f3e2fceeeb8575a81c51b74c4d4', class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
40
40
|
}
|
|
41
41
|
static get is() { return "mg-skip-links"; }
|
|
42
42
|
static get encapsulation() { return "shadow"; }
|
|
@@ -223,7 +223,7 @@ export class MgTabs {
|
|
|
223
223
|
* @returns HTML Element
|
|
224
224
|
*/
|
|
225
225
|
render() {
|
|
226
|
-
return (h("div", { key: '
|
|
226
|
+
return (h("div", { key: '25edcc3793e5f060bd3df862ec0c2963c4ec6bdd', class: this.classCollection.join() }, h("header", { key: 'fe9f0e13f798bb88a4c00e2e5ad8e9adf841b05e', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
227
227
|
[`${this.buttonTabBaseClass}`]: true,
|
|
228
228
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
229
229
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o=o=>{for(const a of Array.from(o.element.attributes))"boolean"==typeof o[a.name.replace(/-([a-z])/g,((o,a)=>a.toUpperCase()))]&&o.element.setAttribute(a.name,"")};export{o as n}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,t=e=>{const t={value:"2023",pattern:"yyyy"},a={value:"12",pattern:"mm"},l={value:"24",pattern:"dd"};return n([t.value,a.value,l.value].join("-"),e,{timeZone:"UTC"}).replace(t.value,t.pattern).replace(a.value,a.pattern).replace(l.value,l.pattern)},a=(e,t,a)=>new Intl.NumberFormat(t,{style:"currency",currency:a}).format(e),l=(e,t,a=0)=>new Intl.NumberFormat(t,{minimumFractionDigits:a}).format(Number(e)),r=(e,t)=>{if("number"!=typeof e||Number.isNaN(e)||e<0)throw new Error("localeByte - size must be a positive number.");const a=["byte","kilobyte","megabyte","gigabyte","terabyte"],l=a.findIndex(((t,a)=>e<Math.pow(1024,a+1)));return Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:2,unit:a[l],unitDisplay:"byte"===a[l]?"long":"short",style:"unit"}).format(e/Math.pow(1024,l))},s=(e,t,a=0)=>new Intl.NumberFormat(t,{style:"percent",minimumFractionDigits:a,maximumFractionDigits:a}).format(e),i=(e,t,a,l="short",r=0)=>new Intl.NumberFormat(t,{style:"unit",unit:a,unitDisplay:l,minimumFractionDigits:r,maximumFractionDigits:r}).format(e),n=(t,a,l)=>"string"==typeof t&&""!==t&&e.test(t)?new Intl.DateTimeFormat(a,l).format(new Date(t)):"",o=(u={en:{errors:{required:"This field is required."},nbCharLeft:"{counter} characters left.",input:{showMore:"Show more",select:{placeholder:"Select a value"},checkbox:{selectedValues:"{nb} selected values",selectedValue:"{nb} selected value",editButton:"Edit",selectButton:"Select values",showButton:"Show",sections:{label:'Values grouped by: "Selected" or "Available"',badge:{label:"value(s)"},search:{label:"Enter a value",values:"{count} value(s) found",noValue:"No values found"},selected:{title:"Selected",action:"Unselect all",tooltip:"Unselect all current values",values:"{count} value(s) selected",noValue:"No value selected"},notSelected:{title:"Available",action:"Select all",tooltip:"Select all current values",values:"{count} value(s) available",noValue:"All values are selected"}}},date:{pattern:{dd:"dd",mm:"mm",yyyy:"yyyy"},helpText:{expectedFormat:"Expected format: {pattern} (ex: {date})"},error:{badInput:"The date is inexistent or incorrect, the expected format is {pattern} (ex: {date})",min:"The date must be after or equal to {min}",max:"The date must be before or equal to {max}",minMax:"The date must be between {min} and {max}"}},numeric:{error:{min:"The value must be greater than or equal to {min}",max:"The value must be less than or equal to {max}",minMax:"The value must be between {min} and {max}"}},password:{display:"Display password value",hide:"Hide password value"},combobox:{notFound:"No value matches your input",notAvailable:"No value available",search:"Search…"},text:{helpText:{email:"Expected format: name@example.com",emails:"Expected format: first@example.com, second@example.com",url:"Expected format: https://example.com"},errors:{typeMismatch:{email:"The value is incorrect, the expected format is name@example.com",emails:"The value is incorrect, the expected format is first@example.com, second@example.com",url:"The value is incorrect, the expected format is https://example.com"}}},file:{helpText:{accept:"Accepted extensions: {{accept}}",maxSize:"Maximum size: {{maxSize}}"},errors:{maxSize:"The file size exceeds the maximum allowed size of {{maxSize}}"},browse:"Browse…",deleteButton:"Delete file"}},form:{required:'Fields with a <strong class="mg-u-is-asterisk">*</strong> are required',requiredSingle:'Field with a <strong class="mg-u-is-asterisk">*</strong> is required',allRequired:"All fields are required",allRequiredSingle:"The field is required"},alert:{closeButton:"Close message"},modal:{closeButton:"Close modal"},pagination:{label:"Pagination",page:"page",pages:"pages",nextLabel:"Next page",previousLabel:"Previous page",selectPage:"Select the page to display."},panel:{editLabel:"Edit section title."},skipLinks:{navLabel:"Quick access"},breadcrumb:{label:"Breadcrumb"},general:{confirm:"Confirm",cancel:"Cancel",close:"Close",next:"Next",previous:"Previous",reset:"reset"},menuItem:{badgeLabel:"Include notification(s)",openNewTab:"Open link in a new tab"},itemMore:{menuLabel:"Additional menu"},actionMore:{label:"Actions"},loader:{inProgress:"Loading in progress…"},table:{sortableCaption:"(column headers with buttons are sortable)"}},fr:{errors:{required:"Ce champ est obligatoire."},nbCharLeft:"{counter} caractères disponibles.",input:{showMore:"Afficher plus",select:{placeholder:"Sélectionnez une valeur"},checkbox:{selectedValues:"{nb} valeurs sélectionnées",selectedValue:"{nb} valeur sélectionnée",editButton:"Modifier",selectButton:"Sélectionner des valeurs",showButton:"Voir",sections:{label:'Valeurs regroupées par: "Sélectionnées" ou "Disponibles"',badge:{label:"valeur(s)"},search:{label:"Saisissez une valeur",values:"{count} résultat(s)",noValue:"Aucune valeur n'a été trouvée."},selected:{title:"Sélectionnées",action:"Tout désélectionner",tooltip:"Désélectionne toutes les valeurs de la section",values:"{count} valeur(s) sélectionnée(s)",noValue:"Aucune valeur sélectionnée"},notSelected:{title:"Disponibles",action:"Tout sélectionner",tooltip:"Sélectionne toutes les valeurs de la section",values:"{count} valeur(s) disponible(s)",noValue:"Toutes les valeurs sont sélectionnées"}}},date:{pattern:{dd:"jj",mm:"mm",yyyy:"aaaa"},helpText:{expectedFormat:"Format attendu : {pattern} (ex : {date})"},error:{badInput:"La date est inexistante ou incorrecte, le format attendu est {pattern} (ex : {date})",min:"La date doit être postérieure ou égale au {min}",max:"La date doit être antérieure ou égale au {max}",minMax:"La date doit être comprise entre le {min} et le {max}"}},numeric:{error:{min:"La valeur doit être supérieure ou égale à {min}",max:"La valeur doit être inférieure ou égale à {max}",minMax:"La valeur doit être comprise entre {min} et {max}"}},password:{display:"Afficher le mot de passe",hide:"Masquer le mot de passe"},combobox:{notFound:"Aucune valeur ne correspondont à votre saisie",notAvailable:"Aucune valeur disponible",search:"Recherche…"},text:{helpText:{email:"Format attendu : nom@exemple.fr",emails:"Format attendu : premier@exemple.fr, second@exemple.fr",url:"Format attendu : https://exemple.fr"},errors:{typeMismatch:{email:"La valeur est incorrecte, le format attendu est nom@exemple.fr",emails:"La valeur est incorrecte, le format attendu est premier@exemple.fr, second@exemple.fr",url:"La valeur est incorrecte, le format attendu est https://exemple.fr"}}},file:{helpText:{accept:"Extensions autorisée : {{acceptedFormat}}",maxSize:"Taille maximale : {{maxSize}}"},errors:{maxSize:"La taille du fichier dépasse la taille maximale autorisée de {{maxSize}}"},browse:"Parcourir…",deleteButton:"Supprimer le fichier"}},form:{required:'Les champs marqués d\'un <strong class="mg-u-is-asterisk">*</strong> sont obligatoires',requiredSingle:'Le champ marqué d\'un <strong class="mg-u-is-asterisk">*</strong> est obligatoire',allRequired:"Tous les champs sont obligatoires",allRequiredSingle:"Le champ est obligatoire"},alert:{closeButton:"Fermer le message"},modal:{closeButton:"Fermer la modale"},pagination:{label:"Pagination",page:"page",pages:"pages",nextLabel:"Page suivante",previousLabel:"Page précédente",selectPage:"Sélectionner la page à afficher."},panel:{editLabel:"Modifier le titre de la section."},skipLinks:{navLabel:"Accès rapide"},breadcrumb:{label:"Fil d'Ariane"},general:{confirm:"Valider",cancel:"Annuler",close:"Fermer",next:"Suivant",previous:"Précédent",reset:"réinitialiser"},menuItem:{badgeLabel:"Notification(s) incluse(s)",openNewTab:"Ouvrir le lien dans un nouvel onglet"},itemMore:{menuLabel:"Menu complémentaire"},actionMore:{label:"Actions"},loader:{inProgress:"Chargement en cours…"},table:{sortableCaption:"(les en-têtes de colonnes avec des boutons peuvent être triés)"}}},e=>((e,t,a)=>{const l=e.closest("[lang]"),r=Intl.NumberFormat.supportedLocalesOf(l?.lang),s=r.length>0&&"string"==typeof r[0]?r[0]:navigator.language||a,i=s.split("-").shift();return 0===Object.keys(t).length?{locale:s,messages:{lang:a}}:{locale:s,messages:t[i]??t[a]??{lang:a}}})(e,u,"en"));var u;export{n as a,t as b,l as c,i as d,s as e,a as f,o as i,r as l}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as t,proxyCustomElement as e,HTMLElement as i,h as o,Host as s}from"@stencil/core/internal/client";import{c as a,t as r}from"./index2.js";import{d as n,a as m,S as c}from"./mg-menu-item2.js";import{i as d}from"./
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as i,h as o,Host as s}from"@stencil/core/internal/client";import{c as a,t as r}from"./index2.js";import{d as n,a as m,S as c}from"./mg-menu-item2.js";import{i as d}from"./index4.js";import{d as p}from"./mg-badge2.js";import{d as h}from"./mg-button2.js";import{d as l}from"./mg-card2.js";import{d as g}from"./mg-divider2.js";import{d as v}from"./mg-icon2.js";import{b as u,d as b}from"./mg-item-more2.js";import{d as f}from"./mg-popover2.js";import{d as y}from"./mg-popover-content2.js";const k=t=>"object"==typeof t&&t.every((t=>"object"==typeof t&&"string"==typeof t.label&&"function"==typeof t.mouseEventHandler||E(t))),E=t=>"object"==typeof t&&t.isDivider,j=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.name="mg-action-more",this.classBase="mg-c-action-more",this.mgPopoverIdentifier=a(this.name),this.button={variant:"flat",isIcon:!0},this.displayChevron=!1,this.expanded=!1,this.toggleExpanded=()=>{this.expanded=!this.expanded},this.handleDisplayChange=t=>{this.expanded=t.detail},this.handleButton=()=>{this.toggleExpanded()},this.handleItemClick=(t,e)=>{this.expanded=!1,e(t)}}validateItems(t){if(!k(t))throw Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${r(t)}.`);if(k(t)&&t.length>0&&(E(t[0])||E(t[t.length-1])))throw Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${r(t)}.`)}validateIcon(t){if(t&&!(t=>"object"==typeof t&&"string"==typeof t.icon)(t))throw Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${r(t)}.`);void 0===(null==t?void 0:t.icon)&&this.button.isIcon&&(this.icon={icon:"ellipsis"})}validateButton(t){if(t&&!(t=>"object"==typeof t&&"string"==typeof t.variant&&"boolean"==typeof t.isIcon)(t))throw Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${r(t)}.`)}validateDisplayChevron(t){if(t&&!0===this.button.isIcon)throw Error(`<${this.name}> prop "displayChevron" can't be used with a 'button" prop "isIcon" attribute.`)}componentWillLoad(){this.messages=d(this.element).messages.actionMore,this.validateItems(this.items),this.validateButton(this.button),this.validateIcon(this.icon),this.validateDisplayChevron(this.displayChevron)}render(){const t=this.button.label||this.messages.label,e=[t];return!this.button.isIcon&&this.displayChevron&&e.push(o("span",{class:{[this.classBase+"__chevron"]:!0,[this.classBase+"__chevron--rotate"]:!0===this.expanded}},o("mg-icon",{icon:"chevron-down"}))),o(s,{key:"184355435ec346d682c2df4aa8b33bf5f54e77e7","data-mg-popover-guard":this.mgPopoverIdentifier},o("span",{key:"8176489e5dd7741311745d015b8ef7f2a4f63ea9",class:this.classBase},o("mg-popover",{key:"3ee64b21556ee9e910939ad2fc9e3fbf8e4bd964",identifier:this.mgPopoverIdentifier,display:this.expanded,"onDisplay-change":this.handleDisplayChange},o("mg-button",{key:"cf8f7f4f736d6a8338a4f6eebce04b4e2be49825",variant:this.button.variant,isIcon:this.button.isIcon,disabled:this.button.disabled,type:"button",label:t,onClick:this.handleButton},this.icon&&o("mg-icon",Object.assign({key:"ee8b4f13bac85ccdd5e9d72edbaa957054c304ec"},this.icon)),!this.button.isIcon&&e),o("div",{key:"1c78fb9a98d59fa5422c5105ecb13d2f2884c7d2",slot:"content"},o("mg-menu",{key:"522d915d4a38529f7709640bb96eebb81ccc86af",direction:m.VERTICAL,label:this.messages.label},this.items.map((t=>{var e,i;return E(t)?o("mg-divider",{class:"mg-c-action-more__divider",key:"divider","full-width":!0}):o("mg-menu-item",{key:t.label,status:t.status||c.VISIBLE,target:t.target,href:t.href,onClick:e=>this.handleItemClick(e,t.mouseEventHandler)},(null===(e=t.icon)||void 0===e?void 0:e.icon)&&o("mg-icon",{icon:t.icon.icon,variant:t.icon.variant,variantStyle:t.icon.variantStyle,slot:"image"}),o("span",{slot:"label"},t.label),(null===(i=t.badge)||void 0===i?void 0:i.label)&&o("mg-badge",{label:t.badge.label,value:t.badge.value,slot:"information",variant:"text-color"}))})))))))}get element(){return this}static get watchers(){return{items:[{validateItems:0}],icon:[{validateIcon:0}],button:[{validateButton:0}],displayChevron:[{validateDisplayChevron:0}]}}static get style(){return".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}}:host{--mg-c-popover-spacing-vertical:var(--mg-b-size-4);--mg-c-popover-spacing-horizontal:0;--mg-c-popover-max-width:unset;--mg-c-popover-overflow:hidden}.mg-c-action-more__divider{--mg-c-divider-spacing-vertical:0.2rem}.mg-c-action-more__chevron{transition:200ms}.mg-c-action-more__chevron--rotate.mg-c-action-more__chevron{transform:rotate(180deg)}.mg-c-action-more mg-menu-item{--mg-c-menu-item-button-margin-horizontal:var(--mg-b-size-4)}"}},[1,"mg-action-more",{items:[16],icon:[1040],button:[16],displayChevron:[4,"display-chevron"],expanded:[32]},void 0,{items:[{validateItems:0}],icon:[{validateIcon:0}],button:[{validateButton:0}],displayChevron:[{validateDisplayChevron:0}]}]);function w(){"undefined"!=typeof customElements&&["mg-action-more","mg-badge","mg-button","mg-card","mg-divider","mg-icon","mg-item-more","mg-menu","mg-menu-item","mg-popover","mg-popover-content"].forEach((e=>{switch(e){case"mg-action-more":customElements.get(t(e))||customElements.define(t(e),j);break;case"mg-badge":customElements.get(t(e))||p();break;case"mg-button":customElements.get(t(e))||h();break;case"mg-card":customElements.get(t(e))||l();break;case"mg-divider":customElements.get(t(e))||g();break;case"mg-icon":customElements.get(t(e))||v();break;case"mg-item-more":customElements.get(t(e))||b();break;case"mg-menu":customElements.get(t(e))||u();break;case"mg-menu-item":customElements.get(t(e))||n();break;case"mg-popover":customElements.get(t(e))||f();break;case"mg-popover-content":customElements.get(t(e))||y()}}))}w();const _=j,I=w;export{_ as MgActionMore,I as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as t,proxyCustomElement as s,HTMLElement as e,createEvent as i,forceUpdate as a,h as o}from"@stencil/core/internal/client";import{C as n,t as r}from"./index2.js";import{i as h}from"./
|
|
1
|
+
import{transformTag as t,proxyCustomElement as s,HTMLElement as e,createEvent as i,forceUpdate as a,h as o}from"@stencil/core/internal/client";import{C as n,t as r}from"./index2.js";import{i as h}from"./index4.js";import{d as c}from"./mg-button2.js";import{d as l}from"./mg-card2.js";import{d as m}from"./mg-icon2.js";import{d as u}from"./mg-message2.js";const d=["info","warning","success","danger"],g=["bar-left","background"],f=s(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.componentShow=i(this,"component-show",3),this.componentHide=i(this,"component-hide",3),this.componentClose=i(this,"component-close",3),this.classCloseButton="mg-c-alert--close-button",this.storedTimer=null,this.isFocused=!1,this.isHovered=!1,this.variant="info",this.variantStyle="bar-left",this.fullWidth=!1,this.classCollection=new n(["mg-c-alert"]),this.hasActions=!1,this.setTimer=()=>{this.storedTimer=setTimeout((()=>this.element.hidden=!0),1e3*this.delay)},this.clearTimer=()=>{clearTimeout(this.storedTimer)},this.timerEvents=t=>{this.clearTimer();const s="mouseenter"===t.type;this[s?"isHovered":"isFocused"]=!0,this.element.addEventListener(s?"mouseleave":"focusout",(t=>{this["mouseleave"===t.type?"isHovered":"isFocused"]=!1,this.isFocused||this.isHovered||this.setTimer()}),{once:!0})},this.handleClose=()=>{this.element.hidden=!0,this.componentClose.emit()}}watchDelay(t){if(void 0!==t&&t<2)throw Error(`<mg-alert> prop "delay" must be greater than 2 seconds. Passed value: ${r(t)}.`)}watchVariant(t){if(t&&!d.includes(t))throw Error(`<mg-alert> prop "variant" must be one of: ${d.join(", ")}. Passed value: ${r(t)}.`)}watchVariantStyle(t){if(t&&!g.includes(t))throw Error(`<mg-alert> prop "variantStyle" must be one of: ${g.join(", ")}. Passed value: ${r(t)}.`)}watchHidden(t){"string"==typeof t&&""===t&&(t=!0),t?(this.componentHide.emit(),["focusin","mouseenter"].forEach((t=>{this.element.removeEventListener(t,this.timerEvents)})),this.clearTimer()):(this.componentShow.emit(),this.delay>1&&(this.setTimer(),["focusin","mouseenter"].forEach((t=>{this.element.addEventListener(t,this.timerEvents)})))),a(this)}componentWillLoad(){this.messages=h(this.element).messages,this.watchVariant(this.variant),this.watchVariantStyle(this.variantStyle),this.watchDelay(this.delay),this.watchHidden(this.element.hidden),this.hasActions=null!==this.element.querySelector('[slot="actions"]'),this.hasActions||this.classCollection.add(this.classCloseButton)}render(){return o("mg-message",{key:"8d10696cd86b00304d8ae409e36691a41a16702e",class:this.classCollection.join(),role:["info","success"].includes(this.variant)?"status":"alert",variant:this.variant,variantStyle:this.variantStyle,fullWidth:this.fullWidth},o("slot",{key:"598a86d657b77006f5a9e9dbf33e7969669be125"}),this.hasActions?o("span",{slot:"actions"},o("slot",{name:"actions"})):o("span",{class:"mg-c-alert__close-button"},o("mg-button",{"is-icon":!0,variant:"flat",label:this.messages.alert.closeButton,onClick:this.handleClose},o("mg-icon",{icon:"cross"}))))}get element(){return this}static get watchers(){return{delay:[{watchDelay:0}],variant:[{watchVariant:0}],variantStyle:[{watchVariantStyle:0}],hidden:[{watchHidden:0}]}}static get style(){return".mg-c-alert__close-button{position:absolute;top:0;right:0}.mg-c-alert.mg-c-alert--close-button{--mg-c-card-spacing:0 var(--mg-b-size-min-height) 0 0}"}},[257,"mg-alert",{delay:[2],variant:[1],variantStyle:[1,"variant-style"],fullWidth:[4,"full-width"],classCollection:[32],hasActions:[32]},void 0,{delay:[{watchDelay:0}],variant:[{watchVariant:0}],variantStyle:[{watchVariantStyle:0}],hidden:[{watchHidden:0}]}]);function p(){"undefined"!=typeof customElements&&["mg-alert","mg-button","mg-card","mg-icon","mg-message"].forEach((s=>{switch(s){case"mg-alert":customElements.get(t(s))||customElements.define(t(s),f);break;case"mg-button":customElements.get(t(s))||c();break;case"mg-card":customElements.get(t(s))||l();break;case"mg-icon":customElements.get(t(s))||m();break;case"mg-message":customElements.get(t(s))||u()}}))}p();const b=f,w=p;export{b as MgAlert,w as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as r,proxyCustomElement as
|
|
1
|
+
import{transformTag as r,proxyCustomElement as e,HTMLElement as o,h as a}from"@stencil/core/internal/client";import{C as c,t as g,i as t}from"./index2.js";import{n as i}from"./index3.js";const n=["info","primary","secondary","success","warning","danger","text-color"],d=e(class extends o{constructor(r){super(),!1!==r&&this.__registerHost(),this.__attachShadow(),this.classOutline="mg-c-badge--outline",this.variant="info",this.outline=!1,this.classCollection=new c(["mg-c-badge"])}validateValue(r){if(null===/^[^A-Z]+$/i.exec(`${r}`))throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${g(r)}.`)}validateLabel(r){if(!t(r))throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${g(r)}.`)}validateVariant(r,e){if(!n.includes(r)){if(""===String(r))return void(this.variant="info");throw new Error(`<mg-badge> prop "variant" must be one of: ${n.join(", ")}. Passed value: ${g(r)}.`)}void 0!==e&&this.classCollection.delete(`mg-c-badge--${e}`),this.classCollection.add(`mg-c-badge--${r}`)}validateOutline(r){r?this.classCollection.add(this.classOutline):this.classCollection.delete(this.classOutline)}componentWillLoad(){i(this),this.validateValue(this.value),this.validateLabel(this.label),this.validateVariant(this.variant),this.validateOutline(this.outline)}render(){return a("span",{key:"b4c55957d7e59c889147cf3ddeb57f94c7afdaaa",class:this.classCollection.join()},a("span",{key:"3f9bfae0e36de3c14d71d3a904f426508b1d5872",class:"mg-c-badge__value"},this.value),a("span",{key:"2e6ee3c010b6f0c8c1df7bfdd3aed755e5afc0d8",class:"mg-u-visually-hidden"},this.label))}get element(){return this}static get watchers(){return{value:[{validateValue:0}],label:[{validateLabel:0}],variant:[{validateVariant:0}],outline:[{validateOutline:0}]}}static get style(){return".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}}.mg-c-badge{min-width:var(--mg-c-badge-size);height:var(--mg-c-badge-size);box-sizing:border-box;padding:0 var(--mg-b-size-4);border:var(--mg-b-size-border) solid;border-radius:calc(var(--mg-c-badge-size)/2);font-size:var(--mg-c-badge-font-size);font-weight:600;line-height:var(--mg-c-badge-size);text-align:center}.mg-c-badge.mg-c-badge--primary{border-color:var(--mg-b-color-primary);background-color:var(--mg-b-color-primary);color:var(--mg-b-color-text-on-primary)}.mg-c-badge.mg-c-badge--primary.mg-c-badge--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-primary)}.mg-c-badge.mg-c-badge--secondary{border-color:var(--mg-b-color-secondary);background-color:var(--mg-b-color-secondary);color:var(--mg-b-color-text-on-secondary)}.mg-c-badge.mg-c-badge--secondary.mg-c-badge--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-secondary)}.mg-c-badge.mg-c-badge--danger{border-color:var(--mg-b-color-danger);background-color:var(--mg-b-color-danger);color:var(--mg-b-color-text-on-danger)}.mg-c-badge.mg-c-badge--danger.mg-c-badge--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-danger)}.mg-c-badge.mg-c-badge--info{border-color:var(--mg-b-color-info);background-color:var(--mg-b-color-info);color:var(--mg-b-color-text-on-info)}.mg-c-badge.mg-c-badge--info.mg-c-badge--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-info)}.mg-c-badge.mg-c-badge--success{border-color:var(--mg-b-color-success);background-color:var(--mg-b-color-success);color:var(--mg-b-color-text-on-success)}.mg-c-badge.mg-c-badge--success.mg-c-badge--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-success)}.mg-c-badge.mg-c-badge--warning{border-color:var(--mg-b-color-warning);background-color:var(--mg-b-color-warning);color:var(--mg-b-color-text-on-warning)}.mg-c-badge.mg-c-badge--warning.mg-c-badge--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-warning)}.mg-c-badge.mg-c-badge--text-color{border-color:currentcolor;background-color:currentcolor}.mg-c-badge.mg-c-badge--text-color .mg-c-badge__value{color:var(--mg-c-badge-color-text, var(--mg-b-color-light))}.mg-c-badge.mg-c-badge--text-color.mg-c-badge--outline{background-color:rgba(0,0,0,0)}.mg-c-badge.mg-c-badge--text-color.mg-c-badge--outline .mg-c-badge__value{color:currentcolor}.mg-c-badge,mg-badge{display:inline-flex;align-items:center;justify-content:center}"}},[1,"mg-badge",{value:[8],label:[1],variant:[1025],outline:[4],classCollection:[32]},void 0,{value:[{validateValue:0}],label:[{validateLabel:0}],variant:[{validateVariant:0}],outline:[{validateOutline:0}]}]);function l(){"undefined"!=typeof customElements&&["mg-badge"].forEach((e=>{"mg-badge"===e&&(customElements.get(r(e))||customElements.define(r(e),d))}))}l();export{d as M,l as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as e,proxyCustomElement as t,HTMLElement as r,h as i}from"@stencil/core/internal/client";import{i as a}from"./
|
|
1
|
+
import{transformTag as e,proxyCustomElement as t,HTMLElement as r,h as i}from"@stencil/core/internal/client";import{i as a}from"./index4.js";import{t as s,i as m}from"./index2.js";import{d as c}from"./mg-icon2.js";const n=t(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}validateItems(e){if(void 0===e||!(e=>Array.isArray(e)&&e.length>0&&e.every(((t,r)=>"object"==typeof t&&null!==t&&m(t.label)&&(r===e.length-1||m(t.href)))))(e))throw Error(`<mg-breadcrumb> prop "items" is required and all values must be the same type, BreadcrumbItemType. Passed value: ${s(e)}.`)}renderItem(e,t){return m(e.href)?i("a",{href:e.href,"aria-label":void 0!==e.icon?e.label:void 0,"aria-current":t?"page":void 0},void 0!==e.icon?i("mg-icon",{icon:e.icon}):e.label):i("span",null,e.label)}componentWillLoad(){this.validateItems(this.items),this.messages=a(this.element).messages.breadcrumb}render(){return i("nav",{key:"af5c541e6a268af67762eb9d384269511fe0be17","aria-label":this.messages.label,class:"mg-c-breadcrumb"},i("ol",{key:"b5fdfe61eb2c826b3462bdd65cacfb73d4f00484",class:"mg-c-breadcrumb__list"},this.items.map(((e,t)=>{var r;return i("li",{key:`${t}-${null!==(r=e.href)&&void 0!==r?r:e.label}`,class:"mg-c-breadcrumb__list-item"},this.renderItem(e,t===this.items.length-1))}))))}get element(){return this}static get watchers(){return{items:[{validateItems:0}]}}static get style(){return'a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-breadcrumb{display:block}.mg-c-breadcrumb__list{padding:0;margin:0;list-style:none}.mg-c-breadcrumb__list-item{display:inline;color:var(--mg-b-color-dark);font-weight:700}.mg-c-breadcrumb__list-item:not(:last-child)::after{content:"/";font-weight:600;margin-inline:var(--mg-b-size-8)}.mg-c-breadcrumb__list-item:has(mg-icon) a{padding:var(--mg-b-size-4);margin:calc(var(--mg-b-size-4)*-1)}.mg-c-breadcrumb__list-item mg-icon{margin-block-start:.2rem;vertical-align:top}'}},[1,"mg-breadcrumb",{items:[16]},void 0,{items:[{validateItems:0}]}]);function o(){"undefined"!=typeof customElements&&["mg-breadcrumb","mg-icon"].forEach((t=>{switch(t){case"mg-breadcrumb":customElements.get(e(t))||customElements.define(e(t),n);break;case"mg-icon":customElements.get(e(t))||c()}}))}o();const l=n,d=o;export{l as MgBreadcrumb,d as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as t,proxyCustomElement as o,HTMLElement as n,createEvent as r,h as i,Host as e}from"@stencil/core/internal/client";import{C as a,t as c,i as b,n as s}from"./index2.js";import{K as d}from"./events.utils.js";import{d as g}from"./mg-icon2.js";const u=["medium","large"],m=["primary","secondary","danger","danger-alt","info","flat","success","link"],l=o(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.disabledChange=r(this,"disabled-change",7),this.onClickElementFn=null,this.classDisabled="mg-c-button--disabled",this.classLoading="mg-c-button--loading",this.classFullWidth="mg-c-button--full-width",this.variant="primary",this.size="medium",this.fullWidth=!1,this.isIcon=!1,this.disableOnClick=!1,this.loading=!1,this.classCollection=new a(["mg-c-button"]),this.handleClick=t=>{this.disabled?t.stopPropagation():this.disableOnClick&&(this.loading=!0,this.disabled=!0)},this.handleKeydown=t=>{this.disabled||" "!==t.key?!this.disabled&&[d.ENTER,d.NUMPADENTER,d.SPACE].includes(t.key)&&(t.preventDefault(),this.element.dispatchEvent(new MouseEvent("click",{bubbles:!0}))):t.preventDefault()},this.handleKeyup=t=>{this.disabled||" "!==t.key||(t.preventDefault(),this.element.dispatchEvent(new MouseEvent("click",{bubbles:!0})))},this.setIconSize=()=>{var t,o;"medium"===this.size?null===(t=this.element.querySelector("mg-icon[size]"))||void 0===t||t.removeAttribute("size"):this.isIcon&&(null===(o=this.element.querySelector("mg-icon"))||void 0===o||o.setAttribute("size",this.size))}}validateVariant(t,o){if(!m.includes(t)){if(""===t)return void(this.variant=m[0]);throw new Error(`<mg-button> prop "variant" must be one of: ${m.join(", ")}. Passed value: ${c(t)}.`)}void 0!==o&&this.classCollection.delete(`mg-c-button--${o}`),this.classCollection.add(`mg-c-button--${t}`)}validateSize(t,o){if(!u.includes(t))throw new Error(`<mg-button> prop "size" must be one of: ${u.join(", ")}. Passed value: ${c(t)}.`);void 0!==o&&this.classCollection.delete(`mg-c-button--${o}`),this.classCollection.add(`mg-c-button--${t}`),this.setIconSize()}validateFullWidth(t){if(t&&this.isIcon)throw new Error('<mg-button> prop "fullWidth" cannot be used with prop "isIcon".');t?this.classCollection.add(this.classFullWidth):this.classCollection.delete(this.classFullWidth)}disabledHandler(t){!t&&this.disableOnClick&&(this.loading=!1),this.element.onclick=t?void 0:this.onClickElementFn,t?this.classCollection.add(this.classDisabled):this.classCollection.delete(this.classDisabled),this.disabledChange.emit(t)}watchIsIcon(t){if(t&&(this.classCollection.add("mg-c-button--icon"),!b(this.label)))throw new Error('<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.');this.setIconSize()}loadingHandler(t){t?this.classCollection.add(this.classLoading):this.classCollection.delete(this.classLoading)}componentWillLoad(){this.validateVariant(this.variant),this.validateFullWidth(this.fullWidth),this.validateSize(this.size),this.watchIsIcon(this.isIcon),this.onClickElementFn=this.element.onclick,this.disabledHandler(this.disabled)}componentDidLoad(){s((()=>{var t;const o=this.element.closest("form")||(null===(t=this.element.closest("mg-form"))||void 0===t?void 0:t.shadowRoot.querySelector("form"));o&&["submit",void 0].includes(this.type)&&this.element.addEventListener("click",(()=>{o.dispatchEvent(new SubmitEvent("submit",{bubbles:!0,cancelable:!0}))}))}))}render(){var t;return i(e,{key:"82e03b7b699a821125d066a5ca1d435a87a75675",role:"button",tabIndex:this.element.getAttribute("tabindex")||0,type:this.type,form:this.form,"full-width":this.fullWidth,"aria-label":this.label,"aria-disabled":null===(t=this.disabled)||void 0===t?void 0:t.toString(),onClick:this.handleClick,onKeyup:this.handleKeyup,onKeydown:this.handleKeydown},i("div",{key:"92a0a1fbcf320f8afc10106418a992fffd748646",class:this.classCollection.join()},this.loading&&i("mg-icon",{key:"f5d0bf31534c2dc8dbd7f9e2fc63bd8af055a9a3",icon:"loader",spin:!0}),i("div",{key:"7557988a9a70881f25c86b78a3ea28d9842c439b",class:"mg-c-button__content"},i("slot",{key:"98b64ef7efc4d761fdda8c593b05ec6959b0ea22"}))))}get element(){return this}static get watchers(){return{variant:[{validateVariant:0}],size:[{validateSize:0}],fullWidth:[{validateFullWidth:0}],disabled:[{disabledHandler:0}],isIcon:[{watchIsIcon:0}],loading:[{loadingHandler:0}]}}static get style(){return":host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:color-mix(in srgb, var(--mg-b-color-dark), transparent 90%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{border-color:var(--mg-c-button-color-border-primary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-primary), var(--mg-c-button-color-gradient-primary));color:var(--mg-c-button-color-text-primary)}:host(:hover) .mg-c-button.mg-c-button--primary:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--primary:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-primary)}.mg-c-button.mg-c-button--secondary{border-color:var(--mg-c-button-color-border-secondary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-secondary), var(--mg-c-button-color-gradient-secondary));color:var(--mg-c-button-color-text-secondary)}:host(:hover) .mg-c-button.mg-c-button--secondary:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--secondary:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-secondary)}.mg-c-button.mg-c-button--danger{border-color:var(--mg-c-button-color-border-danger);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger), var(--mg-c-button-color-gradient-danger));color:var(--mg-c-button-color-text-danger)}:host(:hover) .mg-c-button.mg-c-button--danger:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--danger:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-danger)}.mg-c-button.mg-c-button--info{border-color:var(--mg-c-button-color-border-info);background:linear-gradient(to bottom, var(--mg-c-button-color-background-info), var(--mg-c-button-color-gradient-info));color:var(--mg-c-button-color-text-info)}:host(:hover) .mg-c-button.mg-c-button--info:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--info:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-info)}.mg-c-button.mg-c-button--success{border-color:var(--mg-c-button-color-border-success);background:linear-gradient(to bottom, var(--mg-c-button-color-background-success), var(--mg-c-button-color-gradient-success));color:var(--mg-c-button-color-text-success)}:host(:hover) .mg-c-button.mg-c-button--success:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--success:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-success)}.mg-c-button.mg-c-button--warning{border-color:var(--mg-c-button-color-border-warning);background:linear-gradient(to bottom, var(--mg-c-button-color-background-warning), var(--mg-c-button-color-gradient-warning));color:var(--mg-c-button-color-text-warning)}:host(:hover) .mg-c-button.mg-c-button--warning:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--warning:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-warning)}.mg-c-button.mg-c-button--danger-alt{border-color:var(--mg-c-button-color-border-danger-alt);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger-alt), var(--mg-c-button-color-gradient-danger-alt));color:var(--mg-c-button-color-text-danger-alt)}:host(:hover) .mg-c-button.mg-c-button--danger-alt:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--danger-alt:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-danger-alt)}.mg-c-button{position:relative;display:inline-flex;min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-width:var(--mg-c-button-border-top-width, var(--mg-b-size-border)) var(--mg-c-button-border-right-width, var(--mg-b-size-border)) var(--mg-c-button-border-bottom-width, var(--mg-b-size-border)) var(--mg-c-button-border-left-width, var(--mg-b-size-border));border-style:solid;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-border-radius));background-image:none;column-gap:var(--mg-b-size-8);cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:var(--mg-b-size-8)}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--disabled,.mg-c-button[aria-disabled=true],.mg-c-button:disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--large{padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border)) calc(var(--mg-b-size-24) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon){line-height:var(--mg-b-size-24)}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) slot,.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) ::slotted(*){font-size:var(--mg-b-size-16)}.mg-c-button.mg-c-button--icon{width:var(--mg-b-size-min-height);height:var(--mg-b-size-min-height);justify-content:center;padding:0;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-icon-border-radius));font-size:var(--mg-b-font-size);line-height:var(--mg-b-font-size)}.mg-c-button.mg-c-button--icon.mg-c-button--large{width:unset;height:unset;padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--icon.mg-c-button--large ::slotted(*){min-width:var(--mg-b-size-24);min-height:var(--mg-b-size-24);align-items:center;justify-content:center}.mg-c-button.mg-c-button--full-width{display:flex;width:100%;justify-content:center}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible),:host([data-focus-visible]){outline:0}:host(:focus-visible) .mg-c-button,:host([data-focus-visible]) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}"}},[257,"mg-button",{variant:[1025],label:[1],type:[1],size:[1],fullWidth:[4,"full-width"],form:[1],disabled:[1028],isIcon:[4,"is-icon"],disableOnClick:[4,"disable-on-click"],loading:[32],classCollection:[32]},void 0,{variant:[{validateVariant:0}],size:[{validateSize:0}],fullWidth:[{validateFullWidth:0}],disabled:[{disabledHandler:0}],isIcon:[{watchIsIcon:0}],loading:[{loadingHandler:0}]}]);function h(){"undefined"!=typeof customElements&&["mg-button","mg-icon"].forEach((o=>{switch(o){case"mg-button":customElements.get(t(o))||customElements.define(t(o),l);break;case"mg-icon":customElements.get(t(o))||g()}}))}h();export{l as M,h as d}
|
|
1
|
+
import{transformTag as t,proxyCustomElement as o,HTMLElement as n,createEvent as r,h as i,Host as e}from"@stencil/core/internal/client";import{C as a,t as c,i as b,n as s}from"./index2.js";import{n as d}from"./index3.js";import{K as g}from"./events.utils.js";import{d as u}from"./mg-icon2.js";const m=["medium","large"],l=["primary","secondary","danger","danger-alt","info","flat","success","link"],h=o(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.disabledChange=r(this,"disabled-change",7),this.onClickElementFn=null,this.classDisabled="mg-c-button--disabled",this.classLoading="mg-c-button--loading",this.classFullWidth="mg-c-button--full-width",this.variant="primary",this.size="medium",this.fullWidth=!1,this.isIcon=!1,this.disableOnClick=!1,this.loading=!1,this.classCollection=new a(["mg-c-button"]),this.handleClick=t=>{this.disabled?t.stopPropagation():this.disableOnClick&&(this.loading=!0,this.disabled=!0)},this.handleKeydown=t=>{this.disabled||" "!==t.key?!this.disabled&&[g.ENTER,g.NUMPADENTER,g.SPACE].includes(t.key)&&(t.preventDefault(),this.element.dispatchEvent(new MouseEvent("click",{bubbles:!0}))):t.preventDefault()},this.handleKeyup=t=>{this.disabled||" "!==t.key||(t.preventDefault(),this.element.dispatchEvent(new MouseEvent("click",{bubbles:!0})))},this.setIconSize=()=>{var t,o;"medium"===this.size?null===(t=this.element.querySelector("mg-icon[size]"))||void 0===t||t.removeAttribute("size"):this.isIcon&&(null===(o=this.element.querySelector("mg-icon"))||void 0===o||o.setAttribute("size",this.size))}}validateVariant(t,o){if(!l.includes(t)){if(""===t)return void(this.variant=l[0]);throw new Error(`<mg-button> prop "variant" must be one of: ${l.join(", ")}. Passed value: ${c(t)}.`)}void 0!==o&&this.classCollection.delete(`mg-c-button--${o}`),this.classCollection.add(`mg-c-button--${t}`)}validateSize(t,o){if(!m.includes(t))throw new Error(`<mg-button> prop "size" must be one of: ${m.join(", ")}. Passed value: ${c(t)}.`);void 0!==o&&this.classCollection.delete(`mg-c-button--${o}`),this.classCollection.add(`mg-c-button--${t}`),this.setIconSize()}validateFullWidth(t){if(t&&this.isIcon)throw new Error('<mg-button> prop "fullWidth" cannot be used with prop "isIcon".');t?this.classCollection.add(this.classFullWidth):this.classCollection.delete(this.classFullWidth)}disabledHandler(t){!t&&this.disableOnClick&&(this.loading=!1),this.element.onclick=t?void 0:this.onClickElementFn,t?this.classCollection.add(this.classDisabled):this.classCollection.delete(this.classDisabled),this.disabledChange.emit(t)}watchIsIcon(t){if(t&&(this.classCollection.add("mg-c-button--icon"),!b(this.label)))throw new Error('<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.');this.setIconSize()}loadingHandler(t){t?this.classCollection.add(this.classLoading):this.classCollection.delete(this.classLoading)}componentWillLoad(){d(this),this.validateVariant(this.variant),this.validateFullWidth(this.fullWidth),this.validateSize(this.size),this.watchIsIcon(this.isIcon),this.onClickElementFn=this.element.onclick,this.disabledHandler(this.disabled)}componentDidLoad(){s((()=>{var t;const o=this.element.closest("form")||(null===(t=this.element.closest("mg-form"))||void 0===t?void 0:t.shadowRoot.querySelector("form"));o&&["submit",void 0].includes(this.type)&&this.element.addEventListener("click",(()=>{o.dispatchEvent(new SubmitEvent("submit",{bubbles:!0,cancelable:!0}))}))}))}render(){var t;return i(e,{key:"e79494f9da9f0c4c19841d44a85ee955f2e19016",role:"button",tabIndex:this.element.getAttribute("tabindex")||0,type:this.type,form:this.form,"full-width":this.fullWidth,"aria-label":this.label,"aria-disabled":null===(t=this.disabled)||void 0===t?void 0:t.toString(),onClick:this.handleClick,onKeyup:this.handleKeyup,onKeydown:this.handleKeydown},i("div",{key:"1a4802637eca8125d09cae3363ff11fe9b50ffd4",class:this.classCollection.join()},this.loading&&i("mg-icon",{key:"9f4512a0ed650c3af63e8216baa5b0eaabd4bfd2",icon:"loader",spin:!0}),i("div",{key:"9c0647c6741a0610a516bc2ac1cce328d3004d51",class:"mg-c-button__content"},i("slot",{key:"7875b875d0a8a8ac74faf233b0cd49462a775dc6"}))))}get element(){return this}static get watchers(){return{variant:[{validateVariant:0}],size:[{validateSize:0}],fullWidth:[{validateFullWidth:0}],disabled:[{disabledHandler:0}],isIcon:[{watchIsIcon:0}],loading:[{loadingHandler:0}]}}static get style(){return":host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:color-mix(in srgb, var(--mg-b-color-dark), transparent 90%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{border-color:var(--mg-c-button-color-border-primary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-primary), var(--mg-c-button-color-gradient-primary));color:var(--mg-c-button-color-text-primary)}:host(:hover) .mg-c-button.mg-c-button--primary:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--primary:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-primary)}.mg-c-button.mg-c-button--secondary{border-color:var(--mg-c-button-color-border-secondary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-secondary), var(--mg-c-button-color-gradient-secondary));color:var(--mg-c-button-color-text-secondary)}:host(:hover) .mg-c-button.mg-c-button--secondary:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--secondary:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-secondary)}.mg-c-button.mg-c-button--danger{border-color:var(--mg-c-button-color-border-danger);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger), var(--mg-c-button-color-gradient-danger));color:var(--mg-c-button-color-text-danger)}:host(:hover) .mg-c-button.mg-c-button--danger:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--danger:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-danger)}.mg-c-button.mg-c-button--info{border-color:var(--mg-c-button-color-border-info);background:linear-gradient(to bottom, var(--mg-c-button-color-background-info), var(--mg-c-button-color-gradient-info));color:var(--mg-c-button-color-text-info)}:host(:hover) .mg-c-button.mg-c-button--info:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--info:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-info)}.mg-c-button.mg-c-button--success{border-color:var(--mg-c-button-color-border-success);background:linear-gradient(to bottom, var(--mg-c-button-color-background-success), var(--mg-c-button-color-gradient-success));color:var(--mg-c-button-color-text-success)}:host(:hover) .mg-c-button.mg-c-button--success:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--success:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-success)}.mg-c-button.mg-c-button--warning{border-color:var(--mg-c-button-color-border-warning);background:linear-gradient(to bottom, var(--mg-c-button-color-background-warning), var(--mg-c-button-color-gradient-warning));color:var(--mg-c-button-color-text-warning)}:host(:hover) .mg-c-button.mg-c-button--warning:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--warning:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-warning)}.mg-c-button.mg-c-button--danger-alt{border-color:var(--mg-c-button-color-border-danger-alt);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger-alt), var(--mg-c-button-color-gradient-danger-alt));color:var(--mg-c-button-color-text-danger-alt)}:host(:hover) .mg-c-button.mg-c-button--danger-alt:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--danger-alt:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-danger-alt)}.mg-c-button{position:relative;display:inline-flex;min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-width:var(--mg-c-button-border-top-width, var(--mg-b-size-border)) var(--mg-c-button-border-right-width, var(--mg-b-size-border)) var(--mg-c-button-border-bottom-width, var(--mg-b-size-border)) var(--mg-c-button-border-left-width, var(--mg-b-size-border));border-style:solid;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-border-radius));background-image:none;column-gap:var(--mg-b-size-8);cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:var(--mg-b-size-8)}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--disabled,.mg-c-button[aria-disabled=true],.mg-c-button:disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--large{padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border)) calc(var(--mg-b-size-24) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon){line-height:var(--mg-b-size-24)}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) slot,.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) ::slotted(*){font-size:var(--mg-b-size-16)}.mg-c-button.mg-c-button--icon{width:var(--mg-b-size-min-height);height:var(--mg-b-size-min-height);justify-content:center;padding:0;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-icon-border-radius));font-size:var(--mg-b-font-size);line-height:var(--mg-b-font-size)}.mg-c-button.mg-c-button--icon.mg-c-button--large{width:unset;height:unset;padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--icon.mg-c-button--large ::slotted(*){min-width:var(--mg-b-size-24);min-height:var(--mg-b-size-24);align-items:center;justify-content:center}.mg-c-button.mg-c-button--full-width{display:flex;width:100%;justify-content:center}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible),:host([data-focus-visible]){outline:0}:host(:focus-visible) .mg-c-button,:host([data-focus-visible]) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}"}},[257,"mg-button",{variant:[1025],label:[1],type:[1],size:[1],fullWidth:[4,"full-width"],form:[1],disabled:[1028],isIcon:[4,"is-icon"],disableOnClick:[4,"disable-on-click"],loading:[32],classCollection:[32]},void 0,{variant:[{validateVariant:0}],size:[{validateSize:0}],fullWidth:[{validateFullWidth:0}],disabled:[{disabledHandler:0}],isIcon:[{watchIsIcon:0}],loading:[{loadingHandler:0}]}]);function v(){"undefined"!=typeof customElements&&["mg-button","mg-icon"].forEach((o=>{switch(o){case"mg-button":customElements.get(t(o))||customElements.define(t(o),h);break;case"mg-icon":customElements.get(t(o))||u()}}))}v();export{h as M,v as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as a,proxyCustomElement as r,HTMLElement as d,h as c}from"@stencil/core/internal/client";import{C as e}from"./index2.js";const
|
|
1
|
+
import{transformTag as a,proxyCustomElement as r,HTMLElement as d,h as c}from"@stencil/core/internal/client";import{C as e,t as s}from"./index2.js";const o=["xsmall","small","medium"],i=r(class extends d{constructor(a){super(),!1!==a&&this.__registerHost(),this.__attachShadow(),this.shadow=!1,this.radiusSize="medium",this.classCollection=new e(["mg-c-card"])}watchShadow(a){a?this.classCollection.add("mg-c-card--shadow"):this.classCollection.delete("mg-c-card--shadow")}watchRadiusSize(a,r){if(!o.includes(a)){if(""===String(a))return void(this.radiusSize="medium");throw new Error(`<mg-card> prop "radiusSize" must be one of: ${o.join(", ")}. Passed value: ${s(a)}.`)}void 0!==r&&this.classCollection.delete(`mg-c-card--radius-${r}`),this.classCollection.add(`mg-c-card--radius-${a}`)}componentWillLoad(){this.watchShadow(this.shadow),this.watchRadiusSize(this.radiusSize)}render(){return c("div",{key:"d652bf6913d37428bb9729d32fb3541543418a71",class:this.classCollection.join()},c("slot",{key:"5157ee6cf1330c907babad1f2190973dd4d9f39e"}))}static get watchers(){return{shadow:[{watchShadow:0}],radiusSize:[{watchRadiusSize:0}]}}static get style(){return".mg-c-card{position:relative;z-index:inherit;overflow:var(--mg-c-card-overflow, var(--mg-c-card-overflow-default));width:100%;min-width:var(--mg-c-card-min-width);max-width:var(--mg-c-card-max-width);max-height:var(--mg-c-card-max-height);box-sizing:border-box;padding:var(--mg-c-card-spacing, var(--mg-c-card-spacing-default));border:var(--mg-c-card-border, var(--mg-c-card-border-default));border-radius:var(--mg-c-card-border-radius, var(--mg-c-card-border-radius-default));background:var(--mg-c-card-color-background, var(--mg-c-card-color-background-default))}.mg-c-card ::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;--mg-c-card-max-height:unset;--mg-c-card-overflow:var(--mg-c-card-overflow-default)}.mg-c-card.mg-c-card--shadow{--mg-c-card-border:var(--mg-b-color-neutral-20);box-shadow:var(--mg-c-card-box-shadow, var(--mg-c-card-box-shadow-default))}.mg-c-card.mg-c-card--radius-xsmall{--mg-c-card-border-radius:var(--mg-b-size-4)}.mg-c-card.mg-c-card--radius-small{--mg-c-card-border-radius:var(--mg-b-size-8)}"}},[257,"mg-card",{shadow:[4],radiusSize:[1025,"radius-size"],classCollection:[32]},void 0,{shadow:[{watchShadow:0}],radiusSize:[{watchRadiusSize:0}]}]);function t(){"undefined"!=typeof customElements&&["mg-card"].forEach((r=>{"mg-card"===r&&(customElements.get(a(r))||customElements.define(a(r),i))}))}t();export{i as M,t as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as e,proxyCustomElement as t,HTMLElement as i,h as a}from"@stencil/core/internal/client";import{i as r}from"./
|
|
1
|
+
import{transformTag as e,proxyCustomElement as t,HTMLElement as i,h as a}from"@stencil/core/internal/client";import{i as r}from"./index4.js";import{a as n,t as s}from"./index2.js";const c=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.characters=""}watchIdentifier(e){void 0===e||n(e)||console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${s(e)}.`)}validateMaxlength(e){if("number"!=typeof e)throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${s(e)}.`)}componentWillLoad(){this.watchIdentifier(this.identifier),this.validateMaxlength(this.maxlength),this.messages=r(this.element).messages}render(){return a("span",{key:"41b489eafc25e9fe2e32b54a72542090d79e1052",id:this.identifier,"aria-live":"polite"},a("span",{key:"c9dd3eb15ebc866333d4e911e1a560cac1c07ef7","aria-hidden":"true"},this.maxlength-this.characters.length,"/",this.maxlength),a("span",{key:"0e4664f577b8db68f0355fc92f9df251f945dedd",class:"mg-u-visually-hidden"},this.messages.nbCharLeft.replace("{counter}",this.maxlength-this.characters.length)))}get element(){return this}static get watchers(){return{identifier:[{watchIdentifier:0}],maxlength:[{validateMaxlength:0}]}}static get style(){return".mg-u-visually-hidden.sc-mg-character-left{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}*.sc-mg-character-left:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*.sc-mg-character-left{animation:none !important;transition:none !important}}mg-character-left.sc-mg-character-left{display:block}"}},[2,"mg-character-left",{identifier:[1],characters:[1],maxlength:[2]},void 0,{identifier:[{watchIdentifier:0}],maxlength:[{validateMaxlength:0}]}]);function o(){"undefined"!=typeof customElements&&["mg-character-left"].forEach((t=>{"mg-character-left"===t&&(customElements.get(e(t))||customElements.define(e(t),c))}))}o();export{c as M,o as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as e,proxyCustomElement as t,HTMLElement as i,createEvent as a,h as s}from"@stencil/core/internal/client";import{i as n}from"./index2.js";import{
|
|
1
|
+
import{transformTag as e,proxyCustomElement as t,HTMLElement as i,createEvent as a,h as s}from"@stencil/core/internal/client";import{i as n}from"./index2.js";import{n as m}from"./index3.js";import{d as o}from"./mg-icon2.js";const d=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.expandedChange=a(this,"expanded-change",7),this.hideSummary=!1,this.expanded=!1,this.handleToggle=()=>{this.expanded=this.details.open}}validateTitles(e){if(!n(e))throw Error(`<mg-details> prop "toggleClosed" and "toggleOpened" is required and must be a valid string. Passed value: "toggleClosed='${this.toggleClosed}'" and "toggleOpened='${this.toggleOpened}'".`)}handleExpanded(e){this.expandedChange.emit(e)}componentWillLoad(){m(this),this.validateTitles(this.toggleClosed),this.validateTitles(this.toggleOpened);const e=this.element.querySelector('[slot="summary"]');this.isEmptySummary=null===e||!n(e.textContent),this.element.addEventListener("click",(e=>{null!==e.target.closest('[slot="summary"] mg-button, mg-button[slot="summary"]')&&e.preventDefault()}))}render(){return s("details",{key:"b4a342010e903cfd2a670e46257e889fd74ddf1e",class:{"mg-c-details":!0,"mg-c-details--empty-summary":this.isEmptySummary},onToggle:this.handleToggle,open:this.expanded,ref:e=>this.details=e},s("summary",{key:"85fbd6f675e20881a8eb8df776d827e25859e0b7"},s("slot",{key:"56491b2e4fa9f4772efd5ec66825e897b90cfde3",name:"summary"}),s("span",{key:"43f913504670d8f592479d5929e6901e9f9e9a9a",class:"mg-c-details__toggle"},s("mg-icon",{key:"268cfc8d4b9e55d87303e6a85dead205ecdd7ce1",icon:"chevron-up",class:{"mg-c-details__toggle-icon":!0,"mg-c-details__toggle-icon--reverse":!this.expanded}}),s("span",{key:"e3d7c794f7a8d83a31c02302a06bbe0db1e8b63d",class:{"mg-u-visually-hidden":this.hideSummary}},this.expanded?this.toggleOpened:this.toggleClosed))),s("div",{key:"e5230b49934c2b3e9a0c31821e53ea52084b2b26",class:"mg-c-details__details"},s("slot",{key:"0355f1596c85ab869b3658276ee156a7aadc50d1",name:"details"})))}get element(){return this}static get watchers(){return{toggleClosed:[{validateTitles:0}],toggleOpened:[{validateTitles:0}],expanded:[{handleExpanded:0}]}}static get style(){return".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}}.mg-c-details summary{display:inline-flex;align-items:baseline;cursor:pointer;gap:var(--mg-b-size-16)}.mg-c-details summary::-webkit-details-marker{display:none}.mg-c-details.mg-c-details--empty-summary summary{gap:unset}.mg-c-details__toggle{display:flex;min-height:calc(var(--mg-b-font-size)*var(--mg-b-line-height));flex-shrink:0;align-items:center;align-self:flex-start;gap:var(--mg-b-size-4)}.mg-c-details__toggle-icon.mg-c-details__toggle-icon--reverse{transform:rotate(180deg)}.mg-c-details__details{margin-top:var(--mg-c-details-spacing)}@media (width < 43.75rem){.mg-c-details:not(.mg-c-details--empty-summary) .mg-c-details__toggle>span{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}}"}},[257,"mg-details",{toggleClosed:[1,"toggle-closed"],toggleOpened:[1,"toggle-opened"],hideSummary:[4,"hide-summary"],expanded:[1028]},void 0,{toggleClosed:[{validateTitles:0}],toggleOpened:[{validateTitles:0}],expanded:[{handleExpanded:0}]}]);function l(){"undefined"!=typeof customElements&&["mg-details","mg-icon"].forEach((t=>{switch(t){case"mg-details":customElements.get(e(t))||customElements.define(e(t),d);break;case"mg-icon":customElements.get(e(t))||o()}}))}l();const r=d,g=l;export{r as MgDetails,g as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as i,proxyCustomElement as e,HTMLElement as d,h as t}from"@stencil/core/internal/client";const r=e(class extends d{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.fullWidth=!1}render(){return t("div",{key:"a1b0e3b95ed9f52febab9f8d50b4053d1c13f7fb",class:{"mg-c-divider":!0,"mg-c-divider--full-width":this.fullWidth}})}static get style(){return".mg-c-divider{width:var(--mg-b-size-120);height:var(--mg-c-divider-
|
|
1
|
+
import{transformTag as i,proxyCustomElement as e,HTMLElement as d,h as t}from"@stencil/core/internal/client";const r=e(class extends d{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.fullWidth=!1}render(){return t("div",{key:"a1b0e3b95ed9f52febab9f8d50b4053d1c13f7fb",class:{"mg-c-divider":!0,"mg-c-divider--full-width":this.fullWidth}})}static get style(){return".mg-c-divider{width:var(--mg-b-size-120);height:0;margin:var(--mg-c-divider-spacing-vertical) auto;border-block-start:var(--mg-c-divider-thickness) solid var(--mg-c-divider-color-background)}.mg-c-divider.mg-c-divider--full-width{width:100%}"}},[1,"mg-divider",{fullWidth:[4,"full-width"]}]);function s(){"undefined"!=typeof customElements&&["mg-divider"].forEach((e=>{"mg-divider"===e&&(customElements.get(i(e))||customElements.define(i(e),r))}))}s();export{r as M,s as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as t,proxyCustomElement as e,HTMLElement as i,h as s}from"@stencil/core/internal/client";import{C as o,i as n}from"./index2.js";import{i as
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as i,h as s}from"@stencil/core/internal/client";import{C as o,i as n}from"./index2.js";import{n as a}from"./index3.js";import{i as l,c as d}from"./mg-input.conf.js";import{d as r}from"./mg-icon2.js";import{d as h}from"./mg-input2.js";import{d as m}from"./mg-input-title2.js";import{d as c}from"./mg-tooltip2.js";import{d as p}from"./mg-tooltip-content2.js";const g=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.name=this.identifier,this.legendHide=!1,this.legendBorderDisplay=!1,this.readonly=!1,this.disabled=!1,this.classCollection=new o(["mg-c-input--fieldset"]),this.checkValidity=()=>{var t;this.valid=!(this.mgInputs.some((t=>t.invalid))||(null===(t=this.errorMessage)||void 0===t?void 0:t.length)>0)},this.setMgInputs=()=>{this.mgInputs=Array.from(this.element.querySelectorAll("*")).filter((t=>t.nodeName.startsWith("MG-INPUT"))),this.mgInputs.forEach((t=>{"MG-INPUT-FILE"===t.nodeName&&(this.readonly?t.setAttribute("hidden",""):t.removeAttribute("hidden")),this.readonly&&!l(t)?t.readonly=!0:this.disabled?t.disabled=!0:t.addEventListener("input-valid",this.checkValidity)}))}}watchLegendBorderDisplay(t){if(t&&!n(this.legendHeading))throw Error('<mg-fieldset> prop "legendBorderDisplay" must not be paired with the prop "legendHeading".')}watchReadonly(t){t?this.classCollection.add(d):this.classCollection.delete(d)}handleAttributeChange(){this.setMgInputs()}async setCustomValidity(t){this.errorMessage=n(t)?t:void 0,this.checkValidity()}async displayError(){this.readonly||this.mgInputs.forEach((t=>{t.displayError()}))}componentWillLoad(){a(this),this.watchReadonly(this.readonly),this.watchLegendBorderDisplay(this.legendBorderDisplay),this.setMgInputs()}componentDidLoad(){const t={childList:!0,subtree:!0};new MutationObserver((e=>{e.some((e=>Object.keys(t).includes(e.type)))&&this.setMgInputs()})).observe(this.element,t)}render(){return s("mg-input",{key:"547bdc6c4c35ae9949f185f110a24c5a6437cea7",label:this.legend,identifier:this.identifier,class:this.classCollection.join(),labelOnTop:!this.legendHide,labelHeading:this.legendHeading,labelBorderDisplay:this.legendHeading&&this.legendBorderDisplay,labelHide:this.legendHide,inputsOnBottom:void 0!==this.legendHeading,tooltip:this.tooltip,tooltipPosition:"label",helpText:this.helpText,errorMessage:!this.valid&&n(this.errorMessage)?this.errorMessage:void 0},s("span",{key:"4fe4ec0d810cf46192e61b5052caf3694c3444be",class:"mg-c-input__input-group"},s("slot",{key:"030481c1c7536b9d5e20975f77a86d3dda853582"})))}get element(){return this}static get watchers(){return{legendBorderDisplay:[{watchLegendBorderDisplay:0}],readonly:[{watchReadonly:0},{handleAttributeChange:0}],disabled:[{handleAttributeChange:0}]}}},[257,"mg-fieldset",{identifier:[1],name:[1],legend:[1],legendHide:[4,"legend-hide"],legendHeading:[1,"legend-heading"],legendBorderDisplay:[4,"legend-border-display"],readonly:[4],disabled:[4],tooltip:[1],helpText:[1,"help-text"],errorMessage:[32],valid:[32],classCollection:[32],setCustomValidity:[64],displayError:[64]},void 0,{legendBorderDisplay:[{watchLegendBorderDisplay:0}],readonly:[{watchReadonly:0},{handleAttributeChange:0}],disabled:[{handleAttributeChange:0}]}]);function u(){"undefined"!=typeof customElements&&["mg-fieldset","mg-icon","mg-input","mg-input-title","mg-tooltip","mg-tooltip-content"].forEach((e=>{switch(e){case"mg-fieldset":customElements.get(t(e))||customElements.define(t(e),g);break;case"mg-icon":customElements.get(t(e))||r();break;case"mg-input":customElements.get(t(e))||h();break;case"mg-input-title":customElements.get(t(e))||m();break;case"mg-tooltip":customElements.get(t(e))||c();break;case"mg-tooltip-content":customElements.get(t(e))||p()}}))}u();const b=g,f=u;export{b as MgFieldset,f as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as i,proxyCustomElement as t,HTMLElement as e,createEvent as s,h as
|
|
1
|
+
import{transformTag as i,proxyCustomElement as t,HTMLElement as e,createEvent as s,h as r}from"@stencil/core/internal/client";import{c as a,C as h,a as o,t as n}from"./index2.js";import{n as l}from"./index3.js";import{i as d}from"./index4.js";import{i as m}from"./mg-input.conf.js";const c=["form","search","none","presentation"],f=["default","hide"],u=t(class extends e{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.formValid=s(this,"form-valid",7),this.formSubmit=s(this,"form-submit",7),this.formReset=s(this,"form-reset",7),this.classAllRequired="mg-c-form--all-required",this.classLabelOnTop="mg-c-form--label-on-top",this.identifier=a("mg-form"),this.name=this.identifier,this.readonly=!1,this.labelOnTop=!1,this.disabled=!1,this.classCollection=new h(["mg-c-form"]),this.setRequiredMessage=()=>{if(this.requiredMessageText=null,this.classCollection.delete(this.classAllRequired),"hide"===this.requiredMessage)return;if("default"===this.requiredMessage)return void(this.requiredMessageText=this.messages.form.required);const i=i=>!(i.disabled||i.readonly),t=i=>"MG-INPUT-TOGGLE"===i.nodeName;if(!this.disabled&&!this.readonly&&this.mgInputs.some((e=>i(e)&&!t(e)))){const e=this.mgInputs.filter(i),s=e.filter((i=>!t(i)&&i.required));[s.length,e.length].every((i=>1===i))||s.length>1&&s.length===e.filter((i=>!t(i))).length?(this.requiredMessageText=this.getRequiredMessageBasedOnCount(s,"allRequiredSingle","allRequired"),this.classCollection.add(this.classAllRequired)):s.length>0&&(this.requiredMessageText=this.getRequiredMessageBasedOnCount(s,"requiredSingle","required"))}},this.getRequiredMessageBasedOnCount=(i,t,e)=>this.messages.form[1===i.length?t:e],this.checkValidity=()=>{this.setRequiredMessage(),this.valid=!this.mgInputs.some((i=>i.invalid)),this.invalid=!this.valid,this.formValid.emit(this.valid)},this.handleFormSubmit=i=>{i.preventDefault(),this.formSubmit.emit()},this.setMgInputs=()=>{this.mgInputs=Array.from(this.element.querySelectorAll("*")).filter((i=>i.nodeName.startsWith("MG-INPUT"))),this.mgInputs.forEach((i=>{this.labelOnTop&&(i.labelOnTop=!0),"MG-INPUT-FILE"===i.nodeName&&(this.readonly?i.setAttribute("hidden",""):i.removeAttribute("hidden")),this.readonly&&!m(i)?i.readonly=!0:this.disabled?i.disabled=!0:i.addEventListener("input-valid",this.checkValidity)}))}}watchIdentifier(i){o(i)||console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${n(i)}.`)}validateRequiredMessage(i){if(i&&!f.includes(i))throw Error(`<mg-form> prop "requiredMessage" must be one of: ${f.join(", ")}. Passed value: ${n(i)}.`)}validateAriaRole(i){if(i&&!c.includes(i))throw Error(`<mg-form> prop "ariaRole" must be one of: ${c.join(", ")}. Passed value: ${n(i)}.`)}handlelabelOnTop(i){i?this.classCollection.add(this.classLabelOnTop):this.classCollection.delete(this.classLabelOnTop)}handleAttributeChange(){this.setMgInputs(),this.setRequiredMessage()}async displayError(){this.readonly||([...Array.from(this.element.querySelectorAll("*")).filter((i=>i.nodeName.startsWith("MG-FIELDSET"))),...this.mgInputs].forEach((i=>{var t;null===(t=i.displayError)||void 0===t||t.call(i)})),this.checkValidity())}async reset(){this.readonly||(await Promise.all(this.mgInputs.map((async i=>{void 0!==i.reset&&await i.reset()}))),this.checkValidity(),this.formReset.emit(!0))}componentWillLoad(){this.messages=d(this.element).messages,l(this),this.watchIdentifier(this.identifier),this.validateAriaRole(this.ariaRole),this.validateRequiredMessage(this.requiredMessage),this.handlelabelOnTop(this.labelOnTop),this.mgButtons=Array.from(this.element.querySelectorAll("mg-button")),this.mgButtons.forEach((i=>{i.setAttribute("form",this.identifier),"reset"===i.type&&i.addEventListener("click",(()=>{this.reset()}))})),this.setMgInputs(),Promise.all(this.mgInputs.map((async i=>{try{await i.componentOnReady()}catch(i){}}))).then((()=>{this.checkValidity()}))}componentDidLoad(){const i={childList:!0,subtree:!0};new MutationObserver((t=>{t.some((t=>Object.keys(i).includes(t.type)))&&(this.setMgInputs(),this.checkValidity())})).observe(this.element,i)}render(){return r("form",{key:"bb340dafd9e9d987b4de94f718f81a63749b183c",class:this.classCollection.join(),id:this.identifier,name:this.name,onSubmit:this.handleFormSubmit,role:this.ariaRole},this.requiredMessageText&&r("p",{key:"5cdfc883ecd9a1e9759f952beac2c17f4d9a3237",innerHTML:this.requiredMessageText}),r("slot",{key:"d5879767bc1d23a7c31b119b2fa2a29b9f8bc76f"}),!this.readonly&&!this.disabled&&r("slot",{key:"c47af6bccd71ee51e1725c5592001d09add966b8",name:"actions"}))}get element(){return this}static get watchers(){return{identifier:[{watchIdentifier:0}],requiredMessage:[{validateRequiredMessage:0},{handleAttributeChange:0}],ariaRole:[{validateAriaRole:0}],labelOnTop:[{handlelabelOnTop:0}],readonly:[{handleAttributeChange:0}],disabled:[{handleAttributeChange:0}]}}static get style(){return".mg-u-form-legacy{--mg-c-form-inputs-title-width:calc(100% / 3 - 20px)}.mg-u-is-asterisk{color:var(--mg-b-color-danger)}.mg-c-form{--mg-c-input-title-width:var(--mg-c-form-inputs-title-width, calc(28 * var(--mg-b-size-8)));--mg-c-input-margin-bottom:var(--mg-b-size-16);--mg-c-input-title-horizontal-space:var(--mg-b-size-32)}.mg-c-form.mg-c-form--all-required{--mg-c-input-title-display:none}.mg-c-form.mg-c-form--label-on-top{--mg-c-input-margin-bottom:var(--mg-b-size-24)}.mg-c-form>p{font-size:var(--mg-b-font-size-small)}"}},[257,"mg-form",{identifier:[1],name:[1],readonly:[4],requiredMessage:[1,"required-message"],ariaRole:[1,"aria-role"],labelOnTop:[4,"label-on-top"],disabled:[4],valid:[1028],invalid:[1028],classCollection:[32],requiredMessageText:[32],displayError:[64],reset:[64]},void 0,{identifier:[{watchIdentifier:0}],requiredMessage:[{validateRequiredMessage:0},{handleAttributeChange:0}],ariaRole:[{validateAriaRole:0}],labelOnTop:[{handlelabelOnTop:0}],readonly:[{handleAttributeChange:0}],disabled:[{handleAttributeChange:0}]}]);function g(){"undefined"!=typeof customElements&&["mg-form"].forEach((t=>{"mg-form"===t&&(customElements.get(i(t))||customElements.define(i(t),u))}))}g();const b=u,p=g;export{b as MgForm,p as defineCustomElement}
|