@mgdis/mg-components 6.20.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 (159) 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 +684 -273
  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 +48 -18
  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-file/mg-input-file.js +877 -0
  19. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  20. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
  21. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
  22. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +12 -12
  23. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  24. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
  25. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  26. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
  27. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
  28. package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
  29. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  30. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +12 -3
  31. package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
  32. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  33. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  34. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  35. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  36. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
  37. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  38. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  39. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  40. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  41. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  42. package/dist/collection/locales/en/messages.json +11 -0
  43. package/dist/collection/locales/fr/messages.json +11 -0
  44. package/dist/components/events.utils.js +1 -23
  45. package/dist/components/index.d.ts +2 -0
  46. package/dist/components/index.js +1 -1
  47. package/dist/components/index2.js +1 -408
  48. package/dist/components/index3.js +1 -476
  49. package/dist/components/mg-action-more.js +1 -254
  50. package/dist/components/mg-alert.js +1 -224
  51. package/dist/components/mg-badge.js +1 -6
  52. package/dist/components/mg-badge2.js +1 -113
  53. package/dist/components/mg-button.js +1 -6
  54. package/dist/components/mg-button2.js +1 -275
  55. package/dist/components/mg-card.js +1 -6
  56. package/dist/components/mg-card2.js +1 -92
  57. package/dist/components/mg-character-left.js +1 -6
  58. package/dist/components/mg-character-left2.js +1 -75
  59. package/dist/components/mg-details.js +1 -104
  60. package/dist/components/mg-divider.js +1 -6
  61. package/dist/components/mg-divider2.js +1 -49
  62. package/dist/components/mg-fieldset.js +1 -209
  63. package/dist/components/mg-form.js +1 -302
  64. package/dist/components/mg-icon.js +1 -6
  65. package/dist/components/mg-icon2.js +1 -188
  66. package/dist/components/mg-illustrated-message.js +1 -129
  67. package/dist/components/mg-input-checkbox-paginated.js +1 -6
  68. package/dist/components/mg-input-checkbox-paginated2.js +1 -135
  69. package/dist/components/mg-input-checkbox.js +1 -762
  70. package/dist/components/mg-input-combobox.js +1 -940
  71. package/dist/components/mg-input-date.js +1 -463
  72. package/dist/components/mg-input-file.d.ts +11 -0
  73. package/dist/components/mg-input-file.js +1 -0
  74. package/dist/components/mg-input-numeric.js +1 -592
  75. package/dist/components/mg-input-password.js +1 -360
  76. package/dist/components/mg-input-radio.js +1 -392
  77. package/dist/components/mg-input-rich-text-editor.js +1 -16797
  78. package/dist/components/mg-input-select.js +1 -6
  79. package/dist/components/mg-input-select2.js +1 -481
  80. package/dist/components/mg-input-text.js +1 -6
  81. package/dist/components/mg-input-text2.js +1 -514
  82. package/dist/components/mg-input-textarea.js +1 -412
  83. package/dist/components/mg-input-title.js +1 -6
  84. package/dist/components/mg-input-title2.js +1 -81
  85. package/dist/components/mg-input-toggle.js +1 -371
  86. package/dist/components/mg-input.conf.js +1 -0
  87. package/dist/components/mg-input.js +1 -6
  88. package/dist/components/mg-input2.js +1 -459
  89. package/dist/components/mg-item-more.js +1 -6
  90. package/dist/components/mg-item-more2.js +1 -505
  91. package/dist/components/mg-loader.js +1 -6
  92. package/dist/components/mg-loader2.js +1 -74
  93. package/dist/components/mg-menu-item.js +1 -6
  94. package/dist/components/mg-menu-item2.js +1 -485
  95. package/dist/components/mg-menu.js +1 -6
  96. package/dist/components/mg-message.js +1 -6
  97. package/dist/components/mg-message2.js +1 -146
  98. package/dist/components/mg-modal.js +1 -184
  99. package/dist/components/mg-pagination.js +1 -234
  100. package/dist/components/mg-panel.js +1 -350
  101. package/dist/components/mg-popover-content.js +1 -6
  102. package/dist/components/mg-popover-content2.js +1 -96
  103. package/dist/components/mg-popover.js +1 -6
  104. package/dist/components/mg-popover2.js +1 -312
  105. package/dist/components/mg-progress.js +1 -123
  106. package/dist/components/mg-skip-links.js +1 -78
  107. package/dist/components/mg-table.js +1 -319
  108. package/dist/components/mg-tabs.js +1 -6
  109. package/dist/components/mg-tabs2.js +1 -315
  110. package/dist/components/mg-tag.js +1 -133
  111. package/dist/components/mg-tooltip-content.js +1 -6
  112. package/dist/components/mg-tooltip-content2.js +1 -42
  113. package/dist/components/mg-tooltip.js +1 -6
  114. package/dist/components/mg-tooltip2.js +1 -421
  115. package/dist/components/popper.js +1 -1790
  116. package/dist/esm/{index-CNX6lq0x.js → index-D-uaxCxH.js} +46 -1
  117. package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1757 -80
  118. package/dist/esm/loader.js +3 -3
  119. package/dist/esm/mg-action-more_37.entry.js +684 -273
  120. package/dist/esm/mg-alert.entry.js +17 -9
  121. package/dist/esm/mg-components.js +4 -4
  122. package/dist/esm/mg-fieldset.entry.js +24 -7
  123. package/dist/esm/mg-input-combobox.entry.js +48 -18
  124. package/dist/esm/mg-input-file.entry.js +382 -0
  125. package/dist/esm/mg-input-rich-text-editor.entry.js +30 -18
  126. package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
  127. package/dist/esm/mg-loader.entry.js +8 -6
  128. package/dist/esm/mg-progress.entry.js +19 -9
  129. package/dist/mg-components/locales/en/messages.json +11 -0
  130. package/dist/mg-components/locales/fr/messages.json +11 -0
  131. package/dist/mg-components/mg-components.esm.js +1 -1
  132. package/dist/mg-components/{p-d5a276eb.entry.js → p-08fa327b.entry.js} +1 -1
  133. package/dist/mg-components/p-4175dcbe.entry.js +1 -0
  134. package/dist/mg-components/{p-7132bca1.entry.js → p-6b57f249.entry.js} +1 -1
  135. package/dist/mg-components/p-6b655830.entry.js +1 -0
  136. package/dist/mg-components/p-988c282e.entry.js +1 -0
  137. package/dist/mg-components/p-C9rmNQIL.js +1 -0
  138. package/dist/mg-components/p-D-uaxCxH.js +1 -0
  139. package/dist/mg-components/p-DFwaH2hS.js +2 -0
  140. package/dist/mg-components/p-a79b1f19.entry.js +1 -0
  141. package/dist/mg-components/{p-916dfb6d.entry.js → p-c3d116b9.entry.js} +1 -1
  142. package/dist/mg-components/p-dd1934f4.entry.js +1 -0
  143. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
  144. package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
  145. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -4
  146. package/dist/types/components.d.ts +211 -10
  147. package/dist/types/stencil-public-runtime.d.ts +76 -12
  148. package/ide/intellij/web-types.json +356 -12
  149. package/ide/vscode/html-custom-data.json +338 -76
  150. package/package.json +19 -19
  151. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
  152. package/dist/mg-components/p-016bd291.entry.js +0 -1
  153. package/dist/mg-components/p-186a6139.entry.js +0 -1
  154. package/dist/mg-components/p-BluNKQ3L.js +0 -2
  155. package/dist/mg-components/p-CNX6lq0x.js +0 -1
  156. package/dist/mg-components/p-DDnrE1hD.js +0 -1
  157. package/dist/mg-components/p-cd061b38.entry.js +0 -1
  158. package/dist/mg-components/p-d2c72f09.entry.js +0 -1
  159. package/ide/vscode/custom.css-data.json +0 -425
