@mgdis/mg-components 6.17.0 → 6.18.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.
Files changed (117) hide show
  1. package/dist/cjs/index-DCZEYvlH.js +4 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mg-action-more_37.cjs.entry.js +411 -168
  4. package/dist/cjs/mg-alert.cjs.entry.js +1 -1
  5. package/dist/cjs/mg-components.cjs.js +1 -1
  6. package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
  7. package/dist/cjs/mg-input-combobox.cjs.entry.js +71 -55
  8. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +33 -20
  9. package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-HYIzRsy7.js} +5 -0
  10. package/dist/cjs/mg-loader.cjs.entry.js +1 -1
  11. package/dist/cjs/mg-progress.cjs.entry.js +1 -1
  12. package/dist/collection/collection-manifest.json +1 -0
  13. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +4 -0
  14. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +178 -18
  15. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
  16. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +36 -16
  17. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +78 -55
  18. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +41 -22
  19. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +32 -12
  20. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +30 -12
  21. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +31 -12
  22. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +40 -20
  23. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +31 -12
  24. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +44 -25
  25. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +31 -13
  26. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +36 -11
  27. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +5 -1
  28. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
  29. package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
  30. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  31. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
  32. package/dist/collection/components/molecules/mg-form/mg-form.js +13 -4
  33. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  34. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  35. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  36. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  37. package/dist/collection/components/molecules/mg-panel/mg-panel.js +40 -9
  38. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  39. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  40. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  41. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  42. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  43. package/dist/components/mg-action-more.js +1 -1
  44. package/dist/components/mg-alert.js +1 -1
  45. package/dist/components/mg-details.js +1 -1
  46. package/dist/components/mg-fieldset.d.ts +11 -0
  47. package/dist/components/mg-fieldset.js +209 -0
  48. package/dist/components/mg-form.js +4 -3
  49. package/dist/components/mg-illustrated-message.js +1 -1
  50. package/dist/components/mg-input-checkbox-paginated2.js +1 -1
  51. package/dist/components/mg-input-checkbox.js +28 -15
  52. package/dist/components/mg-input-combobox.js +71 -55
  53. package/dist/components/mg-input-date.js +33 -21
  54. package/dist/components/mg-input-numeric.js +24 -11
  55. package/dist/components/mg-input-password.js +22 -11
  56. package/dist/components/mg-input-radio.js +23 -11
  57. package/dist/components/mg-input-rich-text-editor.js +32 -19
  58. package/dist/components/mg-input-select2.js +24 -12
  59. package/dist/components/mg-input-text2.js +36 -24
  60. package/dist/components/mg-input-textarea.js +23 -12
  61. package/dist/components/mg-input-toggle.js +35 -10
  62. package/dist/components/mg-input2.js +117 -18
  63. package/dist/components/mg-item-more2.js +5 -1
  64. package/dist/components/mg-loader2.js +1 -1
  65. package/dist/components/mg-message2.js +2 -2
  66. package/dist/components/mg-modal.js +2 -2
  67. package/dist/components/mg-panel.js +36 -7
  68. package/dist/components/mg-popover-content2.js +1 -1
  69. package/dist/components/mg-popover2.js +1 -1
  70. package/dist/components/mg-progress.js +1 -1
  71. package/dist/components/mg-skip-links.js +1 -1
  72. package/dist/components/mg-tabs2.js +1 -1
  73. package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
  74. package/dist/esm/index-T6kOJXP1.js +4 -0
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/mg-action-more_37.entry.js +412 -169
  77. package/dist/esm/mg-alert.entry.js +2 -2
  78. package/dist/esm/mg-components.js +1 -1
  79. package/dist/esm/mg-fieldset.entry.js +139 -0
  80. package/dist/esm/mg-input-combobox.entry.js +72 -56
  81. package/dist/esm/mg-input-rich-text-editor.entry.js +34 -21
  82. package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-D9V2v4n2.js} +5 -1
  83. package/dist/esm/mg-loader.entry.js +2 -2
  84. package/dist/esm/mg-progress.entry.js +2 -2
  85. package/dist/mg-components/mg-components.esm.js +1 -1
  86. package/dist/mg-components/p-2bab89c2.entry.js +1 -0
  87. package/dist/mg-components/{p-0e6b40d6.entry.js → p-5abc77cd.entry.js} +1 -1
  88. package/dist/mg-components/p-7d2e43b2.entry.js +1 -0
  89. package/dist/mg-components/{p-5dc3a1fb.entry.js → p-92e5e5a6.entry.js} +1 -1
  90. package/dist/mg-components/{p-c5da335e.entry.js → p-952288bd.entry.js} +1 -1
  91. package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
  92. package/dist/mg-components/p-D9V2v4n2.js +1 -0
  93. package/dist/mg-components/p-f2cddd52.entry.js +1 -0
  94. package/dist/mg-components/{p-397bf67b.entry.js → p-f6afaeb8.entry.js} +1 -1
  95. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +5 -0
  96. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
  97. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
  98. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +4 -2
  99. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
  100. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
  101. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
  102. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
  103. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -2
  104. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
  105. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -2
  106. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -2
  107. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
  108. package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
  109. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  110. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
  111. package/dist/types/components.d.ts +168 -18
  112. package/ide/intellij/web-types.json +272 -9
  113. package/ide/vscode/html-custom-data.json +243 -5
  114. package/package.json +15 -15
  115. package/dist/mg-components/p-8a69175b.entry.js +0 -1
  116. package/dist/mg-components/p-CNgv8hc5.js +0 -1
  117. package/dist/mg-components/p-d84d87ea.entry.js +0 -1
