@mgdis/mg-components 6.17.0 → 6.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/cjs/{index-DCZEYvlH.js → index-Bp6wZzau.js} +5 -1
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/mg-action-more_37.cjs.entry.js +438 -212
  4. package/dist/cjs/mg-alert.cjs.entry.js +2 -2
  5. package/dist/cjs/mg-components.cjs.js +2 -2
  6. package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
  7. package/dist/cjs/mg-input-combobox.cjs.entry.js +93 -80
  8. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +35 -26
  9. package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-D7jmj_lh.js} +7 -0
  10. package/dist/cjs/mg-loader.cjs.entry.js +2 -2
  11. package/dist/cjs/mg-progress.cjs.entry.js +2 -2
  12. package/dist/collection/assets/icons/index.js +1 -1
  13. package/dist/collection/collection-manifest.json +1 -0
  14. package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
  15. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +5 -0
  16. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +178 -18
  17. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
  18. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +36 -16
  19. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +98 -78
  20. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +41 -22
  21. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +32 -12
  22. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +30 -12
  23. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +31 -12
  24. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +41 -25
  25. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +31 -12
  26. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +60 -40
  27. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +35 -33
  28. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +36 -11
  29. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
  30. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +5 -1
  31. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
  32. package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
  33. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  34. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
  35. package/dist/collection/components/molecules/mg-form/mg-form.js +13 -4
  36. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  37. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  38. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  39. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  40. package/dist/collection/components/molecules/mg-panel/mg-panel.js +40 -9
  41. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  42. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  43. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  44. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  45. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  46. package/dist/components/mg-action-more.js +1 -1
  47. package/dist/components/mg-alert.js +1 -1
  48. package/dist/components/mg-details.js +1 -1
  49. package/dist/components/mg-fieldset.d.ts +11 -0
  50. package/dist/components/mg-fieldset.js +209 -0
  51. package/dist/components/mg-form.js +4 -3
  52. package/dist/components/mg-icon2.js +1 -1
  53. package/dist/components/mg-illustrated-message.js +2 -2
  54. package/dist/components/mg-input-checkbox-paginated2.js +1 -1
  55. package/dist/components/mg-input-checkbox.js +29 -16
  56. package/dist/components/mg-input-combobox.js +92 -79
  57. package/dist/components/mg-input-date.js +34 -22
  58. package/dist/components/mg-input-numeric.js +25 -12
  59. package/dist/components/mg-input-password.js +23 -12
  60. package/dist/components/mg-input-radio.js +23 -11
  61. package/dist/components/mg-input-rich-text-editor.js +33 -24
  62. package/dist/components/mg-input-select2.js +24 -12
  63. package/dist/components/mg-input-text2.js +51 -39
  64. package/dist/components/mg-input-textarea.js +28 -33
  65. package/dist/components/mg-input-toggle.js +35 -10
  66. package/dist/components/mg-input2.js +119 -19
  67. package/dist/components/mg-item-more2.js +5 -1
  68. package/dist/components/mg-loader2.js +1 -1
  69. package/dist/components/mg-message2.js +2 -2
  70. package/dist/components/mg-modal.js +3 -3
  71. package/dist/components/mg-panel.js +37 -8
  72. package/dist/components/mg-popover-content2.js +2 -2
  73. package/dist/components/mg-popover2.js +2 -2
  74. package/dist/components/mg-progress.js +1 -1
  75. package/dist/components/mg-skip-links.js +1 -1
  76. package/dist/components/mg-tabs2.js +1 -1
  77. package/dist/esm/{index-T6kOJXP1.js → index-BluNKQ3L.js} +5 -1
  78. package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
  79. package/dist/esm/loader.js +3 -3
  80. package/dist/esm/mg-action-more_37.entry.js +439 -213
  81. package/dist/esm/mg-alert.entry.js +3 -3
  82. package/dist/esm/mg-components.js +3 -3
  83. package/dist/esm/mg-fieldset.entry.js +139 -0
  84. package/dist/esm/mg-input-combobox.entry.js +94 -81
  85. package/dist/esm/mg-input-rich-text-editor.entry.js +36 -27
  86. package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-DDnrE1hD.js} +6 -1
  87. package/dist/esm/mg-loader.entry.js +3 -3
  88. package/dist/esm/mg-progress.entry.js +3 -3
  89. package/dist/mg-components/mg-components.css +1 -1
  90. package/dist/mg-components/mg-components.esm.js +1 -1
  91. package/dist/mg-components/p-016bd291.entry.js +1 -0
  92. package/dist/mg-components/{p-397bf67b.entry.js → p-186a6139.entry.js} +1 -1
  93. package/dist/mg-components/p-66a1cb83.entry.js +1 -0
  94. package/dist/mg-components/p-6efd819f.entry.js +1 -0
  95. package/dist/mg-components/{p-c5da335e.entry.js → p-916dfb6d.entry.js} +1 -1
  96. package/dist/mg-components/p-BluNKQ3L.js +2 -0
  97. package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
  98. package/dist/mg-components/p-DDnrE1hD.js +1 -0
  99. package/dist/mg-components/{p-0e6b40d6.entry.js → p-d2c72f09.entry.js} +1 -1
  100. package/dist/mg-components/{p-5dc3a1fb.entry.js → p-d5a276eb.entry.js} +1 -1
  101. package/dist/types/assets/icons/index.d.ts +9 -0
  102. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +6 -0
  103. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
  104. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
  105. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +1 -0
  106. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +8 -7
  107. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
  108. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
  109. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
  110. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
  111. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -3
  112. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
  113. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +5 -7
  114. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -8
  115. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
  116. package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
  117. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  118. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
  119. package/dist/types/components.d.ts +168 -18
  120. package/ide/intellij/web-types.json +289 -22
  121. package/ide/vscode/css-custom-data.json +7 -3
  122. package/ide/vscode/html-custom-data.json +300 -8
  123. package/package.json +18 -18
  124. package/dist/mg-components/p-8a69175b.entry.js +0 -1
  125. package/dist/mg-components/p-CNgv8hc5.js +0 -1
  126. package/dist/mg-components/p-T6kOJXP1.js +0 -2
  127. package/dist/mg-components/p-d84d87ea.entry.js +0 -1
