@mgdis/mg-components 6.19.0 → 6.21.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 (164) hide show
  1. package/dist/cjs/{index-Bp6wZzau.js → index-C2viYwrR.js} +1757 -80
  2. package/dist/cjs/{index-TUElr4Wv.js → index-CCsGMNyq.js} +46 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/mg-action-more_37.cjs.entry.js +735 -337
  5. package/dist/cjs/mg-alert.cjs.entry.js +17 -9
  6. package/dist/cjs/mg-components.cjs.js +3 -3
  7. package/dist/cjs/mg-fieldset.cjs.entry.js +24 -7
  8. package/dist/cjs/mg-input-combobox.cjs.entry.js +63 -29
  9. package/dist/cjs/mg-input-file.cjs.entry.js +384 -0
  10. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +30 -18
  11. package/dist/cjs/{mg-input.conf-D7jmj_lh.js → mg-input.conf-BNpeATnq.js} +7 -0
  12. package/dist/cjs/mg-loader.cjs.entry.js +8 -6
  13. package/dist/cjs/mg-progress.cjs.entry.js +19 -9
  14. package/dist/collection/collection-manifest.json +3 -2
  15. package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
  16. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
  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-combobox/mg-input-combobox.js +15 -11
  19. package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +877 -0
  20. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  21. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
  22. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
  23. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +12 -12
  24. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
  26. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +72 -84
  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 +12 -3
  32. package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
  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 +1 -1
  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/collection/locales/en/messages.json +11 -0
  44. package/dist/collection/locales/fr/messages.json +11 -0
  45. package/dist/components/events.utils.js +1 -23
  46. package/dist/components/index.d.ts +2 -0
  47. package/dist/components/index.js +1 -1
  48. package/dist/components/index2.js +1 -408
  49. package/dist/components/index3.js +1 -476
  50. package/dist/components/mg-action-more.js +1 -254
  51. package/dist/components/mg-alert.js +1 -224
  52. package/dist/components/mg-badge.js +1 -6
  53. package/dist/components/mg-badge2.js +1 -113
  54. package/dist/components/mg-button.js +1 -6
  55. package/dist/components/mg-button2.js +1 -275
  56. package/dist/components/mg-card.js +1 -6
  57. package/dist/components/mg-card2.js +1 -92
  58. package/dist/components/mg-character-left.js +1 -6
  59. package/dist/components/mg-character-left2.js +1 -75
  60. package/dist/components/mg-details.js +1 -104
  61. package/dist/components/mg-divider.js +1 -6
  62. package/dist/components/mg-divider2.js +1 -49
  63. package/dist/components/mg-fieldset.js +1 -209
  64. package/dist/components/mg-form.js +1 -302
  65. package/dist/components/mg-icon.js +1 -6
  66. package/dist/components/mg-icon2.js +1 -188
  67. package/dist/components/mg-illustrated-message.js +1 -129
  68. package/dist/components/mg-input-checkbox-paginated.js +1 -6
  69. package/dist/components/mg-input-checkbox-paginated2.js +1 -135
  70. package/dist/components/mg-input-checkbox.js +1 -762
  71. package/dist/components/mg-input-combobox.js +1 -936
  72. package/dist/components/mg-input-date.js +1 -463
  73. package/dist/components/mg-input-file.d.ts +11 -0
  74. package/dist/components/mg-input-file.js +1 -0
  75. package/dist/components/mg-input-numeric.js +1 -592
  76. package/dist/components/mg-input-password.js +1 -360
  77. package/dist/components/mg-input-radio.js +1 -392
  78. package/dist/components/mg-input-rich-text-editor.js +1 -16797
  79. package/dist/components/mg-input-select.js +1 -6
  80. package/dist/components/mg-input-select2.js +1 -481
  81. package/dist/components/mg-input-text.js +1 -6
  82. package/dist/components/mg-input-text2.js +1 -514
  83. package/dist/components/mg-input-textarea.js +1 -412
  84. package/dist/components/mg-input-title.js +1 -6
  85. package/dist/components/mg-input-title2.js +1 -81
  86. package/dist/components/mg-input-toggle.js +1 -386
  87. package/dist/components/mg-input.conf.js +1 -0
  88. package/dist/components/mg-input.js +1 -6
  89. package/dist/components/mg-input2.js +1 -459
  90. package/dist/components/mg-item-more.js +1 -6
  91. package/dist/components/mg-item-more2.js +1 -505
  92. package/dist/components/mg-loader.js +1 -6
  93. package/dist/components/mg-loader2.js +1 -74
  94. package/dist/components/mg-menu-item.js +1 -6
  95. package/dist/components/mg-menu-item2.js +1 -485
  96. package/dist/components/mg-menu.js +1 -6
  97. package/dist/components/mg-message.js +1 -6
  98. package/dist/components/mg-message2.js +1 -146
  99. package/dist/components/mg-modal.js +1 -184
  100. package/dist/components/mg-pagination.js +1 -234
  101. package/dist/components/mg-panel.js +1 -350
  102. package/dist/components/mg-popover-content.js +1 -6
  103. package/dist/components/mg-popover-content2.js +1 -96
  104. package/dist/components/mg-popover.js +1 -6
  105. package/dist/components/mg-popover2.js +1 -312
  106. package/dist/components/mg-progress.js +1 -123
  107. package/dist/components/mg-skip-links.js +1 -78
  108. package/dist/components/mg-table.js +1 -319
  109. package/dist/components/mg-tabs.js +1 -6
  110. package/dist/components/mg-tabs2.js +1 -315
  111. package/dist/components/mg-tag.js +1 -133
  112. package/dist/components/mg-tooltip-content.js +1 -6
  113. package/dist/components/mg-tooltip-content2.js +1 -42
  114. package/dist/components/mg-tooltip.js +1 -6
  115. package/dist/components/mg-tooltip2.js +1 -421
  116. package/dist/components/popper.js +1 -1790
  117. package/dist/esm/{index-CNX6lq0x.js → index-D-uaxCxH.js} +46 -1
  118. package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1757 -80
  119. package/dist/esm/loader.js +3 -3
  120. package/dist/esm/mg-action-more_37.entry.js +735 -337
  121. package/dist/esm/mg-alert.entry.js +17 -9
  122. package/dist/esm/mg-components.js +4 -4
  123. package/dist/esm/mg-fieldset.entry.js +24 -7
  124. package/dist/esm/mg-input-combobox.entry.js +63 -29
  125. package/dist/esm/mg-input-file.entry.js +382 -0
  126. package/dist/esm/mg-input-rich-text-editor.entry.js +30 -18
  127. package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
  128. package/dist/esm/mg-loader.entry.js +8 -6
  129. package/dist/esm/mg-progress.entry.js +19 -9
  130. package/dist/mg-components/locales/en/messages.json +11 -0
  131. package/dist/mg-components/locales/fr/messages.json +11 -0
  132. package/dist/mg-components/mg-components.esm.js +1 -1
  133. package/dist/mg-components/{p-d5a276eb.entry.js → p-08fa327b.entry.js} +1 -1
  134. package/dist/mg-components/p-4175dcbe.entry.js +1 -0
  135. package/dist/mg-components/p-6b57f249.entry.js +1 -0
  136. package/dist/mg-components/p-6b655830.entry.js +1 -0
  137. package/dist/mg-components/p-988c282e.entry.js +1 -0
  138. package/dist/mg-components/p-C9rmNQIL.js +1 -0
  139. package/dist/mg-components/p-D-uaxCxH.js +1 -0
  140. package/dist/mg-components/p-DFwaH2hS.js +2 -0
  141. package/dist/mg-components/p-a79b1f19.entry.js +1 -0
  142. package/dist/mg-components/{p-916dfb6d.entry.js → p-c3d116b9.entry.js} +1 -1
  143. package/dist/mg-components/p-dd1934f4.entry.js +1 -0
  144. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
  145. package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
  146. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -4
  147. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +13 -16
  148. package/dist/types/components.d.ts +217 -18
  149. package/dist/types/stencil-public-runtime.d.ts +76 -12
  150. package/ide/intellij/web-types.json +373 -26
  151. package/ide/vscode/css-custom-data.json +12 -0
  152. package/ide/vscode/html-custom-data.json +341 -79
  153. package/package.json +22 -22
  154. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
  155. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js +0 -1
  156. package/dist/mg-components/p-016bd291.entry.js +0 -1
  157. package/dist/mg-components/p-186a6139.entry.js +0 -1
  158. package/dist/mg-components/p-66a1cb83.entry.js +0 -1
  159. package/dist/mg-components/p-6efd819f.entry.js +0 -1
  160. package/dist/mg-components/p-BluNKQ3L.js +0 -2
  161. package/dist/mg-components/p-CNX6lq0x.js +0 -1
  162. package/dist/mg-components/p-DDnrE1hD.js +0 -1
  163. package/dist/mg-components/p-d2c72f09.entry.js +0 -1
  164. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +0 -8