@@ -65,7 +65,7 @@ export class MgProgress {
65
65
  * @returns HTML Element
66
66
  */
67
67
  render() {
68
- return (h(Host, { key: '62c66dbd93249bfde3eb8ff449b49884edfe49c3', role: this.ariaRole, "aria-label": this.label, "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max }, h("div", { key: 'b349c9d7358086ca4668705a1935fd8bbdb86afa', class: "mg-c-progress" }, h("div", { key: '57cc19d07c0f006f8ecf3a1f86ec12e37ffd8d6b', class: { 'mg-c-progress__bar': true, 'mg-c-progress__bar--active': this.value > this.min } }, h("div", { key: 'b4c49d94d9cfe2e1a6d8013aa4a39cde51b36d04', class: "mg-c-progress__fill", style: {
68
+ return (h(Host, { key: '8e6c727e9416fa777fd94b32d618a9137e8e08f7', role: this.ariaRole, "aria-label": this.label, "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max }, h("div", { key: 'ac42ee9c5dda55d70aad7391895e4a013aaa27f9', class: "mg-c-progress" }, h("div", { key: '34c77bc6c133bc59b9daa68d7d6c8534f13f7d37', class: { 'mg-c-progress__bar': true, 'mg-c-progress__bar--active': this.value > this.min } }, h("div", { key: '7ea03a3f0c54ca0c81616c7c070d178a510dd7e1', 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: '66ea9a2abfd1db7a1c7c46e9cdcd15af013ea406', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { key: '07f404865c3ad0d815b87e32a46716136ed77d7d', 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)))))));
39
+ return (h("nav", { key: '5bf4427662bdca6512969bee91aa03f43a126743', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { key: '1d2b2a56b3960f70a3d37b333c77bf686643e0fd', 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"; }
@@ -234,7 +234,7 @@ export class MgTabs {
234
234
  * @returns HTML Element
235
235
  */
236
236
  render() {
237
- return (h("div", { key: '97f18baca4ae45b85401fd38570fe16d8df46c2b', class: this.classCollection.join() }, h("header", { key: '46cffaf2e14dde2a4994e894358caee7553b3bd6', 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: {
237
+ return (h("div", { key: 'ae71d21c9ce3acb07b3adf67bbe25f205d382abc', class: this.classCollection.join() }, h("header", { key: 'cf6cdae863602c956aa450a34e91a6d8b950d8f5', 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: {
238
238
  [`${this.buttonTabBaseClass}`]: true,
239
239
  [`${this.buttonTabBaseClass}--horizontal`]: true,
240
240
  [`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
@@ -156,7 +156,7 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class MgActionMore exten
156
156
  [`${this.classBase}__chevron--rotate`]: this.expanded === true,
157
157
  } }, h("mg-icon", { icon: "chevron-down" })));
158
158
  }
159
- return (h(Host, { key: 'f1b9e6e54f933a049628067993400d3a31d15710', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: '081b89284d5234f24e6073dcd9bf4088fd5a86b8', class: this.classBase }, h("mg-popover", { key: '0e6c50bc3bcb07f72507571de9fdda90226d2163', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, h("mg-button", { key: 'ab4a385069e0a33fe9d5bc026c98160eb4ec1dfa', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && h("mg-icon", Object.assign({ key: 'e9dc31c07c3c0f474cea70f5eeda36707d101e85' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: '201666b0bf5513e3360c3cc960e6cd6cd565dda1', slot: "content" }, h("mg-menu", { key: '3b0d56d9779b5bcaad31c714586dcda81bc550fa', direction: directions.VERTICAL, label: this.messages.label }, this.items.map(item => {
159
+ return (h(Host, { key: 'd75e1a5326ea3a1414f8048858e5ee3fee51760e', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: 'b671a6c35cb3a9fa6eb7b2329f0f595e78b573b5', class: this.classBase }, h("mg-popover", { key: '38a38123d34ca868d0587123c2ab6b11550da8f0', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, h("mg-button", { key: '030b9360917b79edfc8df325d5ca5cfa08356c81', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && h("mg-icon", Object.assign({ key: 'a47ca6b078ca160d1cbb13c964df3abede5f373c' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: 'ac38c705625cb5716a7e8aabd25d596db3d5adef', slot: "content" }, h("mg-menu", { key: 'cd382a65f69ba3c303a74d6b7444fcf0ccf9d1c5', direction: directions.VERTICAL, label: this.messages.label }, this.items.map(item => {
160
160
  var _a, _b;
161
161
  return isMgActionMoreDivider(item) ? (h("mg-divider", { class: "mg-c-action-more__divider", key: "divider", "full-width": true })) : (h("mg-menu-item", { key: item.label, status: item.status || Status.VISIBLE, target: item.target, href: item.href,
162
162
  // eslint-disable-next-line react/jsx-no-bind
@@ -161,7 +161,7 @@ const MgAlert$1 = /*@__PURE__*/ proxyCustomElement(class MgAlert extends HTMLEle
161
161
  * @returns HTML Element
162
162
  */
163
163
  render() {
164
- return (h("mg-message", { key: '626afcfe4c86dacff9860d2515827ae5aa6b7234', class: this.classCollection.join(), role: ['info', 'success'].includes(this.variant) ? 'status' : 'alert', variant: this.variant, variantStyle: this.variantStyle }, h("slot", { key: 'bc7d72c21dcf36c9012e144253ce2b3c6ebc14ed' }), this.hasActions ? (h("span", { slot: "actions" }, h("slot", { name: "actions" }))) : (h("span", { class: "mg-c-alert__close-button" }, h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.alert.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" }))))));
164
+ return (h("mg-message", { key: '4b974a10812e527a2c481ec00f22324ab490a135', class: this.classCollection.join(), role: ['info', 'success'].includes(this.variant) ? 'status' : 'alert', variant: this.variant, variantStyle: this.variantStyle }, h("slot", { key: '9133a3cca56d67e75e8c3f018c52838c31e908f2' }), this.hasActions ? (h("span", { slot: "actions" }, h("slot", { name: "actions" }))) : (h("span", { class: "mg-c-alert__close-button" }, h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.alert.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" }))))));
165
165
  }
166
166
  get element() { return this; }
167
167
  static get watchers() { return {
@@ -59,7 +59,7 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class MgDetails extends HTM
59
59
  * @returns HTML Element
60
60
  */
61
61
  render() {
62
- return (h("details", { key: '4da17afd7a964a14b5b101bcfadc241be569d55a', class: { 'mg-c-details': true, 'mg-c-details--empty-summary': this.isEmptySummary }, onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: '515d6c4e117b547fe80a310fb90e114900f645e8' }, h("slot", { key: '0c9c0dcc47dd418e34e541d878bfc03ca137c68d', name: "summary" }), h("span", { key: 'c94f52994843b10c1161c0d85f38f8cb917ea806', class: "mg-c-details__toggle" }, h("mg-icon", { key: '9421452572af3deb03146a8dfd189369b249ba2d', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: 'dbfb0b34da00e37f55ec07236611c2babdd6b7c5', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: '1b18b65a98e39a8663fa5d7e51eef5fbe2b92f76', class: "mg-c-details__details" }, h("slot", { key: '81c213594b1b67747db439624090784eaa5e6fcd', name: "details" }))));
62
+ return (h("details", { key: 'bbaac6909fa5f3fbd3236b2a8ace0f7c80b2580b', class: { 'mg-c-details': true, 'mg-c-details--empty-summary': this.isEmptySummary }, onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: '2ed8228b63403dd9b386bf3fa70c9094516b6f0e' }, h("slot", { key: '5461d77d2b2869b14737a5c7cfc40a1f9584ee03', name: "summary" }), h("span", { key: 'bb089365bdeaa7b934b97cff6f5f7c67587048e1', class: "mg-c-details__toggle" }, h("mg-icon", { key: 'dc1a30338703ad4182d50f9953a903ae0f68ecb1', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: 'a32cbaf9e38b71540deeaa8980895c34a7288ecb', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: 'b9c2bc7d681da8ac8b4dec5ff25287bc68975fb6', class: "mg-c-details__details" }, h("slot", { key: '069f05b4c133ff13055681e0b05bb98744303137', name: "details" }))));
63
63
  }
64
64
  get element() { return this; }
65
65
  static get watchers() { return {
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MgFieldset extends Components.MgFieldset, HTMLElement {}
4
+ export const MgFieldset: {
5
+ prototype: MgFieldset;
6
+ new (): MgFieldset;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,209 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+ import { C as ClassList, i as isValidString } from './index2.js';
3
+ import { d as defineCustomElement$5, c as classReadonly } from './mg-input2.js';
4
+ import { d as defineCustomElement$6 } from './mg-icon2.js';
5
+ import { d as defineCustomElement$4 } from './mg-input-title2.js';
6
+ import { d as defineCustomElement$3 } from './mg-tooltip2.js';
7
+ import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
8
+
9
+ const MgFieldset$1 = /*@__PURE__*/ proxyCustomElement(class MgFieldset extends HTMLElement {
10
+ constructor(registerHost) {
11
+ super();
12
+ if (registerHost !== false) {
13
+ this.__registerHost();
14
+ }
15
+ this.__attachShadow();
16
+ /**
17
+ * Fieldset name
18
+ * If not set the value equals the identifier
19
+ */
20
+ this.name = this.identifier;
21
+ /**
22
+ * Define if legend is visible
23
+ */
24
+ this.legendHide = false;
25
+ /**
26
+ * Define if legend border is visible.
27
+ */
28
+ this.legendBorderDisplay = false;
29
+ /**
30
+ * Define if inputs are readonly
31
+ */
32
+ this.readonly = false;
33
+ /**
34
+ * Define if inputs are disabled
35
+ */
36
+ this.disabled = false;
37
+ /**
38
+ * Component classes
39
+ */
40
+ this.classCollection = new ClassList(['mg-c-input--fieldset']);
41
+ /**
42
+ * Check if fieldset is valid
43
+ */
44
+ this.checkValidity = () => {
45
+ var _a;
46
+ this.valid = !(this.mgInputs.some(input => input.invalid) || ((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.length) > 0);
47
+ };
48
+ /**
49
+ * Set mgInputs
50
+ */
51
+ this.setMgInputs = () => {
52
+ // Get slotted mgInputs
53
+ this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT'));
54
+ // Set inputs readonly or disabled based on form configuration
55
+ // Othewise listen to events
56
+ this.mgInputs.forEach(input => {
57
+ if (this.readonly) {
58
+ input.readonly = true;
59
+ }
60
+ else if (this.disabled) {
61
+ input.disabled = true;
62
+ }
63
+ else {
64
+ input.addEventListener('input-valid', this.checkValidity);
65
+ }
66
+ });
67
+ };
68
+ }
69
+ watchLegendBorderDisplay(newValue) {
70
+ if (newValue && !isValidString(this.legendHeading)) {
71
+ throw new Error('<mg-fieldset> prop "legendBorderDisplay" must not be paired with the prop "legendHeading".');
72
+ }
73
+ }
74
+ watchReadonly(newValue) {
75
+ if (newValue) {
76
+ this.classCollection.add(classReadonly);
77
+ }
78
+ else {
79
+ this.classCollection.delete(classReadonly);
80
+ }
81
+ }
82
+ handleAttributeChange() {
83
+ this.setMgInputs();
84
+ }
85
+ /**
86
+ * Component is not a candidate for constraint validation.
87
+ * You can use this method to define the `errorMessage` and set the `valid` state to `false`.
88
+ * @param errorMessage - error message to display. Use a valid `string` to define an error or `undefined` to delete the error
89
+ */
90
+ async setCustomValidity(errorMessage) {
91
+ if (isValidString(errorMessage)) {
92
+ this.errorMessage = errorMessage;
93
+ }
94
+ else {
95
+ this.errorMessage = undefined;
96
+ }
97
+ this.checkValidity();
98
+ }
99
+ /**
100
+ * Display inputs error if it exists.
101
+ */
102
+ async displayError() {
103
+ if (!this.readonly) {
104
+ this.mgInputs.forEach(input => {
105
+ input.displayError();
106
+ });
107
+ }
108
+ }
109
+ /*************
110
+ * Lifecycle *
111
+ *************/
112
+ /**
113
+ * Check if component props are well configured on init
114
+ */
115
+ componentWillLoad() {
116
+ this.watchReadonly(this.readonly);
117
+ this.watchLegendBorderDisplay(this.legendBorderDisplay);
118
+ this.setMgInputs();
119
+ }
120
+ /**
121
+ * Add slot listeners
122
+ */
123
+ componentDidLoad() {
124
+ // Update mgInputs when mgForm content change
125
+ const observerOptions = { childList: true, subtree: true };
126
+ new MutationObserver(mutations => {
127
+ if (mutations.some(mutation => Object.keys(observerOptions).includes(mutation.type))) {
128
+ this.setMgInputs();
129
+ }
130
+ }).observe(this.element, observerOptions);
131
+ }
132
+ /**
133
+ * Render
134
+ * @returns HTML Element
135
+ */
136
+ render() {
137
+ return (h("mg-input", { key: 'b8b7c203bb2ed22cc9344389af5a6ae8d85af6d5', 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: this.legendHeading !== undefined, tooltip: this.tooltip, tooltipPosition: 'label', helpText: this.helpText, errorMessage: !this.valid && isValidString(this.errorMessage) ? this.errorMessage : undefined }, h("span", { key: 'c0e7480b14b0a8e136dd951bdce7275b65b59b48', class: "mg-c-input__input-group" }, h("slot", { key: '021e7b126cef9437e64622d8ef59219b09c06e9f' }))));
138
+ }
139
+ get element() { return this; }
140
+ static get watchers() { return {
141
+ "legendBorderDisplay": ["watchLegendBorderDisplay"],
142
+ "readonly": ["watchReadonly", "handleAttributeChange"],
143
+ "disabled": ["handleAttributeChange"]
144
+ }; }
145
+ }, [257, "mg-fieldset", {
146
+ "identifier": [1],
147
+ "name": [1],
148
+ "legend": [1],
149
+ "legendHide": [4, "legend-hide"],
150
+ "legendHeading": [1, "legend-heading"],
151
+ "legendBorderDisplay": [4, "legend-border-display"],
152
+ "readonly": [4],
153
+ "disabled": [4],
154
+ "tooltip": [1],
155
+ "helpText": [1, "help-text"],
156
+ "errorMessage": [32],
157
+ "valid": [32],
158
+ "classCollection": [32],
159
+ "setCustomValidity": [64],
160
+ "displayError": [64]
161
+ }, undefined, {
162
+ "legendBorderDisplay": ["watchLegendBorderDisplay"],
163
+ "readonly": ["watchReadonly", "handleAttributeChange"],
164
+ "disabled": ["handleAttributeChange"]
165
+ }]);
166
+ function defineCustomElement$1() {
167
+ if (typeof customElements === "undefined") {
168
+ return;
169
+ }
170
+ const components = ["mg-fieldset", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
171
+ components.forEach(tagName => { switch (tagName) {
172
+ case "mg-fieldset":
173
+ if (!customElements.get(tagName)) {
174
+ customElements.define(tagName, MgFieldset$1);
175
+ }
176
+ break;
177
+ case "mg-icon":
178
+ if (!customElements.get(tagName)) {
179
+ defineCustomElement$6();
180
+ }
181
+ break;
182
+ case "mg-input":
183
+ if (!customElements.get(tagName)) {
184
+ defineCustomElement$5();
185
+ }
186
+ break;
187
+ case "mg-input-title":
188
+ if (!customElements.get(tagName)) {
189
+ defineCustomElement$4();
190
+ }
191
+ break;
192
+ case "mg-tooltip":
193
+ if (!customElements.get(tagName)) {
194
+ defineCustomElement$3();
195
+ }
196
+ break;
197
+ case "mg-tooltip-content":
198
+ if (!customElements.get(tagName)) {
199
+ defineCustomElement$2();
200
+ }
201
+ break;
202
+ } });
203
+ }
204
+ defineCustomElement$1();
205
+
206
+ const MgFieldset = MgFieldset$1;
207
+ const defineCustomElement = defineCustomElement$1;
208
+
209
+ export { MgFieldset, defineCustomElement };
@@ -166,11 +166,12 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class MgForm extends HTMLEleme
166
166
  this.setRequiredMessage();
167
167
  }
168
168
  /**
169
- * Display input error if it exists.
169
+ * Display inputs/fieldsets errors if it exists.
170
170
  */
171
171
  async displayError() {
172
172
  if (!this.readonly) {
173
- this.mgInputs.forEach(input => {
173
+ const mgFieldsets = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-FIELDSET'));
174
+ [...mgFieldsets, ...this.mgInputs].forEach(input => {
174
175
  var _a;
175
176
  (_a = input.displayError) === null || _a === void 0 ? void 0 : _a.call(input);
176
177
  });
@@ -246,7 +247,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class MgForm extends HTMLEleme
246
247
  * @returns HTML Element
247
248
  */
248
249
  render() {
249
- return (h("form", { key: 'd6842c8daef22c0a3747147d99d7bf6920f7623e', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: 'cf5d9f380dfce313811df2dec390543ee19dffcb', innerHTML: this.requiredMessageText }), h("slot", { key: '2f03dd98f92469bc34b8bf9b8a8ef79cf8adf25c' }), !this.readonly && !this.disabled && h("slot", { key: 'c0f38f24c59d70703accf5fc63a2b58a92a952f0', name: "actions" })));
250
+ return (h("form", { key: '8b698b2a33af00e36691abab5adff5488b736218', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: '2e1fb5c4030ecb99d1f18c57d5c3fe238db4d12e', innerHTML: this.requiredMessageText }), h("slot", { key: '568fb8ac9ab0e3521899c05472592ebd15cc91fa' }), !this.readonly && !this.disabled && h("slot", { key: 'd4f38320de58f3b1d491083a34d1b5366d22b935', name: "actions" })));
250
251
  }
251
252
  get element() { return this; }
252
253
  static get watchers() { return {
@@ -92,7 +92,7 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class MgIllustra
92
92
  * @returns HTML Element
93
93
  */
94
94
  render() {
95
- return (h("div", { key: 'b7cea46c2fad219e02009fa44c772c0a09a5234f', class: this.classCollection.join() }, h("div", { key: '56b956ee405886ef2de2ef413ac1bc6902f287b3', class: "mg-c-illustrated-message__illustration" }, h("slot", { key: '33183d226a2443ccf1763ebff4c48f670d1d77ec', name: "illustration" })), h("div", { key: '69a7e034da7e2aef8dc488f9275b4546e905513c', class: "mg-c-illustrated-message__slots" }, h("slot", { key: '0eb9d5126f3d13380ea0a13a9eb754a7543e4178', name: "title" }), h("slot", { key: '088d3bae3be0d5e5d9fc8c07fee42dda39177fd6', name: "details" }))));
95
+ return (h("div", { key: 'c9d8c8bfd2792b1cf5e78ab9d168d597b20e9a1e', class: this.classCollection.join() }, h("div", { key: 'cc8fa03147b9e59e6e8e015be9ed2b8dddd92ded', class: "mg-c-illustrated-message__illustration" }, h("slot", { key: '83a4ec2223c4e74511beb7c0abfa10e77cee425d', name: "illustration" })), h("div", { key: 'dbb4d13ca5324cab889fa2acc9b9b22522d7a8ec', class: "mg-c-illustrated-message__slots" }, h("slot", { key: '9e74d84becf29539ec9c37e8ad1e317714f3c86c', name: "title" }), h("slot", { key: 'ae97d25c19b76ca092560d2555ebd6a87f542ffe', name: "details" }))));
96
96
  }
97
97
  get element() { return this; }
98
98
  static get watchers() { return {
@@ -88,7 +88,7 @@ const MgInputCheckboxPaginated = /*@__PURE__*/ proxyCustomElement(class MgInputC
88
88
  render() {
89
89
  const listId = formatID(this.messages.label);
90
90
  const tabId = 'tab-info';
91
- return (h(Host, { key: '8e58037e78fcd7990bbd681053758b0ec4d0c4e0' }, h("slot", { key: 'c64e9c8f65a526b2289d3663fff64df02a282c96', name: "header-action" }), h("div", { key: 'c5953bb7e970384b231865d7fa4708fe2da4b407', class: "mg-c-input__tabs-content" }, h("p", { key: 'c0899cb7e7a6dea282f05aacf0fb05acd60a9d20', id: tabId, class: { 'mg-c-input__popover-info': true, 'mg-u-visually-hidden': this.items.length !== 0 }, "aria-live": this.items.length !== 0 ? 'polite' : undefined }, this.items.length === 0 ? this.messages.noValue : this.messages.values.replace('{count}', this.items.length.toString())), this.items.length > 0 && (h(MgInputCheckboxList, { key: '0bb1b4160d75b00d3fb5d9c08f3a560a16105e57', checkboxes: this.items, labelledby: tabId, id: listId, disabled: this.disabled, name: this.name, invalid: this.invalid })), this.hasNext() && (h("mg-button", { key: "load-more", variant: "flat", class: "mg-c-input__load-more", tabIndex: -1, "full-width": true, onClick: this.handleLoadMore, "aria-controls": listId }, h("mg-icon", { key: 'fd1560d7254f437f284925427130f69539b5fd3b', icon: "chevron-down" }), this.messages.showMore)))));
91
+ return (h(Host, { key: '233ab4fca3f4a3121bc60650ac2f8ae06d47e6e5' }, h("slot", { key: '7d1af8c712928c06953743fc5c182e51d9a6256b', name: "header-action" }), h("div", { key: '95641bd218e36422a6b5b4ead8dd5498e8ac5fa4', class: "mg-c-input__tabs-content" }, h("p", { key: '34814dd1afc9f871cd032500b931e692d63cbd25', id: tabId, class: { 'mg-c-input__popover-info': true, 'mg-u-visually-hidden': this.items.length !== 0 }, "aria-live": this.items.length !== 0 ? 'polite' : undefined }, this.items.length === 0 ? this.messages.noValue : this.messages.values.replace('{count}', this.items.length.toString())), this.items.length > 0 && (h(MgInputCheckboxList, { key: '621077f291a401737157ad0cd9b9348537ef8bdc', checkboxes: this.items, labelledby: tabId, id: listId, disabled: this.disabled, name: this.name, invalid: this.invalid })), this.hasNext() && (h("mg-button", { key: "load-more", variant: "flat", class: "mg-c-input__load-more", tabIndex: -1, "full-width": true, onClick: this.handleLoadMore, "aria-controls": listId }, h("mg-icon", { key: 'cb00bbeb1575475b184cc9623db6c4cefc56c26a', icon: "chevron-down" }), this.messages.showMore)))));
92
92
  }
93
93
  static get watchers() { return {
94
94
  "checkboxes": ["watchCheckboxes"],
@@ -48,6 +48,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
48
48
  this.inputValid = createEvent(this, "input-valid", 7);
49
49
  // hasDisplayedError (triggered by blur event)
50
50
  this.hasDisplayedError = false;
51
+ this.customErrorMessage = { lock: false };
51
52
  this.mode = 'custom';
52
53
  // style
53
54
  this.baseClassName = 'mg-c-input--checkbox';
@@ -265,17 +266,20 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
265
266
  };
266
267
  /**
267
268
  * Set input error message
268
- * @param displayError - dispay error condition
269
- * @param errorMessage - errorMessage override
269
+ * @param fromSetErrorContext - context come from `setError` method
270
270
  */
271
- this.setErrorMessage = (displayError = true, errorMessage) => {
271
+ this.setErrorMessage = (fromSetErrorContext = false) => {
272
272
  // Set error message
273
273
  this.errorMessage = undefined;
274
- if (displayError && !this.valid) {
275
- if (errorMessage !== undefined)
276
- this.errorMessage = errorMessage;
277
- else if (!this.validateRequired())
274
+ if (!this.valid) {
275
+ // Does have a new custom error message OR does have a custom error message locked
276
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
277
+ this.errorMessage = this.customErrorMessage.message;
278
+ }
279
+ // required
280
+ else if (!this.validateRequired()) {
278
281
  this.errorMessage = this.messages.errors.required;
282
+ }
279
283
  }
280
284
  };
281
285
  /**
@@ -369,7 +373,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
369
373
  this.checkValidity();
370
374
  if (this.hasDisplayedError) {
371
375
  this.hasDisplayedError = prop !== 'required';
372
- this.setErrorMessage(this.hasDisplayedError);
376
+ this.setErrorMessage();
373
377
  }
374
378
  this.setButtonTextKey();
375
379
  }
@@ -433,17 +437,22 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
433
437
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
434
438
  * @param valid - value indicating the validity
435
439
  * @param errorMessage - the error message to display
440
+ * @param errorMessageLock - lock the error message and validity state
436
441
  */
437
- async setError(valid, errorMessage) {
442
+ async setError(valid, errorMessage, errorMessageLock = false) {
438
443
  if (typeof valid !== 'boolean') {
439
444
  throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
440
445
  }
441
- else if (!isValidString(errorMessage)) {
446
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
442
447
  throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
443
448
  }
444
449
  else {
450
+ this.customErrorMessage = {
451
+ lock: valid ? false : errorMessageLock,
452
+ message: valid ? undefined : errorMessage,
453
+ };
445
454
  this.setValidity(valid);
446
- this.setErrorMessage(undefined, valid ? undefined : errorMessage);
455
+ this.setErrorMessage(true);
447
456
  this.hasDisplayedError = this.invalid;
448
457
  }
449
458
  }
@@ -461,6 +470,8 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
461
470
  // - Keep everything in sync both inside and outside the component
462
471
  return new Promise(resolve => {
463
472
  requestAnimationFrame(() => {
473
+ // unlock validity check by reseting customErrorMessage
474
+ this.customErrorMessage = { lock: false };
464
475
  this.checkValidity();
465
476
  this.errorMessage = undefined;
466
477
  this.hasDisplayedError = false;
@@ -474,11 +485,13 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
474
485
  * @param newValue - valid new value
475
486
  */
476
487
  setValidity(newValue) {
477
- const oldValidValue = this.valid;
478
- this.valid = newValue;
488
+ const oldValue = this.valid;
489
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
490
+ this.valid = newValue;
491
+ }
479
492
  this.invalid = !this.valid;
480
493
  // We need to send valid event even if it is the same value
481
- if (this.valid !== oldValidValue)
494
+ if (this.valid !== oldValue)
482
495
  this.inputValid.emit(this.valid);
483
496
  }
484
497
  /**
@@ -597,7 +610,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
597
610
  else {
598
611
  inputContent = this.renderCheckboxMulti();
599
612
  }
600
- return (h("mg-input", { key: '84d13ac702497773013daa72357e4d1dcf4ebb30', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
613
+ return (h("mg-input", { key: '5addea288b5c87fec33a56449d14f861aefd465d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
601
614
  }
602
615
  get element() { return this; }
603
616
  static get watchers() { return {