@@ -4,6 +4,7 @@ import { initLocales } from "../../../locales";
4
4
  import { expandToggleDisplays, titlePositions } from "./mg-panel.conf";
5
5
  /**
6
6
  * @slot - Panel content
7
+ * @slot panel-title - Panel title content (replaces panel-title prop when used)
7
8
  * @slot header-right - Header right panel content
8
9
  */
9
10
  export class MgPanel {
@@ -48,6 +49,13 @@ export class MgPanel {
48
49
  /************
49
50
  * Methods *
50
51
  ************/
52
+ /**
53
+ * Check if panel-title slot is used
54
+ * @returns true if slot is used
55
+ */
56
+ this.hasPanelTitleSlot = () => {
57
+ return this.element.querySelector('[slot="panel-title"]') !== null;
58
+ };
51
59
  /**
52
60
  * Toggle is editing state
53
61
  */
@@ -101,7 +109,7 @@ export class MgPanel {
101
109
  * Render collapse button
102
110
  * @returns collpase button
103
111
  */
104
- this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", "aria-expanded": this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.panelTitle }, h("span", { class: "mg-c-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: { 'mg-c-panel__collapse-button-icon': true, 'mg-c-panel__collapse-button-icon--reverse': !this.expanded } }), !this.isEditing && this.expandToggleDisplay !== 'icon' && this.panelTitle)));
112
+ this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", "aria-expanded": this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.expandToggleDisplay === 'icon' ? this.panelTitle : undefined }, h("span", { class: "mg-c-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: { 'mg-c-panel__collapse-button-icon': true, 'mg-c-panel__collapse-button-icon--reverse': !this.expanded } }), !this.isEditing && this.expandToggleDisplay !== 'icon' && (this.hasPanelTitleSlot() ? h("slot", { name: "panel-title" }) : this.panelTitle))));
105
113
  /**
106
114
  * Render edit button
107
115
  * @returns edit Button
@@ -118,7 +126,8 @@ export class MgPanel {
118
126
  */