@@ -460,7 +460,7 @@ export class MgInputNumeric {
460
460
  * @returns HTML Element
461
461
  */
462
462
  render() {
463
- return (h("mg-input", { key: 'c47f7c310587fc3bb4e7d5ffd07854a2297958df', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly
463
+ return (h("mg-input", { key: 'b158c0ec7f43ee02bbdbb275c169876fcdff92ac', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly
464
464
  ? this.readonlyValue && this.renderReadonly()
465
465
  : [
466
466
  h("input", { key: "input", type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, autocomplete: "off", "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
@@ -248,7 +248,7 @@ export class MgInputPassword {
248
248
  * @returns HTML Element
249
249
  */
250
250
  render() {
251
- return (h("mg-input", { key: '845c075a44c50043776b7577642254d772629eef', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
251
+ return (h("mg-input", { key: '403d92641197b3ad397a0db527944dba4137f83a', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
252
252
  if (el !== null)
253
253
  this.input = el;
254
254
  } }), h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
@@ -284,7 +284,7 @@ export class MgInputRadio {
284
284
  * @returns HTML Element
285
285
  */
286
286
  render() {
287
- return (h("mg-input", { key: '9290ab8e5048dd6806985ab55d13bd8b0dd93bd1', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
287
+ return (h("mg-input", { key: '8d26edd50d44fbba4fee5fa6ef36aa3c455b1e5b', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
288
288
  if (el !== null)
289
289
  this.inputs[index] = el;
290
290
  } }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
@@ -166,10 +166,10 @@ export class MgInputRichTextEditor {
166
166
  (_a = this.editor) === null || _a === void 0 ? void 0 : _a.focus();
167
167
  }
168
168
  /**
169
- * Get editor content as HTML
169
+ * Get editor content in HTML format
170
170
  * @returns HTML content of the editor
171
171
  */
172
- getHTML() {
172
+ getEditorHTML() {
173
173
  return new Promise(resolve => {
174
174
  requestAnimationFrame(() => {
175
175
  resolve(this.editor.getSemanticHTML());
@@ -177,10 +177,10 @@ export class MgInputRichTextEditor {
177
177
  });
178
178
  }
179
179
  /**
180
- * Get editor content as plain text
180
+ * Get editor content in plain text format
181
181
  * @returns Plain text content of the editor
182
182
  */
183
- async getText() {
183
+ async getEditorText() {
184
184
  return new Promise(resolve => {
185
185
  requestAnimationFrame(() => {
186
186
  resolve(this.editor.getText());
@@ -317,7 +317,7 @@ export class MgInputRichTextEditor {
317
317
  * @returns HTML mg-input Element
318
318
  */
319
319
  render() {
320
- return (h("mg-input", { key: '5e807e1059704a6624a1fda63ab56a6f9a51230f', identifier: this.identifier, class: this.classCollection.join(), label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.hasDisplayedError ? this.errorMessage : undefined }, this.readonly ? (h("div", { class: "mg-c-input__readonly-value", innerHTML: this.value })) : (h("div", { ref: el => {
320
+ return (h("mg-input", { key: '26e4f26987e66541a6b21c7888ed7acd4e4ccad6', identifier: this.identifier, class: this.classCollection.join(), label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.hasDisplayedError ? this.errorMessage : undefined }, this.readonly ? (h("div", { class: "mg-c-input__readonly-value", innerHTML: this.value })) : (h("div", { ref: el => {
321
321
  this.wrapperElement = el;
322
322
  }, id: this.identifier, class: "mg-c-input__wrapper" }, h("div", null)))));
323
323
  }
@@ -325,12 +325,12 @@ export class MgInputRichTextEditor {
325
325
  static get encapsulation() { return "shadow"; }
326
326
  static get originalStyleUrls() {
327
327
  return {
328
- "$": ["./editor/editor.scss", "../../../../../node_modules/@mgdis/styles/dist/components/mg-input-rich-text-editor.css"]
328
+ "$": ["../../../../../node_modules/quill/dist/quill.snow.css", "../../../../../node_modules/@mgdis/styles/dist/components/mg-input-rich-text-editor.css"]
329
329
  };
330
330
  }
331
331
  static get styleUrls() {
332
332
  return {
333
- "$": ["editor/editor.css", "../../../../../node_modules/@mgdis/styles/dist/components/mg-input-rich-text-editor.css"]
333
+ "$": ["../../../../../node_modules/quill/dist/quill.snow.css", "../../../../../node_modules/@mgdis/styles/dist/components/mg-input-rich-text-editor.css"]
334
334
  };
335
335
  }
336
336
  static get properties() {
@@ -639,7 +639,7 @@ export class MgInputRichTextEditor {
639
639
  "mutable": false,
640
640
  "complexType": {
641
641
  "original": "EditorOptionsType['modules']",
642
- "resolved": "{ [x: string]: unknown; }",
642
+ "resolved": "string | unknown",
643
643
  "references": {
644
644
  "EditorOptionsType": {
645
645
  "location": "import",
@@ -755,7 +755,7 @@ export class MgInputRichTextEditor {
755
755
  "tags": []
756
756
  }
757
757
  },
758
- "getHTML": {
758
+ "getEditorHTML": {
759
759
  "complexType": {
760
760
  "signature": "() => Promise<string>",
761
761
  "parameters": [],
@@ -768,14 +768,14 @@ export class MgInputRichTextEditor {
768
768
  "return": "Promise<string>"
769
769
  },
770
770
  "docs": {
771
- "text": "Get editor content as HTML",
771
+ "text": "Get editor content in HTML format",
772
772
  "tags": [{
773
773
  "name": "returns",
774
774
  "text": "HTML content of the editor"
775
775
  }]
776
776
  }
777
777
  },
778
- "getText": {
778
+ "getEditorText": {
779
779
  "complexType": {
780
780
  "signature": "() => Promise<string>",
781
781
  "parameters": [],
@@ -788,7 +788,7 @@ export class MgInputRichTextEditor {
788
788
  "return": "Promise<string>"
789
789
  },
790
790
  "docs": {
791
- "text": "Get editor content as plain text",
791
+ "text": "Get editor content in plain text format",
792
792
  "tags": [{
793
793
  "name": "returns",
794
794
  "text": "Plain text content of the editor"
@@ -372,7 +372,7 @@ export class MgInputSelect {
372
372
  */
373
373
  render() {
374
374
  const readonlyValue = this.getReadonlyValue();
375
- return (h("mg-input", { key: '928c7d4ebccfe38ae86630d2cb8c06f07ca09a8a', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
375
+ return (h("mg-input", { key: 'e7857da9c724cb582217b944cb723308d7efedbe', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
376
376
  if (el !== null)
377
377
  this.input = el;
378
378
  } }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
@@ -375,7 +375,7 @@ export class MgInputText {
375
375
  * @returns HTML Element
376
376
  */
377
377
  render() {
378
- return (h("mg-input", { key: 'b6360c95530daf744ae5c3eb5cc41d6c81c3e35c', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
378
+ return (h("mg-input", { key: 'cefd22e81ad535ff0ffd99d274c5eb616110ddd6', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
379
379
  ? this.value && this.renderReadonly()
380
380
  : [
381
381
  h("div", { key: "input", class: "mg-c-input__input-group-container", style: {
@@ -549,7 +549,7 @@ export class MgInputText {
549
549
  "mutable": false,
550
550
  "complexType": {
551
551
  "original": "IconType",
552
- "resolved": "\"filter\" | \"link\" | \"picture\" | \"table\" | \"circle\" | \"download\" | \"key\" | \"list\" | \"copy\" | \"history\" | \"location\" | \"loader\" | \"address-card\" | \"address-card-outline\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"arrows-up-down\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building\" | \"building-outline\" | \"calculator\" | \"calculator-outline\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-exclamation\" | \"comment-exclamation-outline\" | \"comment-outline\" | \"comment-question\" | \"comment-question-outline\" | \"comment-sms\" | \"comment-sms-outline\" | \"conversation\" | \"conversation-outline\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-outline\" | \"eye-slash\" | \"eye-slash-outline\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-cog-outline\" | \"file-download\" | \"file-download-outline\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-upload-outline\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-checked\" | \"floppy-disk-checked-outline\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folder-star-outline\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-euro\" | \"hand-euro-outline\" | \"hand-up\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"laptop\" | \"layers\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-open\" | \"mail-open-outline\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-outline\" | \"paper-plane-slash\" | \"paper-plane-slash-outline\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"plus-circle-outline\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sidebar-arrow-left\" | \"sidebar-arrow-right\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"tag\" | \"tag-outline\" | \"tags\" | \"tags-outline\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"universal-access-outline\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-group-outline\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"",
552
+ "resolved": "\"address-card\" | \"address-card-outline\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"arrows-up-down\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building\" | \"building-outline\" | \"calculator\" | \"calculator-outline\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-exclamation\" | \"comment-exclamation-outline\" | \"comment-outline\" | \"comment-question\" | \"comment-question-outline\" | \"comment-sms\" | \"comment-sms-outline\" | \"conversation\" | \"conversation-outline\" | \"copy\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"download\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-outline\" | \"eye-slash\" | \"eye-slash-outline\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-cog-outline\" | \"file-download\" | \"file-download-outline\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-upload-outline\" | \"file-word\" | \"file-word-outline\" | \"filter\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-checked\" | \"floppy-disk-checked-outline\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folder-star-outline\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-euro\" | \"hand-euro-outline\" | \"hand-up\" | \"history\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"key\" | \"laptop\" | \"layers\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"link\" | \"list\" | \"loader\" | \"location\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-open\" | \"mail-open-outline\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-outline\" | \"paper-plane-slash\" | \"paper-plane-slash-outline\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"plus-circle-outline\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sidebar-arrow-left\" | \"sidebar-arrow-right\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"table\" | \"tag\" | \"tag-outline\" | \"tags\" | \"tags-outline\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"universal-access-outline\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-group-outline\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"",
553
553
  "references": {
554
554
  "IconType": {
555
555
  "location": "import",
@@ -284,7 +284,7 @@ export class MgInputTextarea {
284
284
  * @returns HTML Element
285
285
  */
286
286
  render() {
287
- return (h("mg-input", { key: 'a43b8b1572249e31fb6ea5bd9244639698629218', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__input-group-container" }, h("textarea", { class: {
287
+ return (h("mg-input", { key: 'dc646a42eee0c10394666218521ebfc1ab79a789', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__input-group-container" }, h("textarea", { class: {
288
288
  'mg-c-input__box': true,
289
289
  'mg-c-input__box--width': true,
290
290
  'mg-c-input__box--resizable': this.resizable === 'both',
@@ -6,7 +6,7 @@ import { classDisabled, classReadonly } from "../mg-input/mg-input.conf";
6
6
  * @param option - radio option
7
7
  * @returns toggle option type is valid
8
8
  */
9
- const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
9
+ const isOption = (option) => typeof option === 'object' && typeof option.title === 'string';
10
10
  /**
11
11
  * @slot item-1 - Left option toggle content
12
12
  * @slot item-2 - Right option toggle content
@@ -56,10 +56,6 @@ export class MgInputToggle {
56
56
  * Component classes
57
57
  */
58
58
  this.classCollection = new ClassList(['mg-c-input--toggle']);
59
- /**
60
- * Checked internal value
61
- */
62
- this.checked = false;
63
59
  /**
64
60
  * Set input error message
65
61
  * @param errorMessage - errorMessage override
@@ -73,10 +69,11 @@ export class MgInputToggle {
73
69
  }
74
70
  };
75
71
  /**
76
- * Change checked value
72
+ * Handle switch button to update value
77
73
  */
78
- this.toggleChecked = () => {
79
- this.checked = !this.checked;
74
+ this.handleSwitchButton = () => {
75
+ const currentOptionIndex = this.getCurrentOptionIndex(this.value);
76
+ this.value = this.options[currentOptionIndex === 0 ? 1 : 0].value;
80
77
  };
81
78
  /**
82
79
  * Slots validation
@@ -114,24 +111,51 @@ export class MgInputToggle {
114
111
  * @param checked - checked item
115
112
  * @returns toggle value
116
113
  */
117
- this.getCheckedItem = (checked) => {
118
- var _a;
119
- if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) === 2) {
120
- return this.options[checked ? 1 : 0];
121
- }
122
- else {
123
- return null;
124
- }
114
+ this.getCurrentOptionIndex = (value) => {
115
+ return this.options.findIndex(option => toString(option.value) === toString(value)) === 1 ? 1 : 0;
116
+ };
117
+ /**
118
+ * Check if value is checked
119
+ * @param value - toggle value
120
+ * @returns truthy if value is checked
121
+ */
122
+ this.isChecked = (value) => {
123
+ return this.getCurrentOptionIndex(value) === 1;
125
124
  };
126
125
  }
127
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
- handleValue(newValue) {
129
- // Swich to the right option
130
- this.setChecked();
131
- // Emit value-change event
132
- this.valueChange.emit(newValue);
126
+ watchValue(newValue, oldValue) {
127
+ // A "true" attribute can be represented by an empty string
128
+ // We need to convert it to a boolean true value
129
+ if (newValue === '') {
130
+ this.value = true;
131
+ // Return early to prevent infinite loop
132
+ return;
133
+ }
134
+ // https://stenciljs.com/docs/properties
135
+ // According to the Stencil documentation, when a prop is declared as `any`, boolean values can be bound as boolean attributes.
136
+ // However, depending on the integration context (e.g., Vue.js), they may also be interpreted as string attributes.
137
+ // To avoid incorrect type interpretation when a boolean is received as a string,
138
+ // we normalize the value and convert it to a proper boolean before internal use.
139
+ else if (['true', 'false'].includes(newValue) && this.options.every(option => typeof option.value === 'boolean')) {
140
+ this.value = newValue === 'true';
141
+ // Return early to prevent infinite loop
142
+ return;
143
+ }
144
+ if (this.isChecked(newValue)) {
145
+ this.classCollection.add(this.classIsActive);
146
+ }
147
+ else {
148
+ this.classCollection.delete(this.classIsActive);
149
+ }
150
+ // when value is reassigned programmatically from previous `watchValue` call
151
+ // `oldValue` can be a string while `newValue` is boolean or vice versa
152
+ // so we need to compare them as strings to prevent infinite loop and unnecessary event emission
153
+ if (toString(newValue) !== toString(oldValue)) {
154
+ // Emit value-change event
155
+ this.valueChange.emit(newValue);
156
+ }
133
157
  }
134
- validateItems(newValue) {
158
+ watchItems(newValue) {
135
159
  if (typeof newValue === 'object' && this.items.length !== 2) {
136
160
  throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${toString(newValue)}.`);
137
161
  }
@@ -144,7 +168,7 @@ export class MgInputToggle {
144
168
  this.options = newValue;
145
169
  }
146
170
  else {
147
- throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${toString(newValue)}.`);
171
+ throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleOption. Passed value: ${toString(newValue)}.`);
148
172
  }
149
173
  }
150
174
  watchIsOnOff(newValue) {
@@ -177,15 +201,6 @@ export class MgInputToggle {
177
201
  else
178
202
  this.classCollection.delete(classDisabled);
179
203
  }
180
- handleChecked(newValue) {
181
- // style
182
- if (newValue)
183
- this.classCollection.add(this.classIsActive);
184
- else
185
- this.classCollection.delete(this.classIsActive);
186
- // update value
187
- this.value = this.getCheckedItem(newValue).value;
188
- }
189
204
  /**
190
205
  * Set focus on input.
191
206
  */
@@ -220,7 +235,6 @@ export class MgInputToggle {
220
235
  async reset() {
221
236
  if (!this.readonly) {
222
237
  this.value = this.options[0].value;
223
- this.setChecked();
224
238
  // Use `Promise` as requested for stencil method
225
239
  // Use `requestAnimationFrame` to ensure:
226
240
  // - DOM is fully updated before validation
@@ -235,28 +249,6 @@ export class MgInputToggle {
235
249
  });
236
250
  }
237
251
  }
238
- /**
239
- * set checked state
240
- */
241
- setChecked() {
242
- const optionTrueValueIndex = this.options.map(option => option.value).findIndex(value => value === true);
243
- if ([0, 1].includes(optionTrueValueIndex)) {
244
- // has "value" props type is not a boolean, it is bind/render as an attributes/props
245
- // true props will be represent by "true" string so we convert it has boolean
246
- // true attribute will be represent by "" string so we convert it has boolean
247
- // https://stenciljs.com/docs/properties
248
- if (['', 'true'].includes(this.value) && this.options.find(option => option.value) !== undefined) {
249
- this.value = true;
250
- }
251
- // when options are boolean values and ordered as [true,false] instead [false,true]
252
- // we need to reversed the checked value logic
253
- const selectedValue = this.value === this.options[optionTrueValueIndex].value;
254
- this.checked = optionTrueValueIndex === 0 ? !selectedValue : selectedValue;
255
- }
256
- else {
257
- this.checked = this.value === this.options[1].value;
258
- }
259
- }
260
252
  /*************
261
253
  * Lifecycle *
262
254
  *************/
@@ -264,13 +256,9 @@ export class MgInputToggle {
264
256
  * Check if component props are well configured on init
265
257
  */
266
258
  componentWillLoad() {
267
- // Check items format
268
- this.validateItems(this.items);
269
- // Check slots
259
+ this.watchItems(this.items);
270
260
  this.validateSlots();
271
- // init checked value
272
- this.setChecked();
273
- // apply handler
261
+ this.watchValue(this.value);
274
262
  this.watchIsIcon(this.isIcon);
275
263
  this.watchIsOnOff(this.isOnOff);
276
264
  this.watchReadonly(this.readonly);
@@ -281,8 +269,8 @@ export class MgInputToggle {
281
269
  * @returns HTML Element
282
270
  */
283
271
  render() {
284
- const checkedItem = this.getCheckedItem(this.checked);
285
- return (h("mg-input", { key: '4d87ed13bbd3d3a54303c21001247e1251417326', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked, ref: el => {
272
+ const currentOption = this.options[this.getCurrentOptionIndex(this.value)];
273
+ return (h("mg-input", { key: '75a58e79ddd78a6a5656b6a3ef497087fbbb0638', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (currentOption && h("b", { class: "mg-c-input__readonly-value" }, currentOption.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.isChecked(this.value).toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.handleSwitchButton, ref: el => {
286
274
  if (el !== null)
287
275
  this.button = el;
288
276
  } }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
@@ -302,12 +290,18 @@ export class MgInputToggle {
302
290
  static get properties() {
303
291
  return {
304
292
  "value": {
305
- "type": "any",
293
+ "type": "unknown",
306
294
  "mutable": true,
307
295
  "complexType": {
308
- "original": "any",
309
- "resolved": "any",
310
- "references": {}
296
+ "original": "ToggleOption['value']",
297
+ "resolved": "unknown",
298
+ "references": {
299
+ "ToggleOption": {
300
+ "location": "import",
301
+ "path": "../../../../types",
302
+ "id": "src/types/index.ts::Option"
303
+ }
304
+ }
311
305
  },
312
306
  "required": false,
313
307
  "optional": false,
@@ -316,21 +310,19 @@ export class MgInputToggle {
316
310
  "text": "Component value"
317
311
  },
318
312
  "getter": false,
319
- "setter": false,
320
- "reflect": false,
321
- "attribute": "value"
313
+ "setter": false
322
314
  },
323
315
  "items": {
324
316
  "type": "unknown",
325
317
  "mutable": false,
326
318
  "complexType": {
327
- "original": "string[] | ToggleValue[]",
328
- "resolved": "ToggleValue[] | string[]",
319
+ "original": "string[] | ToggleOption[]",
320
+ "resolved": "Option[] | string[]",
329
321
  "references": {
330
- "ToggleValue": {
322
+ "ToggleOption": {
331
323
  "location": "import",
332
- "path": "./mg-input-toggle.conf",
333
- "id": "src/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.ts::ToggleValue"
324
+ "path": "../../../../types",
325
+ "id": "src/types/index.ts::Option"
334
326
  }
335
327
  }
336
328
  },
@@ -592,8 +584,7 @@ export class MgInputToggle {
592
584
  "classCollection": {},
593
585
  "options": {},
594
586
  "errorMessage": {},
595
- "valid": {},
596
- "checked": {}
587
+ "valid": {}
597
588
  };
598
589
  }
599
590
  static get events() {
@@ -609,7 +600,7 @@ export class MgInputToggle {
609
600
  },
610
601
  "complexType": {
611
602
  "original": "HTMLMgInputToggleElement['value']",
612
- "resolved": "any",
603
+ "resolved": "unknown",
613
604
  "references": {
614
605
  "HTMLMgInputToggleElement": {
615
606
  "location": "global",
@@ -707,10 +698,10 @@ export class MgInputToggle {
707
698
  static get watchers() {
708
699
  return [{
709
700
  "propName": "value",
710
- "methodName": "handleValue"
701
+ "methodName": "watchValue"
711
702
  }, {
712
703
  "propName": "items",
713
- "methodName": "validateItems"
704
+ "methodName": "watchItems"
714
705
  }, {
715
706
  "propName": "isOnOff",
716
707
  "methodName": "watchIsOnOff"
@@ -723,9 +714,6 @@ export class MgInputToggle {
723
714
  }, {
724
715
  "propName": "disabled",
725
716
  "methodName": "watchDisabled"
726
- }, {
727
- "propName": "checked",
728
- "methodName": "handleChecked"
729
717
  }];
730
718
  }
731
719
  }
@@ -141,7 +141,7 @@ export class MgActionMore {
141
141
  [`${this.classBase}__chevron--rotate`]: this.expanded === true,
142
142
  } }, h("mg-icon", { icon: "chevron-down" })));
143
143
  }
144
- 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 => {
144
+ return (h(Host, { key: 'bef7d0e0c5a991f321ca930d65fa458873fc7564', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: '4e47d1513749cc1ac15ef8febd2fb914e362bbee', class: this.classBase }, h("mg-popover", { key: 'ab6dfc93422f03b49a78d2896196aa6901841aef', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, h("mg-button", { key: '921f17c4ede5f1783dc336429539b0b082902fdd', 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: '19bf9e015cbd82d8dffc62269de735607ab4f2bb' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: '56a43a5adebd31264742c0ef8905ccb0bd8fb581', slot: "content" }, h("mg-menu", { key: '70520957ac07a3190ef753ee435996af96dbc5b5', direction: directions.VERTICAL, label: this.messages.label }, this.items.map(item => {
145
145
  var _a, _b;
146
146
  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,
147
147
  // eslint-disable-next-line react/jsx-no-bind
@@ -142,7 +142,7 @@ export class MgAlert {
142
142
  * @returns HTML Element
143
143
  */
144
144
  render() {
145
- 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" }))))));
145
+ return (h("mg-message", { key: '6085a45d00c4762bae88d98e89f44c20d5f9b6c4', class: this.classCollection.join(), role: ['info', 'success'].includes(this.variant) ? 'status' : 'alert', variant: this.variant, variantStyle: this.variantStyle }, h("slot", { key: '55491d1b41609883958680c14a2ddb8dd84a3bd4' }), 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" }))))));
146
146
  }
147
147
  static get is() { return "mg-alert"; }
148
148
  static get encapsulation() { return "shadow"; }
@@ -53,7 +53,7 @@ export class MgDetails {
53
53
  * @returns HTML Element
54
54
  */
55
55
  render() {
56
- 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" }))));
56
+ return (h("details", { key: '17840b16bee77489062320bd7a679d6e4765a6f6', 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: 'be713c922be8c97cdfb803cd1a59a34de708fe5e' }, h("slot", { key: 'cebdbaee05189542496143208945ab1f685702ef', name: "summary" }), h("span", { key: '7a2ad4790c1a1b905e5fc65fc518c133139c0889', class: "mg-c-details__toggle" }, h("mg-icon", { key: '628862cb0c1768c44c07033f2148ed7979bdad2b', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: 'b2bb91aa70f91ea654d944d7f00c21d6ab0e3ebf', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: '9432a42632e4c002d717a2851e372d6b40296c6f', class: "mg-c-details__details" }, h("slot", { key: '008041bac5a1c3bf5eb7a172537750e6fa38aabc', name: "details" }))));
57
57
  }
58
58
  static get is() { return "mg-details"; }
59
59
  static get encapsulation() { return "shadow"; }
@@ -1,6 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { ClassList, isValidString } from "@mgdis/core-ui-helpers/dist/utils";
3
- import { classReadonly } from "../inputs/mg-input/mg-input.conf";
3
+ import { classReadonly, isMgInputFile } from "../inputs/mg-input/mg-input.conf";
4
4
  export class MgFieldset {
5
5
  constructor() {
6
6
  /**
@@ -44,7 +44,16 @@ export class MgFieldset {
44
44
  // Set inputs readonly or disabled based on form configuration
45
45
  // Othewise listen to events
46
46
  this.mgInputs.forEach(input => {
47
- if (this.readonly) {
47
+ // manage special display case for mg-input-file
48
+ if (input.nodeName === 'MG-INPUT-FILE') {
49
+ if (this.readonly) {
50
+ input.setAttribute('hidden', '');
51
+ }
52
+ else {
53
+ input.removeAttribute('hidden');
54
+ }
55
+ }
56
+ if (this.readonly && !isMgInputFile(input)) {
48
57
  input.readonly = true;
49
58
  }
50
59
  else if (this.disabled) {
@@ -124,7 +133,7 @@ export class MgFieldset {
124
133
  * @returns HTML Element
125
134
  */
126
135
  render() {
127
- 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' }))));
136
+ return (h("mg-input", { key: '31ccb9f783687845080fc7f184cc54b7343fab65', 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: 'eedf1c66eaf88bee037c11b812844bb5a92175c1', class: "mg-c-input__input-group" }, h("slot", { key: 'a28f6759a63873ef4a228820b4310b42fcf1d3c7' }))));
128
137
  }
129
138
  static get is() { return "mg-fieldset"; }
130
139
  static get encapsulation() { return "shadow"; }
@@ -1,6 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { createID, ClassList, toString, isValideID } from "@mgdis/core-ui-helpers/dist/utils";
3
3
  import { initLocales } from "../../../locales";
4
+ import { isMgInputFile } from "../inputs/mg-input/mg-input.conf";
4
5
  import { requiredMessageStatus, roles } from "./mg-form.conf";
5
6
  /**
6
7
  * @slot - Form content
@@ -111,7 +112,16 @@ export class MgForm {
111
112
  if (this.labelOnTop) {
112
113
  input.labelOnTop = true;
113
114
  }
114
- if (this.readonly) {
115
+ // manage special display case for mg-input-file
116
+ if (input.nodeName === 'MG-INPUT-FILE') {
117
+ if (this.readonly) {
118
+ input.setAttribute('hidden', '');
119
+ }
120
+ else {
121
+ input.removeAttribute('hidden');
122
+ }
123
+ }
124
+ if (this.readonly && !isMgInputFile(input)) {
115
125
  input.readonly = true;
116
126
  }
117
127
  else if (this.disabled) {
@@ -232,7 +242,7 @@ export class MgForm {
232
242
  * @returns HTML Element
233
243
  */
234
244
  render() {
235
- 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" })));
245
+ return (h("form", { key: 'b2e3d218d978f1194b2c461ab75cae7d491bc2c3', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: 'dd6db1a740f5fe525c3b652c2128aba6185970b8', innerHTML: this.requiredMessageText }), h("slot", { key: '5221d0c8fa5e30749c82d01490b402d9e46a63cd' }), !this.readonly && !this.disabled && h("slot", { key: 'fb2595b8c5df85b9cefac0f43e54e463d529fff4', name: "actions" })));
236
246
  }
237
247
  static get is() { return "mg-form"; }
238
248
  static get encapsulation() { return "shadow"; }
@@ -81,7 +81,7 @@ export class MgIllustratedMessage {
81
81
  * @returns HTML Element
82
82
  */
83
83
  render() {
84
- 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" }))));
84
+ return (h("div", { key: 'f2bcf91e8d639736514a55a73d0182339eda1455', class: this.classCollection.join() }, h("div", { key: '46f862fc2a3daf2f217c55feebd41abb76252de2', class: "mg-c-illustrated-message__illustration" }, h("slot", { key: 'e2a0e9752a6739a684fd2668a8e8f0f792a0c38b', name: "illustration" })), h("div", { key: 'b037dd43ae59c07ca122b68b56dc3230a7aa94f2', class: "mg-c-illustrated-message__slots" }, h("slot", { key: '3a99f08cfb68bd51fbd015d213bb462acbfdda1a', name: "title" }), h("slot", { key: '14490ee1e7f9470f433c6249d502bd0a4dd77ca3', name: "details" }))));
85
85
  }
86
86
  static get is() { return "mg-illustrated-message"; }
87
87
  static get encapsulation() { return "shadow"; }