@@ -1 +1 @@
1
- import{r as t,c as s,f as i,h as e,a}from"./p-BluNKQ3L.js";import{C as h,t as o}from"./p-C7xjtdiw.js";import{i as r}from"./p-CNX6lq0x.js";const n=["info","warning","success","danger"],c=["bar-left","background"],l=class{constructor(i){t(this,i),this.componentShow=s(this,"component-show",3),this.componentHide=s(this,"component-hide",3),this.componentClose=s(this,"component-close",3),this.classCloseButton="mg-c-alert--close-button",this.storedTimer=null,this.isFocused=!1,this.isHovered=!1,this.variant="info",this.variantStyle="bar-left",this.classCollection=new h(["mg-c-alert"]),this.hasActions=!1,this.setTimer=()=>{this.storedTimer=setTimeout((()=>this.element.hidden=!0),1e3*this.delay)},this.clearTimer=()=>{clearTimeout(this.storedTimer)},this.timerEvents=t=>{this.clearTimer();const s="mouseenter"===t.type;this[s?"isHovered":"isFocused"]=!0,this.element.addEventListener(s?"mouseleave":"focusout",(t=>{this["mouseleave"===t.type?"isHovered":"isFocused"]=!1,this.isFocused||this.isHovered||this.setTimer()}),{once:!0})},this.handleClose=()=>{this.element.hidden=!0,this.componentClose.emit()}}watchDelay(t){if(void 0!==t&&t<2)throw new Error(`<mg-alert> prop "delay" must be greater than 2 seconds. Passed value: ${o(t)}.`)}watchVariant(t){if(t&&!n.includes(t))throw new Error(`<mg-alert> prop "variant" must be one of: ${n.join(", ")}. Passed value: ${o(t)}.`)}watchVariantStyle(t){if(t&&!c.includes(t))throw new Error(`<mg-alert> prop "variantStyle" must be one of: ${c.join(", ")}. Passed value: ${o(t)}.`)}watchHidden(t){"string"==typeof t&&""===t&&(t=!0),t?(this.componentHide.emit(),["focusin","mouseenter"].forEach((t=>{this.element.removeEventListener(t,this.timerEvents)})),this.clearTimer()):(this.componentShow.emit(),this.delay>1&&(this.setTimer(),["focusin","mouseenter"].forEach((t=>{this.element.addEventListener(t,this.timerEvents)})))),i(this)}componentWillLoad(){this.messages=r(this.element).messages,this.watchVariant(this.variant),this.watchVariantStyle(this.variantStyle),this.watchDelay(this.delay),this.watchHidden(this.element.hidden),this.hasActions=null!==this.element.querySelector('[slot="actions"]'),this.hasActions||this.classCollection.add(this.classCloseButton)}render(){return e("mg-message",{key:"4b974a10812e527a2c481ec00f22324ab490a135",class:this.classCollection.join(),role:["info","success"].includes(this.variant)?"status":"alert",variant:this.variant,variantStyle:this.variantStyle},e("slot",{key:"9133a3cca56d67e75e8c3f018c52838c31e908f2"}),this.hasActions?e("span",{slot:"actions"},e("slot",{name:"actions"})):e("span",{class:"mg-c-alert__close-button"},e("mg-button",{"is-icon":!0,variant:"flat",label:this.messages.alert.closeButton,onClick:this.handleClose},e("mg-icon",{icon:"cross"}))))}get element(){return a(this)}static get watchers(){return{delay:["watchDelay"],variant:["watchVariant"],variantStyle:["watchVariantStyle"],hidden:["watchHidden"]}}};l.style=".mg-c-alert__close-button{position:absolute;top:0;right:0}.mg-c-alert.mg-c-alert--close-button{--mg-c-card-spacing:0 var(--mg-b-size-min-height) 0 0}";export{l as mg_alert}
1
+ import{r as t,c as s,f as i,h as e,a}from"./p-DFwaH2hS.js";import{C as h,t as o}from"./p-C7xjtdiw.js";import{i as r}from"./p-D-uaxCxH.js";const n=["info","warning","success","danger"],c=["bar-left","background"],l=class{constructor(i){t(this,i),this.componentShow=s(this,"component-show",3),this.componentHide=s(this,"component-hide",3),this.componentClose=s(this,"component-close",3),this.classCloseButton="mg-c-alert--close-button",this.storedTimer=null,this.isFocused=!1,this.isHovered=!1,this.variant="info",this.variantStyle="bar-left",this.classCollection=new h(["mg-c-alert"]),this.hasActions=!1,this.setTimer=()=>{this.storedTimer=setTimeout((()=>this.element.hidden=!0),1e3*this.delay)},this.clearTimer=()=>{clearTimeout(this.storedTimer)},this.timerEvents=t=>{this.clearTimer();const s="mouseenter"===t.type;this[s?"isHovered":"isFocused"]=!0,this.element.addEventListener(s?"mouseleave":"focusout",(t=>{this["mouseleave"===t.type?"isHovered":"isFocused"]=!1,this.isFocused||this.isHovered||this.setTimer()}),{once:!0})},this.handleClose=()=>{this.element.hidden=!0,this.componentClose.emit()}}watchDelay(t){if(void 0!==t&&t<2)throw new Error(`<mg-alert> prop "delay" must be greater than 2 seconds. Passed value: ${o(t)}.`)}watchVariant(t){if(t&&!n.includes(t))throw new Error(`<mg-alert> prop "variant" must be one of: ${n.join(", ")}. Passed value: ${o(t)}.`)}watchVariantStyle(t){if(t&&!c.includes(t))throw new Error(`<mg-alert> prop "variantStyle" must be one of: ${c.join(", ")}. Passed value: ${o(t)}.`)}watchHidden(t){"string"==typeof t&&""===t&&(t=!0),t?(this.componentHide.emit(),["focusin","mouseenter"].forEach((t=>{this.element.removeEventListener(t,this.timerEvents)})),this.clearTimer()):(this.componentShow.emit(),this.delay>1&&(this.setTimer(),["focusin","mouseenter"].forEach((t=>{this.element.addEventListener(t,this.timerEvents)})))),i(this)}componentWillLoad(){this.messages=r(this.element).messages,this.watchVariant(this.variant),this.watchVariantStyle(this.variantStyle),this.watchDelay(this.delay),this.watchHidden(this.element.hidden),this.hasActions=null!==this.element.querySelector('[slot="actions"]'),this.hasActions||this.classCollection.add(this.classCloseButton)}render(){return e("mg-message",{key:"6085a45d00c4762bae88d98e89f44c20d5f9b6c4",class:this.classCollection.join(),role:["info","success"].includes(this.variant)?"status":"alert",variant:this.variant,variantStyle:this.variantStyle},e("slot",{key:"55491d1b41609883958680c14a2ddb8dd84a3bd4"}),this.hasActions?e("span",{slot:"actions"},e("slot",{name:"actions"})):e("span",{class:"mg-c-alert__close-button"},e("mg-button",{"is-icon":!0,variant:"flat",label:this.messages.alert.closeButton,onClick:this.handleClose},e("mg-icon",{icon:"cross"}))))}get element(){return a(this)}static get watchers(){return{delay:[{watchDelay:0}],variant:[{watchVariant:0}],variantStyle:[{watchVariantStyle:0}],hidden:[{watchHidden:0}]}}};l.style=".mg-c-alert__close-button{position:absolute;top:0;right:0}.mg-c-alert.mg-c-alert--close-button{--mg-c-card-spacing:0 var(--mg-b-size-min-height) 0 0}";export{l as mg_alert}
@@ -0,0 +1 @@
1
+ import{r as t,h as i,a as s}from"./p-DFwaH2hS.js";import{C as e,i as h}from"./p-C7xjtdiw.js";import{i as a,c as r}from"./p-C9rmNQIL.js";const o=class{constructor(i){t(this,i),this.name=this.identifier,this.legendHide=!1,this.legendBorderDisplay=!1,this.readonly=!1,this.disabled=!1,this.classCollection=new e(["mg-c-input--fieldset"]),this.checkValidity=()=>{var t;this.valid=!(this.mgInputs.some((t=>t.invalid))||(null===(t=this.errorMessage)||void 0===t?void 0:t.length)>0)},this.setMgInputs=()=>{this.mgInputs=Array.from(this.element.querySelectorAll("*")).filter((t=>t.nodeName.startsWith("MG-INPUT"))),this.mgInputs.forEach((t=>{"MG-INPUT-FILE"===t.nodeName&&(this.readonly?t.setAttribute("hidden",""):t.removeAttribute("hidden")),this.readonly&&!a(t)?t.readonly=!0:this.disabled?t.disabled=!0:t.addEventListener("input-valid",this.checkValidity)}))}}watchLegendBorderDisplay(t){if(t&&!h(this.legendHeading))throw new Error('<mg-fieldset> prop "legendBorderDisplay" must not be paired with the prop "legendHeading".')}watchReadonly(t){t?this.classCollection.add(r):this.classCollection.delete(r)}handleAttributeChange(){this.setMgInputs()}async setCustomValidity(t){this.errorMessage=h(t)?t:void 0,this.checkValidity()}async displayError(){this.readonly||this.mgInputs.forEach((t=>{t.displayError()}))}componentWillLoad(){this.watchReadonly(this.readonly),this.watchLegendBorderDisplay(this.legendBorderDisplay),this.setMgInputs()}componentDidLoad(){const t={childList:!0,subtree:!0};new MutationObserver((i=>{i.some((i=>Object.keys(t).includes(i.type)))&&this.setMgInputs()})).observe(this.element,t)}render(){return i("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:void 0!==this.legendHeading,tooltip:this.tooltip,tooltipPosition:"label",helpText:this.helpText,errorMessage:!this.valid&&h(this.errorMessage)?this.errorMessage:void 0},i("span",{key:"eedf1c66eaf88bee037c11b812844bb5a92175c1",class:"mg-c-input__input-group"},i("slot",{key:"a28f6759a63873ef4a228820b4310b42fcf1d3c7"})))}get element(){return s(this)}static get watchers(){return{legendBorderDisplay:[{watchLegendBorderDisplay:0}],readonly:[{watchReadonly:0},{handleAttributeChange:0}],disabled:[{handleAttributeChange:0}]}}};export{o as mg_fieldset}
@@ -27,7 +27,13 @@ interface InputBaseMethods {
27
27
  /**
28
28
  * Possible Input types
29
29
  */
30
- export type HTMLMgInputsElement = (HTMLMgInputElement & InputBaseMethods) | HTMLMgInputCheckboxElement | HTMLMgInputDateElement | HTMLMgInputNumericElement | HTMLMgInputPasswordElement | HTMLMgInputRadioElement | HTMLMgInputSelectElement | HTMLMgInputTextElement | HTMLMgInputTextareaElement | (HTMLMgInputToggleElement & InputBaseMethods);
30
+ export type HTMLMgInputsElement = (HTMLMgInputElement & InputBaseMethods) | HTMLMgInputCheckboxElement | HTMLMgInputDateElement | HTMLMgInputNumericElement | HTMLMgInputPasswordElement | HTMLMgInputRadioElement | HTMLMgInputSelectElement | HTMLMgInputTextElement | HTMLMgInputTextareaElement | HTMLMgInputFileElement | (HTMLMgInputToggleElement & InputBaseMethods);
31
+ /**
32
+ * Is HTMLMgInputElement an HTMLMgInputFileElement
33
+ * @param input - input element
34
+ * @returns true if input is an mg-input-file element
35
+ */
36
+ export declare const isMgInputFile: (input: HTMLMgInputsElement) => input is HTMLMgInputFileElement;
31
37
  /**
32
38
  * Available WindowEvent types
33
39
  */
@@ -0,0 +1,210 @@
1
+ import { EventEmitter } from '../../../../stencil-public-runtime';
2
+ import { ClassList } from '@mgdis/core-ui-helpers/dist/utils';
3
+ import { type TooltipPosition } from '../mg-input/mg-input.conf';
4
+ export declare class MgInputFile {
5
+ /************
6
+ * Internal *
7
+ ************/
8
+ private inputElement;
9
+ private fileButtonElement;
10
+ private locale;
11
+ private messages;
12
+ private hasDisplayedError;
13
+ private customErrorMessage;
14
+ private handlerInProgress;
15
+ /**************
16
+ * Decorators *
17
+ **************/
18
+ /**
19
+ * Get component DOM element
20
+ */
21
+ element: HTMLMgInputFileElement;
22
+ /**
23
+ * Component value
24
+ */
25
+ value: any;
26
+ watchValue(newValue: MgInputFile['value']): void;
27
+ /**
28
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
29
+ */
30
+ identifier: string;
31
+ /**
32
+ * Input name
33
+ * If not set the value equals the identifier
34
+ */
35
+ name: string;
36
+ /**
37
+ * Input label
38
+ */
39
+ label: string;
40
+ /**
41
+ * Define if label is displayed on top
42
+ */
43
+ labelOnTop: boolean;
44
+ /**
45
+ * Define if label is visible
46
+ */
47
+ labelHide: boolean;
48
+ /**
49
+ * Define multiple files
50
+ * When the multiple Boolean attribute is specified, the file input allows the user to select more than one file.
51
+ * (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple).
52
+ */
53
+ multiple: boolean;
54
+ watchMultiple(): void;
55
+ /**
56
+ * Define file accept format
57
+ * The accept property is an attribute of the file `<input>` type
58
+ * that defines the file types the file input should accept
59
+ * (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept).
60
+ */
61
+ accept?: string;
62
+ watchAccept(newValue: MgInputFile['accept']): void;
63
+ /**
64
+ * Define max file size (in octets)
65
+ */
66
+ maxSize?: number;
67
+ /**
68
+ * Define input capture attribute
69
+ * The capture attribute is a Boolean attribute that specifies
70
+ * if the device's camera or microphone should be used to capture
71
+ * media directly, instead of choosing an existing file.
72
+ * (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#capture).
73
+ */
74
+ capture?: 'user' | 'environment' | '';
75
+ /**
76
+ * Define if input is required
77
+ */
78
+ required: boolean;
79
+ /**
80
+ * Define if input is disabled
81
+ */
82
+ disabled: boolean;
83
+ handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void;
84
+ watchDisabled(newValue: MgInputFile['disabled']): void;
85
+ /**
86
+ * Add a tooltip message next to the input
87
+ */
88
+ tooltip?: string;
89
+ /**
90
+ * Define tooltip position
91
+ */
92
+ tooltipPosition: TooltipPosition;
93
+ /**
94
+ * Add a help text under the input, usually expected data format and example
95
+ */
96
+ helpText?: string;
97
+ watchHelpText(): void;
98
+ /**
99
+ * Define input valid state
100
+ */
101
+ valid: boolean;
102
+ /**
103
+ * Define input invalid state
104
+ */
105
+ invalid: boolean;
106
+ /**
107
+ * Component classes
108
+ */
109
+ classCollection: ClassList;
110
+ /**
111
+ * Error message to display
112
+ */
113
+ errorMessage: string;
114
+ /**
115
+ * Files list
116
+ */
117
+ files: File[];
118
+ watchFiles(newValue: MgInputFile['files'], oldValue: MgInputFile['files']): void;
119
+ /**
120
+ * Emitted event when value change
121
+ */
122
+ valueChange: EventEmitter<HTMLMgInputFileElement['value']>;
123
+ /**
124
+ * Emitted event when checking validity
125
+ */
126
+ inputValid: EventEmitter<HTMLMgInputFileElement['valid']>;
127
+ /**
128
+ * Set focus on input add file button
129
+ */
130
+ setFocus(): Promise<void>;
131
+ /**
132
+ * Display input error if it exists.
133
+ */
134
+ displayError(): Promise<void>;
135
+ /**
136
+ * Set an error and display a custom error message.
137
+ * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
138
+ * It must be paired with an error message to display for the given context.
139
+ * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
140
+ * @param valid - value indicating the validity
141
+ * @param errorMessage - the error message to display
142
+ * @param errorMessageLock - lock the error message and validity state
143
+ */
144
+ setError(valid: MgInputFile['valid'], errorMessage?: string, errorMessageLock?: boolean): Promise<void>;
145
+ /**
146
+ * Reset value, validity and error state
147
+ */
148
+ reset(): Promise<void>;
149
+ /**
150
+ * Method to set validity values
151
+ * @param newValue - valid new value
152
+ */
153
+ private setValidity;
154
+ /**
155
+ * Handle change event
156
+ */
157
+ private handleInputChange;
158
+ /**
159
+ * Handle input focus event
160
+ */
161
+ private handleInputFocus;
162
+ /**
163
+ * Handle input blur event
164
+ */
165
+ private handleInputBlur;
166
+ /**
167
+ * Handle button blur event
168
+ */
169
+ private handleButtonBlur;
170
+ /**
171
+ * Handle add file button click
172
+ */
173
+ private handleButtonClick;
174
+ /**
175
+ * Check if input is valid
176
+ */
177
+ private checkValidity;
178
+ /**
179
+ * Handle delete file button click
180
+ */
181
+ private handleDeleteFileClick;
182
+ /**
183
+ * Set input error message
184
+ * @param fromSetErrorContext - context come from `setError` method
185
+ */
186
+ private setErrorMessage;
187
+ /**
188
+ * Check if max size is exceeded
189
+ * @returns boolean - true if max size is exceeded
190
+ */
191
+ private isMaxSizeExceeded;
192
+ /*************
193
+ * Lifecycle *
194
+ *************/
195
+ /**
196
+ * Check if component props are well configured on init
197
+ * @returns timeout
198
+ */
199
+ componentWillLoad(): ReturnType<typeof setTimeout>;
200
+ /**
201
+ * Render files
202
+ * @returns formated files.
203
+ */
204
+ private renderFiles;
205
+ /**
206
+ * Render
207
+ * @returns HTML Element
208
+ */
209
+ render(): HTMLElement;
210
+ }
@@ -118,15 +118,15 @@ export declare class MgInputRichTextEditor {
118
118
  */
119
119
  setFocus(): Promise<void>;
120
120
  /**
121
- * Get editor content as HTML
121
+ * Get editor content in HTML format
122
122
  * @returns HTML content of the editor
123
123
  */
124
- getHTML(): Promise<string>;
124
+ getEditorHTML(): Promise<string>;
125
125
  /**
126
- * Get editor content as plain text
126
+ * Get editor content in plain text format
127
127
  * @returns Plain text content of the editor
128
128
  */
129
- getText(): Promise<string>;
129
+ getEditorText(): Promise<string>;
130
130
  /**
131
131
  * Display input error if it exists.
132
132
  */
@@ -781,6 +781,102 @@ export namespace Components {
781
781
  */
782
782
  "value": string;
783
783
  }
784
+ interface MgInputFile {
785
+ /**
786
+ * Define file accept format The accept property is an attribute of the file `<input>` type that defines the file types the file input should accept (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept).
787
+ */
788
+ "accept"?: string;
789
+ /**
790
+ * Define input capture attribute The capture attribute is a Boolean attribute that specifies if the device's camera or microphone should be used to capture media directly, instead of choosing an existing file. (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#capture).
791
+ */
792
+ "capture"?: 'user' | 'environment' | '';
793
+ /**
794
+ * Define if input is disabled
795
+ * @default false
796
+ */
797
+ "disabled": boolean;
798
+ /**
799
+ * Display input error if it exists.
800
+ */
801
+ "displayError": () => Promise<void>;
802
+ /**
803
+ * Add a help text under the input, usually expected data format and example
804
+ */
805
+ "helpText"?: string;
806
+ /**
807
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
808
+ */
809
+ "identifier": string;
810
+ /**
811
+ * Define input invalid state
812
+ */
813
+ "invalid": boolean;
814
+ /**
815
+ * Input label
816
+ */
817
+ "label": string;
818
+ /**
819
+ * Define if label is visible
820
+ * @default false
821
+ */
822
+ "labelHide": boolean;
823
+ /**
824
+ * Define if label is displayed on top
825
+ * @default false
826
+ */
827
+ "labelOnTop": boolean;
828
+ /**
829
+ * Define max file size (in octets)
830
+ */
831
+ "maxSize"?: number;
832
+ /**
833
+ * Define multiple files When the multiple Boolean attribute is specified, the file input allows the user to select more than one file. (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple).
834
+ * @default false
835
+ */
836
+ "multiple": boolean;
837
+ /**
838
+ * Input name If not set the value equals the identifier
839
+ * @default this.identifier
840
+ */
841
+ "name": string;
842
+ /**
843
+ * Define if input is required
844
+ * @default false
845
+ */
846
+ "required": boolean;
847
+ /**
848
+ * Reset value, validity and error state
849
+ */
850
+ "reset": () => Promise<void>;
851
+ /**
852
+ * Set an error and display a custom error message. This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter. It must be paired with an error message to display for the given context. When used to set validity to `false`, you should use this method again to reset the validity to `true`.
853
+ * @param valid - value indicating the validity
854
+ * @param errorMessage - the error message to display
855
+ * @param errorMessageLock - lock the error message and validity state
856
+ */
857
+ "setError": (valid: MgInputFile["valid"], errorMessage?: string, errorMessageLock?: boolean) => Promise<void>;
858
+ /**
859
+ * Set focus on input add file button
860
+ */
861
+ "setFocus": () => Promise<void>;
862
+ /**
863
+ * Add a tooltip message next to the input
864
+ */
865
+ "tooltip"?: string;
866
+ /**
867
+ * Define tooltip position
868
+ * @default 'input'
869
+ */
870
+ "tooltipPosition": TooltipPosition;
871
+ /**
872
+ * Define input valid state
873
+ */
874
+ "valid": boolean;
875
+ /**
876
+ * Component value
877
+ */
878
+ "value": any;
879
+ }
784
880
  interface MgInputNumeric {
785
881
  /**
786
882
  * Define currency
@@ -1116,15 +1212,15 @@ export namespace Components {
1116
1212
  */
1117
1213
  "displayError": () => Promise<void>;
1118
1214
  /**
1119
- * Get editor content as HTML
1215
+ * Get editor content in HTML format
1120
1216
  * @returns HTML content of the editor
1121
1217
  */
1122
- "getHTML": () => Promise<string>;
1218
+ "getEditorHTML": () => Promise<string>;
1123
1219
  /**
1124
- * Get editor content as plain text
1220
+ * Get editor content in plain text format
1125
1221
  * @returns Plain text content of the editor
1126
1222
  */
1127
- "getText": () => Promise<string>;
1223
+ "getEditorText": () => Promise<string>;
1128
1224
  /**
1129
1225
  * Add a help text under the input, usually expected data format and example
1130
1226
  */
@@ -2049,6 +2145,10 @@ export interface MgInputDateCustomEvent<T> extends CustomEvent<T> {
2049
2145
  detail: T;
2050
2146
  target: HTMLMgInputDateElement;
2051
2147
  }
2148
+ export interface MgInputFileCustomEvent<T> extends CustomEvent<T> {
2149
+ detail: T;
2150
+ target: HTMLMgInputFileElement;
2151
+ }
2052
2152
  export interface MgInputNumericCustomEvent<T> extends CustomEvent<T> {
2053
2153
  detail: T;
2054
2154
  target: HTMLMgInputNumericElement;
@@ -2306,6 +2406,24 @@ declare global {
2306
2406
  prototype: HTMLMgInputDateElement;
2307
2407
  new (): HTMLMgInputDateElement;
2308
2408
  };
2409
+ interface HTMLMgInputFileElementEventMap {
2410
+ "value-change": HTMLMgInputFileElement['value'];
2411
+ "input-valid": HTMLMgInputFileElement['valid'];
2412
+ }
2413
+ interface HTMLMgInputFileElement extends Components.MgInputFile, HTMLStencilElement {
2414
+ addEventListener<K extends keyof HTMLMgInputFileElementEventMap>(type: K, listener: (this: HTMLMgInputFileElement, ev: MgInputFileCustomEvent<HTMLMgInputFileElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
2415
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
2416
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
2417
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
2418
+ removeEventListener<K extends keyof HTMLMgInputFileElementEventMap>(type: K, listener: (this: HTMLMgInputFileElement, ev: MgInputFileCustomEvent<HTMLMgInputFileElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
2419
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
2420
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
2421
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
2422
+ }
2423
+ var HTMLMgInputFileElement: {
2424
+ prototype: HTMLMgInputFileElement;
2425
+ new (): HTMLMgInputFileElement;
2426
+ };
2309
2427
  interface HTMLMgInputNumericElementEventMap {
2310
2428
  "value-change": number;
2311
2429
  "input-valid": HTMLMgInputNumericElement['valid'];
@@ -2364,12 +2482,7 @@ declare global {
2364
2482
  "input-valid": boolean;
2365
2483
  "value-change": string;
2366
2484
  }
2367
- interface HTMLMgInputRichTextEditorElement extends Omit<Components.MgInputRichTextEditor, "getHTML">, HTMLStencilElement {
2368
- /**
2369
- * Get editor content as HTML
2370
- * @returns HTML content of the editor
2371
- */
2372
- "getHTML": () => Promise<string>;
2485
+ interface HTMLMgInputRichTextEditorElement extends Components.MgInputRichTextEditor, HTMLStencilElement {
2373
2486
  addEventListener<K extends keyof HTMLMgInputRichTextEditorElementEventMap>(type: K, listener: (this: HTMLMgInputRichTextEditorElement, ev: MgInputRichTextEditorCustomEvent<HTMLMgInputRichTextEditorElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
2374
2487
  addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
2375
2488
  addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -2674,6 +2787,7 @@ declare global {
2674
2787
  "mg-input-checkbox-paginated": HTMLMgInputCheckboxPaginatedElement;
2675
2788
  "mg-input-combobox": HTMLMgInputComboboxElement;
2676
2789
  "mg-input-date": HTMLMgInputDateElement;
2790
+ "mg-input-file": HTMLMgInputFileElement;
2677
2791
  "mg-input-numeric": HTMLMgInputNumericElement;
2678
2792
  "mg-input-password": HTMLMgInputPasswordElement;
2679
2793
  "mg-input-radio": HTMLMgInputRadioElement;
@@ -3406,6 +3520,91 @@ declare namespace LocalJSX {
3406
3520
  */
3407
3521
  "value"?: string;
3408
3522
  }
3523
+ interface MgInputFile {
3524
+ /**
3525
+ * Define file accept format The accept property is an attribute of the file `<input>` type that defines the file types the file input should accept (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept).
3526
+ */
3527
+ "accept"?: string;
3528
+ /**
3529
+ * Define input capture attribute The capture attribute is a Boolean attribute that specifies if the device's camera or microphone should be used to capture media directly, instead of choosing an existing file. (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#capture).
3530
+ */
3531
+ "capture"?: 'user' | 'environment' | '';
3532
+ /**
3533
+ * Define if input is disabled
3534
+ * @default false
3535
+ */
3536
+ "disabled"?: boolean;
3537
+ /**
3538
+ * Add a help text under the input, usually expected data format and example
3539
+ */
3540
+ "helpText"?: string;
3541
+ /**
3542
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
3543
+ */
3544
+ "identifier": string;
3545
+ /**
3546
+ * Define input invalid state
3547
+ */
3548
+ "invalid"?: boolean;
3549
+ /**
3550
+ * Input label
3551
+ */
3552
+ "label": string;
3553
+ /**
3554
+ * Define if label is visible
3555
+ * @default false
3556
+ */
3557
+ "labelHide"?: boolean;
3558
+ /**
3559
+ * Define if label is displayed on top
3560
+ * @default false
3561
+ */
3562
+ "labelOnTop"?: boolean;
3563
+ /**
3564
+ * Define max file size (in octets)
3565
+ */
3566
+ "maxSize"?: number;
3567
+ /**
3568
+ * Define multiple files When the multiple Boolean attribute is specified, the file input allows the user to select more than one file. (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple).
3569
+ * @default false
3570
+ */
3571
+ "multiple"?: boolean;
3572
+ /**
3573
+ * Input name If not set the value equals the identifier
3574
+ * @default this.identifier
3575
+ */
3576
+ "name"?: string;
3577
+ /**
3578
+ * Emitted event when checking validity
3579
+ */
3580
+ "onInput-valid"?: (event: MgInputFileCustomEvent<HTMLMgInputFileElement['valid']>) => void;
3581
+ /**
3582
+ * Emitted event when value change
3583
+ */
3584
+ "onValue-change"?: (event: MgInputFileCustomEvent<HTMLMgInputFileElement['value']>) => void;
3585
+ /**
3586
+ * Define if input is required
3587
+ * @default false
3588
+ */
3589
+ "required"?: boolean;
3590
+ /**
3591
+ * Add a tooltip message next to the input
3592
+ */
3593
+ "tooltip"?: string;
3594
+ /**
3595
+ * Define tooltip position
3596
+ * @default 'input'
3597
+ */
3598
+ "tooltipPosition"?: TooltipPosition;
3599
+ /**
3600
+ * Define input valid state
3601
+ */
3602
+ "valid"?: boolean;
3603
+ /**
3604
+ * Component value
3605
+ */
3606
+ "value"?: any;
3607
+ }
3409
3608
  interface MgInputNumeric {
3410
3609
  /**
3411
3610
  * Define currency
@@ -4622,6 +4821,7 @@ declare namespace LocalJSX {
4622
4821
  "mg-input-checkbox-paginated": MgInputCheckboxPaginated;
4623
4822
  "mg-input-combobox": MgInputCombobox;
4624
4823
  "mg-input-date": MgInputDate;
4824
+ "mg-input-file": MgInputFile;
4625
4825
  "mg-input-numeric": MgInputNumeric;
4626
4826
  "mg-input-password": MgInputPassword;
4627
4827
  "mg-input-radio": MgInputRadio;
@@ -4674,6 +4874,7 @@ declare module "@stencil/core" {
4674
4874
  "mg-input-checkbox-paginated": LocalJSX.MgInputCheckboxPaginated & JSXBase.HTMLAttributes<HTMLMgInputCheckboxPaginatedElement>;
4675
4875
  "mg-input-combobox": LocalJSX.MgInputCombobox & JSXBase.HTMLAttributes<HTMLMgInputComboboxElement>;
4676
4876
  "mg-input-date": LocalJSX.MgInputDate & JSXBase.HTMLAttributes<HTMLMgInputDateElement>;
4877
+ "mg-input-file": LocalJSX.MgInputFile & JSXBase.HTMLAttributes<HTMLMgInputFileElement>;
4677
4878
  "mg-input-numeric": LocalJSX.MgInputNumeric & JSXBase.HTMLAttributes<HTMLMgInputNumericElement>;
4678
4879
  "mg-input-password": LocalJSX.MgInputPassword & JSXBase.HTMLAttributes<HTMLMgInputPasswordElement>;
4679
4880
  "mg-input-radio": LocalJSX.MgInputRadio & JSXBase.HTMLAttributes<HTMLMgInputRadioElement>;