119
127
  this.renderTitle = () => {
120
128
  const elementsToRender = [this.renderCollapseButton()];
121
- if (this.titleEditable) {
129
+ // Add edit functionality only if not using slot and title is editable
130
+ if (this.titleEditable && !this.hasPanelTitleSlot()) {
122
131
  if (!this.isEditing)
123
132
  elementsToRender.push(this.renderEditButton());
124
133
  else
@@ -144,14 +153,24 @@ export class MgPanel {
144
153
  }
145
154
  }
146
155
  validatePanelTitle(newValue) {
147
- if (!isValidString(newValue))
148
- throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${toString(newValue)}.`);
149
- this.titleChange.emit(newValue);
156
+ if (newValue !== undefined) {
157
+ if (!isValidString(newValue)) {
158
+ throw new Error(`<mg-panel> prop "panelTitle" must be a string. Passed value: ${toString(newValue)}.`);
159
+ }
160
+ else {
161
+ this.titleChange.emit(newValue);
162
+ }
163
+ }
150
164
  }
151
165
  validateTitlePattern(newValue) {
152
166
  if (newValue !== undefined && !this.titleEditable)
153
167
  throw new Error(`<mg-panel> prop "titleEditable" must be set to "true".`);
154
168
  }
169
+ validateTitleEditable(newValue) {
170
+ if (newValue && this.hasPanelTitleSlot()) {
171
+ throw new Error(`<mg-panel> prop "titleEditable" cannot be used with panel-title slot.`);
172
+ }
173
+ }
155
174
  validateTitlePosition(newValue) {
156
175
  if (!titlePositions.includes(newValue))
157
176
  throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${toString(newValue)}.`);
@@ -164,6 +183,9 @@ export class MgPanel {
164
183
  throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${toString(newValue)}.`);
165
184
  if (newValue === 'icon' && this.titleEditable)
166
185
  this.titleEditable = false;
186
+ if (newValue === 'icon' && this.hasPanelTitleSlot()) {
187
+ throw new Error(`<mg-panel> prop "expandToggleDisplay" cannot be "icon" when panel-title slot is used.`);
188
+ }
167
189
  }
168
190
  /*************
169
191
  * Lifecycle *
@@ -178,9 +200,15 @@ export class MgPanel {
178
200
  this.watchIdentifier(this.identifier);
179
201
  this.validateTitlePattern(this.titlePattern);
180
202
  this.validateTitlePattern(this.titlePatternErrorMessage);
181
- this.validatePanelTitle(this.panelTitle);
203
+ // Only validate panelTitle if slot is not used
204
+ if (!this.hasPanelTitleSlot()) {
205
+ if (!isValidString(this.panelTitle))
206
+ throw new Error(`<mg-panel> prop "panelTitle" is required when panel-title slot is not used.`);
207
+ this.validatePanelTitle(this.panelTitle);
208
+ }
182
209
  this.validateExpandToggleDisplay(this.expandToggleDisplay);
183
210
  this.validateTitlePosition(this.titlePosition);
211
+ this.validateTitleEditable(this.titleEditable);
184
212
  }
185
213
  /**
186
214
  * Edit DOM after render
@@ -196,7 +224,7 @@ export class MgPanel {
196
224
  */
197
225
  render() {
198
226
  const headerId = `${this.identifier}-header`;
199
- return (h("section", { key: '6d9b0759cf8d6a8e94a1a6598f45fc00288ca22a', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '21b0d991daf053506097333df58d3b98ec2e5b0e', shadow: this.shadow }, h("header", { key: 'abd9dbeb13d85c9a66aac13e7b32e6a83e2ded57', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: '23c74b70bd275fb18c853a1b7a0a4b4ff5a4c605', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '15561936437c960768c4954f45df4045ac3dee03' })))));
227
+ return (h("section", { key: '3662204d763051c34ea13de4b7b3f7abc7914b81', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '46f113258172b1d040f65a4d312554b0c0551489', shadow: this.shadow }, h("header", { key: '1d7e7a48a5c4f89d141a5a7e46b220d4f9c082a5', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: 'ab0aec831cc79d982b7556d6e245c80ae2979083', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: 'e831573fe9d5ff783073d123b7e2a54baad73bfc' })))));
200
228
  }
201
229
  static get is() { return "mg-panel"; }
202
230
  static get encapsulation() { return "shadow"; }
@@ -240,8 +268,8 @@ export class MgPanel {
240
268
  "resolved": "string",
241
269
  "references": {}
242
270
  },
243
- "required": true,
244
- "optional": false,
271
+ "required": false,
272
+ "optional": true,
245
273
  "docs": {
246
274
  "tags": [],
247
275
  "text": "Panel title"
@@ -487,6 +515,9 @@ export class MgPanel {
487
515
  }, {
488
516
  "propName": "titlePatternErrorMessage",
489
517
  "methodName": "validateTitlePattern"
518
+ }, {
519
+ "propName": "titleEditable",
520
+ "methodName": "validateTitleEditable"
490
521
  }, {
491
522
  "propName": "titlePosition",
492
523
  "methodName": "validateTitlePosition"
@@ -46,7 +46,7 @@ export class MgPopoverContent {
46
46
  * @returns HTML Element
47
47
  */
48
48
  render() {
49
- return (h(Host, { key: '2746e72f636c1a702d2b15836343ca8503f233e5' }, h("mg-card", { key: '84e28550627969d4e15ded5a5f8b6d19584eb891', class: this.classCollection.join(), shadow: true }, this.closeButton && (h("mg-button", { key: 'f25c773593441597e81330997df3175cd9a963e4', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: '723f3d1e8a85356d7aa9be9c875b273d7c9c1f72', icon: "cross" }))), h("div", { key: '283316f2a66212d9afc128aaec3fb24e4a40c0eb', class: "mg-c-popover-content__title" }, h("slot", { key: 'a1839a9a3259ccb221b90e82f786eb0e7c3d2a19', name: "title" })), h("slot", { key: '708903013417e27f4a9ed9811fde886d6b697dec', name: "content" })), h("slot", { key: 'fad6024a2474ffd5f46925101baa0e6ab9f2e951', name: "arrow" })));
49
+ return (h(Host, { key: '054fc82954b39a488f7fe5cb391d89b5fa4a61fe' }, h("mg-card", { key: 'bb89bada37069b50295bd93d988667c3b85eada3', class: this.classCollection.join(), shadow: true }, this.closeButton && (h("mg-button", { key: 'a59d6610574b964be1e2ce34ccd8e31c1395b6ff', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: '5bcc9e4eb21396f4fc66a6f1e4d6c5cdf68ec1f4', icon: "cross" }))), h("div", { key: '57be2022f3b61220e1249faeaf2acee9960027fe', class: "mg-c-popover-content__title" }, h("slot", { key: 'c7870e86a9f105cf6b9d4520c77874bce9235d72', name: "title" })), h("slot", { key: '5af8462232625d9c7d694bab46351d5e646f62ca', name: "content" })), h("slot", { key: '599863410dd7d751e82c440cd6c4fb7f2c48d9f3', name: "arrow" })));
50
50
  }
51
51
  static get is() { return "mg-popover-content"; }
52
52
  static get encapsulation() { return "shadow"; }
@@ -242,7 +242,7 @@ export class MgPopover {
242
242
  * @returns HTML Element
243
243
  */
244
244
  render() {
245
- return (h(Host, { key: '7ea28f19a5a61f6191c2aece439e85da8f067270' }, h("slot", { key: 'aa6a627b90246ca327e2971329ab58b02eeb1d04' }), h("slot", { key: '1851353a6b4de659d6027a0bf3ba5f2120f7137d', name: "content" })));
245
+ return (h(Host, { key: '2c1506b8e2da100519aeeae75fc5c378a81c473c' }, h("slot", { key: 'f9aea885e8cbc168614c05761829f0a0740eba9e' }), h("slot", { key: 'fa6106a660a73b3761d4783f8d46d401c47b4eb6', name: "content" })));
246
246
  }
247
247
  static get is() { return "mg-popover"; }
248
248
  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: '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 {