@mgdis/mg-components 6.24.0 → 6.25.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 (186) hide show
  1. package/dist/cjs/index-Acmyl4hv.js +5 -0
  2. package/dist/cjs/{index-BxB20_Vw.js → index-B6J2EllP.js} +3 -1
  3. package/dist/cjs/{index-BEF-cqV9.js → index-BmFwLEZT.js} +5 -1
  4. package/dist/cjs/{index-CpENFzEo.js → index-DrZECzp6.js} +14 -6
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/mg-action-more_36.cjs.entry.js +385 -259
  7. package/dist/cjs/mg-alert.cjs.entry.js +7 -8
  8. package/dist/cjs/mg-breadcrumb.cjs.entry.js +27 -10
  9. package/dist/cjs/mg-components.cjs.js +2 -2
  10. package/dist/cjs/mg-fieldset.cjs.entry.js +8 -8
  11. package/dist/cjs/mg-illustration.cjs.entry.js +57 -0
  12. package/dist/cjs/mg-input-combobox.cjs.entry.js +40 -23
  13. package/dist/cjs/mg-input-file.cjs.entry.js +12 -11
  14. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +2565 -4011
  15. package/dist/cjs/mg-loader.cjs.entry.js +5 -5
  16. package/dist/cjs/mg-progress.cjs.entry.js +3 -3
  17. package/dist/collection/assets/illustrations/index.js +1 -0
  18. package/dist/collection/collection-manifest.json +1 -0
  19. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +1 -1
  20. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +1 -1
  21. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
  22. package/dist/collection/components/atoms/mg-button/mg-button.js +4 -1
  23. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
  24. package/dist/collection/components/atoms/mg-divider/mg-divider.conf.js +4 -0
  25. package/dist/collection/components/atoms/mg-divider/mg-divider.js +62 -3
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
  27. package/dist/collection/components/atoms/mg-illustration/mg-illustration.conf.js +1 -0
  28. package/dist/collection/components/atoms/mg-illustration/mg-illustration.js +95 -0
  29. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  30. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
  31. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +9 -7
  32. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +49 -19
  33. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +5 -2
  34. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxPaginated.js +5 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +30 -22
  36. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +69 -25
  37. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +14 -8
  38. package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +8 -7
  39. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +21 -12
  40. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +7 -7
  41. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +15 -10
  42. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +29 -3
  43. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +260 -7
  44. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -19
  45. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +18 -13
  46. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +7 -7
  47. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +10 -9
  48. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
  49. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +7 -5
  50. package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +18 -17
  51. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +7 -4
  52. package/dist/collection/components/molecules/mg-alert/mg-alert.js +6 -7
  53. package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.js +49 -6
  54. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  55. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +6 -6
  56. package/dist/collection/components/molecules/mg-form/mg-form.js +16 -13
  57. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +2 -2
  58. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  59. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  60. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  61. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +8 -4
  62. package/dist/collection/components/molecules/mg-panel/mg-panel.js +13 -4
  63. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
  64. package/dist/collection/components/molecules/mg-popover/mg-popover.js +21 -37
  65. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  66. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -3
  67. package/dist/collection/components/molecules/mg-table/mg-table.js +10 -6
  68. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +12 -9
  69. package/dist/collection/utils/behaviors.utils.js +3 -3
  70. package/dist/collection/utils/playwright.fixture.js +7 -2
  71. package/dist/components/mg-action-more.js +1 -1
  72. package/dist/components/mg-alert.js +1 -1
  73. package/dist/components/mg-badge2.js +1 -1
  74. package/dist/components/mg-breadcrumb.js +1 -1
  75. package/dist/components/mg-button2.js +1 -1
  76. package/dist/components/mg-card2.js +1 -1
  77. package/dist/components/mg-character-left2.js +1 -1
  78. package/dist/components/mg-details.js +1 -1
  79. package/dist/components/mg-divider2.js +1 -1
  80. package/dist/components/mg-fieldset.js +1 -1
  81. package/dist/components/mg-form.js +1 -1
  82. package/dist/components/mg-icon2.js +1 -1
  83. package/dist/components/mg-illustrated-message.js +1 -1
  84. package/dist/components/mg-illustration.d.ts +11 -0
  85. package/dist/components/mg-illustration.js +1 -0
  86. package/dist/components/mg-input-checkbox.js +1 -1
  87. package/dist/components/mg-input-combobox.js +1 -1
  88. package/dist/components/mg-input-date.js +1 -1
  89. package/dist/components/mg-input-file.js +1 -1
  90. package/dist/components/mg-input-numeric.js +1 -1
  91. package/dist/components/mg-input-password.js +1 -1
  92. package/dist/components/mg-input-radio.js +1 -1
  93. package/dist/components/mg-input-rich-text-editor.js +294 -284
  94. package/dist/components/mg-input-select2.js +1 -1
  95. package/dist/components/mg-input-text2.js +1 -1
  96. package/dist/components/mg-input-textarea.js +1 -1
  97. package/dist/components/mg-input-title2.js +1 -1
  98. package/dist/components/mg-input-toggle.js +1 -1
  99. package/dist/components/mg-input2.js +1 -1
  100. package/dist/components/mg-item-more2.js +1 -1
  101. package/dist/components/mg-loader2.js +1 -1
  102. package/dist/components/mg-menu-item2.js +1 -1
  103. package/dist/components/mg-message2.js +1 -1
  104. package/dist/components/mg-modal.js +1 -1
  105. package/dist/components/mg-pagination.js +1 -1
  106. package/dist/components/mg-panel.js +1 -1
  107. package/dist/components/mg-popover-content2.js +1 -1
  108. package/dist/components/mg-popover2.js +1 -1
  109. package/dist/components/mg-progress.js +1 -1
  110. package/dist/components/mg-skip-links.js +1 -1
  111. package/dist/components/mg-table.js +1 -1
  112. package/dist/components/mg-tabs2.js +1 -1
  113. package/dist/components/mg-tag.js +1 -1
  114. package/dist/components/mg-tooltip-content2.js +1 -1
  115. package/dist/components/mg-tooltip2.js +1 -1
  116. package/dist/custom-elements.json +178 -48
  117. package/dist/esm/{index-C7xjtdiw.js → index-91BOpzAB.js} +14 -6
  118. package/dist/esm/{index-DSEloqPn.js → index-BfblyCaJ.js} +3 -1
  119. package/dist/esm/index-Ci9Hv7DG.js +3 -0
  120. package/dist/esm/{index-DshvCiTL.js → index-D4bO_UCn.js} +5 -1
  121. package/dist/esm/loader.js +3 -3
  122. package/dist/esm/mg-action-more_36.entry.js +382 -256
  123. package/dist/esm/mg-alert.entry.js +7 -8
  124. package/dist/esm/mg-breadcrumb.entry.js +27 -10
  125. package/dist/esm/mg-components.js +3 -3
  126. package/dist/esm/mg-fieldset.entry.js +8 -8
  127. package/dist/esm/mg-illustration.entry.js +55 -0
  128. package/dist/esm/mg-input-combobox.entry.js +40 -23
  129. package/dist/esm/mg-input-file.entry.js +12 -11
  130. package/dist/esm/mg-input-rich-text-editor.entry.js +2550 -3996
  131. package/dist/esm/mg-loader.entry.js +5 -5
  132. package/dist/esm/mg-progress.entry.js +3 -3
  133. package/dist/mg-components/mg-components.css +1 -1
  134. package/dist/mg-components/mg-components.esm.js +1 -1
  135. package/dist/mg-components/{p-cdb01923.entry.js → p-3ad7441c.entry.js} +1 -1
  136. package/dist/mg-components/p-413b4536.entry.js +1 -0
  137. package/dist/mg-components/p-4693077a.entry.js +1 -0
  138. package/dist/mg-components/p-5dff879a.entry.js +1 -0
  139. package/dist/mg-components/{p-08d3d957.entry.js → p-96fc508e.entry.js} +1 -1
  140. package/dist/mg-components/p-Ci9Hv7DG.js +1 -0
  141. package/dist/mg-components/p-D4bO_UCn.js +2 -0
  142. package/dist/mg-components/{p-d0b6d8f5.entry.js → p-ad533d08.entry.js} +1 -1
  143. package/dist/mg-components/p-b20f3698.entry.js +1 -0
  144. package/dist/mg-components/p-d0d12800.entry.js +1 -0
  145. package/dist/mg-components/p-ec4bd337.entry.js +1667 -0
  146. package/dist/mg-components/p-f8e58181.entry.js +1 -0
  147. package/dist/types/assets/illustrations/index.d.ts +21 -0
  148. package/dist/types/components/atoms/mg-divider/mg-divider.conf.d.ts +9 -0
  149. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +13 -0
  150. package/dist/types/components/atoms/mg-illustration/mg-illustration.conf.d.ts +5 -0
  151. package/dist/types/components/atoms/mg-illustration/mg-illustration.d.ts +24 -0
  152. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +18 -0
  153. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +1 -1
  154. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +10 -5
  155. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +2 -2
  156. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +2 -2
  157. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +2 -2
  158. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +1 -1
  159. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.d.ts +4 -0
  160. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.d.ts +25 -0
  161. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +61 -2
  162. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +2 -2
  163. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +2 -2
  164. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +2 -2
  165. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -2
  166. package/dist/types/components/molecules/menus/mg-menu-item/mg-menu-item.d.ts +2 -2
  167. package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +2 -2
  168. package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.d.ts +11 -0
  169. package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +1 -1
  170. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -3
  171. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +1 -1
  172. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +1 -1
  173. package/dist/types/components.d.ts +145 -40
  174. package/ide/intellij/web-types.json +134 -64
  175. package/ide/vscode/css-custom-data.json +6 -2
  176. package/ide/vscode/html-custom-data.json +190 -32
  177. package/package.json +21 -21
  178. package/dist/mg-components/p-13feb37a.entry.js +0 -1
  179. package/dist/mg-components/p-7c63e469.entry.js +0 -1
  180. package/dist/mg-components/p-7fd3e519.entry.js +0 -1
  181. package/dist/mg-components/p-9953b835.entry.js +0 -1
  182. package/dist/mg-components/p-9c0a9fc7.entry.js +0 -1657
  183. package/dist/mg-components/p-DshvCiTL.js +0 -2
  184. package/dist/mg-components/p-a338088e.entry.js +0 -1
  185. /package/dist/mg-components/{p-C7xjtdiw.js → p-91BOpzAB.js} +0 -0
  186. /package/dist/mg-components/{p-DSEloqPn.js → p-BfblyCaJ.js} +0 -0
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,a as o}from"./p-DshvCiTL.js";import{P as e,C as n,t as a,a as h,n as r,g as c,b as p,i as m,c as u,f as l,d as g}from"./p-C7xjtdiw.js";import{c as d,a as b,w as v,n as f}from"./p-DOi9lJXy.js";import{i as w}from"./p-DSEloqPn.js";import{K as _}from"./p-yMGqY8YG.js";const x=t=>t&&"object"==typeof t&&"string"==typeof t.title&&void 0!==t.value,y=class{constructor(s){t(this,s),this.valueChange=i(this,"value-change",7),this.filterChange=i(this,"filter-change",7),this.showMore=i(this,"load-more",7),this.inputValid=i(this,"input-valid",7),this.fetchError=i(this,"fetch-error",7),this.hasDisplayedError=!1,this.customErrorMessage={lock:!1},this.name=this.identifier,this.labelOnTop=!1,this.labelHide=!1,this.required=!1,this.readonly=!1,this.disabled=!1,this.mgWidth="full",this.tooltipPosition="input",this.options=new e([]),this.filter="",this.classCollection=new n(["mg-c-input--combobox","mg-c-input--has-icon","mg-c-input--input-append"]),this.popoverDisplay=!1,this.handleOptionClick=t=>{this.setValue(this.options.items.find((i=>a(i.value)===t.target.dataset.value))),this.popoverDisplay=!1},this.handleResetButton=t=>{t.stopPropagation(),this.reset().then((()=>{this.input.focus()}))},this.handlePopoverDisplay=t=>{this.popoverDisplay=t.detail},this.handleFilterInput=()=>{this.checkValidity(),this.hasDisplayedError&&this.setErrorMessage(),this.popoverDisplay||(this.popoverDisplay=!0),this.debounce||(this.debounce=!0,setTimeout((()=>{this.filter=this.input.value,this.debounce=!1}),250))},this.handleFilterBlur=t=>{this.popoverDisplay?(t.stopImmediatePropagation(),this.input.focus()):(this.handlerInProgress="blur",this.displayError().finally((()=>{this.handlerInProgress=void 0})))},this.handleFilterFocus=()=>{this.isLoading||(this.option=null)},this.handleLoadMoreButton=()=>{this.loadingWrapper({name:"load-more",cursor:h.NEXT}).then((()=>{this.input.focus()}))},this.handleFilterKeydown=t=>{var i;if(this.disabled||t.ctrlKey||t.shiftKey)return;let s=!1;switch(t.key){case _.TAB:case _.ENTER:{s=t.key===_.ENTER;const o=null!==(i=this.option)&&void 0!==i?i:this.options.items.find(this.isCurrentOption);this.popoverDisplay&&this.setValue(o),this.popoverDisplay=!1;break}case _.DOWN:case _.ARROWDOWN:case _.UP:case _.ARROWUP:{if(s=!0,this.isLoading||0===this.page.total){this.popoverDisplay=!0;break}if(Boolean(t.altKey)&&[_.DOWN,_.ARROWDOWN].includes(t.key)){this.popoverDisplay=!0;break}let i;const o=this.popoverDisplay&&x(this.option);[_.DOWN,_.ARROWDOWN].includes(t.key)?i=o?h.NEXT:h.FIRST:[_.UP,_.ARROWUP].includes(t.key)&&(i=o?h.PREVIOUS:h.LAST),this.loadingWrapper({name:"scroll",cursor:i}),this.popoverDisplay=!0;break}case _.LEFT:case _.ARROWLEFT:case _.HOME:case _.RIGHT:case _.ARROWRIGHT:case _.END:{if(!x(this.option))break;let i;s=!0,this.option=null,_.HOME===t.key?i=0:_.END===t.key&&(i=this.filter.length),"number"==typeof i&&this.input.setSelectionRange(i,i);break}case _.ESC:case _.ESCAPE:s=!0,this.popoverDisplay?this.popoverDisplay=!1:(this.setValue(null),this.filter="",this.option=null);break;default:this.option=null}s&&(t.stopPropagation(),t.preventDefault())},this.scrollToIndex=t=>{requestAnimationFrame((()=>{var i;this.popoverDisplay&&(null===(i=this.element.shadowRoot.querySelector(`li:nth-of-type(${(t||0)+this.page.baseIndex})`))||void 0===i||i.scrollIntoView({block:"nearest"}))}))},this.isCurrentOption=t=>(x(this.value)?this.value.value:this.value)===t.value,this.getValueTitle=()=>this.value&&x(this.value)?this.value.title:"string"==typeof this.value?this.value:"",this.checkValidity=()=>{this.setValidity(this.readonly||this.disabled||this.input.checkValidity())},this.setErrorMessage=(t=!1)=>{this.errorMessage=void 0,this.valid||(t||this.customErrorMessage.lock&&void 0!==this.customErrorMessage.message?this.errorMessage=this.customErrorMessage.message:this.input.validity.valueMissing&&(this.errorMessage=this.messages.errors.required))},this.getFirstPage=()=>this.options.getPage(0,(t=>""===this.filter||t.title.toLocaleLowerCase().includes(this.filter.toLocaleLowerCase()))),this.loadingWrapper=t=>{var i;let s,o;if(null!==(i=this.loadingAction)&&void 0!==i||(this.loadingAction=t.name),Boolean(this.option)&&"load-more"!==this.loadingAction?o=this.page.items.findIndex((t=>a(t.value)===a(this.option.value))):"load-more"===this.loadingAction&&(o=this.page.items.length-this.page.baseIndex),"load-more"===t.name)this.isLoading=!0,s=this.goToNextPage;else{if(t.cursor===h.NEXT&&this.page.items.length<=this.page.total&&o+this.page.baseIndex===this.page.items.length&&o+this.page.baseIndex<this.page.total)return void this.loadMoreElement.click();s="scroll"===t.name?r:this.updatePage}return s().then((()=>{const i=""===this.filter?this.options.items:this.options.items.filter((t=>t.title.includes(this.filter)));"load-data"!==t.name&&(o=this.page.getIndexFromCursor(t.cursor,"load-more"===this.loadingAction&&o>=0?i[o]:this.option)),this.option=i[o],this.scrollToIndex(o)})).finally((()=>{requestAnimationFrame((()=>{this.isLoading=!1,this.loadingAction=void 0}))}))},this.goToNextPage=()=>(this.showMore.emit(),void 0!==this.fetchurl?this.getOptions("string"==typeof this.page.next?this.page.next:void 0).then((t=>{if(void 0!==t){const i=[...this.page.items,...t.items];this.options=new e(i,{total:t.total,next:t.next,top:i.length})}})):r((()=>{if("function"==typeof this.page.next){const t=this.page.next();this.page=new g(Object.assign(Object.assign({},t),{items:[...this.page.items,...t.items]}))}}))),this.updatePage=async()=>{if(void 0!==this.fetchurl)return this.getOptions().then((t=>{void 0!==t&&(this.options=new e(t.items,{total:t.total,next:t.next,top:t.top}))}));this.page=this.getFirstPage()},this.getOptions=async(t=this.fetchurl)=>{const i="function"==typeof this.fetchmappings.request.filterTransform?this.fetchmappings.request.filterTransform(this.filter):this.filter,s=("string"==typeof t?t:t.toString()).replaceAll(this.fetchmappings.request.filter,encodeURIComponent(i));try{const t=await fetch(s,this.fetchoptions);if(!t.ok)return void this.fetchError.emit(new Error(`${t.status} - ${t.statusText}`));const i=await t.json(),o=c(i,this.fetchmappings.response.items).map((t=>{var i;return{title:c(t,this.fetchmappings.response.itemTitle),value:null!==(i=c(t,this.fetchmappings.response.itemValue))&&void 0!==i?i:t}})),e=Number(c(i,this.fetchmappings.response.total,0));let n=c(i,this.fetchmappings.response.next);if(Boolean(n)&&!URL.canParse(n)){const t=new URL(s,this.element.ownerDocument.baseURI);n=new URL(n,t).toString()}return{items:o,total:e,next:n,top:o.length}}catch(t){this.fetchError.emit(t)}}}watchValue(t){this.filter=this.getValueTitle(),this.valueChange.emit(t)}watchItems(t){if(void 0===this.fetchurl||void 0!==t){if(void 0!==this.fetchurl&&void 0!==t)throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${a(t)}.`);if(Array.isArray(t)&&0===t.length)this.options=new e([]);else if(p(t))this.options=new e(t.map((t=>({title:t,value:t}))),{total:t.length});else{if(i=t,!Array.isArray(i)||!i.every(x))throw new Error(`<mg-input-combobox> prop "items" values must be the same type, string or Option. Passed value: ${a(t)}.`);this.options=new e(t,{total:t.length})}var i}}watchIdentifier(t){m(t)&&(this.popoverId=`${t}-popover`,this.element.dataset.mgPopoverGuard=this.popoverId)}watchReadonly(t){t?this.classCollection.add(d):this.classCollection.delete(d)}watchValidityChange(t,i,s){void 0!==this.input&&(this.input[s]=t,this.checkValidity(),this.hasDisplayedError&&(this.setErrorMessage(),this.hasDisplayedError=!1))}watchDisabled(t){t?this.classCollection.add(b):this.classCollection.delete(b)}watchMgWidth(t){v.forEach((t=>{this.classCollection.delete(`mg-c-input--width-${t}`)})),void 0!==t&&this.classCollection.add(`mg-c-input--width-${this.mgWidth}`),this.classCollection=new n(this.classCollection.classes)}watchFetchUrl(t){void 0!==t&&this.loadingWrapper({name:"load-data"})}watchFetchOptions(t){if(this.fetchurl&&t&&!u(t))throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${a(t)}.`)}watchFetchMappings(t){if(void 0!==this.fetchurl&&!u(t))throw new Error('<mg-input-combobox> prop "fetchmappings" is required with "fetchurl" prop.');if(void 0!==t&&!(t=>{const i=u(t)&&Object.hasOwn(t,"request")&&Object.hasOwn(t,"response");if(i){const{request:i,response:s}=t;return![i,s].some((t=>!u(t)))&&!("string"!=typeof i.filter||void 0!==i.filterTransform&&"function"!=typeof i.filterTransform||"object"!=typeof s||"string"!=typeof s.total||"string"!=typeof s.items||"string"!=typeof s.next||"string"!=typeof s.itemTitle||"string"!=typeof s.itemValue&&void 0!==s.itemValue)}return i})(t))throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${a(t)}.`)}watchOptions(){this.page=this.getFirstPage()}watchFilter(t){this.loadingWrapper({name:"load-data"}),this.filterChange.emit(t)}watchPopoverDisplay(t){t?this.input.focus():(this.option=null,this.filter=this.getValueTitle(),this.handlerInProgress="blur",this.displayError().finally((()=>{this.handlerInProgress=void 0})))}async setFocus(){var t;null===(t=this.input)||void 0===t||t.focus()}displayError(){return new Promise((t=>{requestAnimationFrame((()=>{this.checkValidity(),this.setErrorMessage(),this.hasDisplayedError=this.invalid,t()}))}))}async setError(t,i,s=!1){if("boolean"!=typeof t)throw new Error('<mg-input-combobox> method "setError()" param "valid" must be a boolean.');if(void 0!==i&&!m(i))throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');this.customErrorMessage={lock:!t&&s,message:t?void 0:i},this.setValidity(t),this.setErrorMessage(!0),this.hasDisplayedError=this.invalid}async reset(){if(!this.readonly)return this.setValue(null),this.option=null,this.filter="",new Promise((t=>{requestAnimationFrame((()=>{this.customErrorMessage={lock:!1},this.checkValidity(),this.errorMessage=void 0,this.hasDisplayedError=!1,t()}))}))}setValue(t){this.value=x(t)?p(this.items||this.options.items)?t.title:Object.assign({},t):""}setValidity(t){const i=this.valid;this.customErrorMessage.lock&&(void 0===this.customErrorMessage.message||t)||(this.valid=t),this.invalid=!this.valid,(void 0===this.handlerInProgress||"blur"===this.handlerInProgress&&this.valid!==i)&&this.inputValid.emit(this.valid)}componentWillLoad(){return this.messages=w(this.element).messages,f(this),this.watchIdentifier(this.identifier),this.watchItems(this.items),void 0!==this.fetchurl&&(this.watchFetchOptions(this.fetchoptions),this.watchFetchMappings(this.fetchmappings),this.loadingWrapper({name:"load-data"})),this.watchValue(this.value),this.watchOptions(),this.watchMgWidth(this.mgWidth),this.watchReadonly(this.readonly),this.watchDisabled(this.disabled),setTimeout((()=>{this.checkValidity()}),0)}render(){var t,i,o,e,n,h;const r=`${this.identifier}-list`,c=this.getValueTitle(),p=this.value&&!this.disabled;let m,u;return(null===(t=this.page)||void 0===t?void 0:t.items.length)>0?m="list":0===(null===(i=this.page)||void 0===i?void 0:i.items.length)&&this.filter.length>0?m="notfound":0===(null===(o=this.page)||void 0===o?void 0:o.items.length)&&(m="notavailable"),u=void 0!==(null===(e=this.option)||void 0===e?void 0:e.value)?this.option.value:"string"==typeof this.value?this.value:null===(n=this.value)||void 0===n?void 0:n.value,s("mg-input",{key:"5c24478bb10ab8f1d292d38a9be162e370b0fdb2",label:this.label,identifier:this.identifier,class:this.classCollection.classes.join(" "),ariaDescribedbyIDs:m&&"list"!==m?m:void 0,labelOnTop:this.labelOnTop,labelHide:this.labelHide,required:this.required,tooltip:this.tooltip,tooltipPosition:this.readonly&&void 0===this.value?"label":this.tooltipPosition,helpText:this.helpText,errorMessage:this.errorMessage},this.readonly?c&&s("b",{class:"mg-c-input__readonly-value"},c):s("mg-popover",{identifier:this.popoverId,placement:"bottom-start",display:this.popoverDisplay,"arrow-hide":!0,style:{"--mg-c-input-list-width":(null===(h=this.input)||void 0===h?void 0:h.offsetWidth)>0?`${this.input.offsetWidth}px`:void 0},"data-fallback-placement":"bottom-end","onDisplay-change":this.handlePopoverDisplay},s("div",{class:"mg-c-input__input-group-container"},s("mg-icon",{icon:"magnifying-glass"}),s("input",{type:"text",role:"combobox",class:"mg-c-input__box mg-c-input__box--width",value:this.filter,id:this.identifier,name:this.name,placeholder:this.placeholder,title:this.placeholder,disabled:this.disabled,required:this.required,autocomplete:"off","aria-autocomplete":"list","aria-expanded":this.popoverDisplay.toString(),"aria-controls":r,"aria-invalid":(!0===this.invalid).toString(),"aria-activedescendant":l(u),onInput:this.handleFilterInput,onBlur:this.handleFilterBlur,onFocus:this.handleFilterFocus,onKeyDown:this.handleFilterKeydown,ref:t=>{null!==t&&(this.input=t)}}),p?s("mg-button",{class:"mg-c-input__box-append mg-c-input__reset",variant:"flat","is-icon":!0,label:this.messages.general.reset,"aria-controls":this.identifier,tabindex:"-1",onClick:this.handleResetButton},s("mg-icon",{icon:"cross"})):s("mg-button",{class:"mg-c-input__box-append",variant:"flat","is-icon":!0,label:this.itemsLabel,tabindex:"-1",disabled:this.disabled},s("mg-icon",{icon:"chevron-"+(this.popoverDisplay?"up":"down")}))),s("div",{slot:"content",class:"mg-c-input__popover-container"},"list"===m&&[s("ul",{key:"list",class:"mg-c-input__input-list",role:"listbox",id:r,"aria-label":this.itemsLabel,"aria-setsize":this.page.total},this.page.items.map((t=>{var i;return s("li",{role:"option",class:{"mg-c-input__input-list-item":!0,"mg-c-input__input-list-item--focus-visible":JSON.stringify(null===(i=this.option)||void 0===i?void 0:i.value)===JSON.stringify(t.value),"mg-c-input__input-list-item--selected":this.isCurrentOption(t)},key:t.title,id:l(t.value),"aria-selected":this.isCurrentOption(t).toString(),"data-value":a(t.value),onClick:this.handleOptionClick},t.title,this.isCurrentOption(t)&&s("mg-icon",{icon:"check"}))}))),this.isLoading&&s("mg-loader",{key:"loader",message:this.messages.input.combobox.search,class:{"mg-u-visually-hidden":Boolean(this.page.next)}}),this.page.next&&s("mg-button",{key:"load-more",variant:"flat",class:"mg-c-input__load-more",tabIndex:-1,disabled:this.isLoading,"full-width":!0,"disable-on-click":!0,onClick:this.handleLoadMoreButton,"aria-controls":r,ref:t=>{null!==t&&(this.loadMoreElement=t)}},s("mg-icon",{icon:"chevron-down"}),this.messages.input.showMore)],"notfound"===m&&s("p",{id:m,class:"mg-c-input__popover-info"},this.messages.input.combobox.notFound),"notavailable"===m&&s("p",{id:m,class:"mg-c-input__popover-info"},this.messages.input.combobox.notAvailable))))}get element(){return o(this)}static get watchers(){return{value:[{watchValue:0}],items:[{watchItems:0}],identifier:[{watchIdentifier:0}],readonly:[{watchReadonly:0},{watchValidityChange:0}],required:[{watchValidityChange:0}],disabled:[{watchValidityChange:0},{watchDisabled:0}],mgWidth:[{watchMgWidth:0}],fetchurl:[{watchFetchUrl:0}],fetchoptions:[{watchFetchOptions:0}],fetchmappings:[{watchFetchMappings:0}],options:[{watchOptions:0}],filter:[{watchFilter:0}],popoverDisplay:[{watchPopoverDisplay:0}]}}};y.style=".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;color:var(--mg-b-color-neutral-90);text-align:center}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-full .mg-c-input__input-group-container{width:100%;flex-grow:1}.mg-c-input.mg-c-input--width-2.mg-c-input--display-character-left .mg-c-input__input-group-container,.mg-c-input.mg-c-input--width-4.mg-c-input--display-character-left .mg-c-input__input-group-container,.mg-c-input.mg-c-input--width-16.mg-c-input--display-character-left .mg-c-input__input-group-container{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2.mg-c-input--text.mg-c-input--display-character-left .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4.mg-c-input--text.mg-c-input--display-character-left .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16.mg-c-input--text.mg-c-input--display-character-left .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input.mg-c-input--combobox mg-popover{--mg-c-popover-overflow:auto;--mg-c-popover-spacing-vertical:0;--mg-c-popover-spacing-horizontal:0;--mg-c-popover-min-width:var(--mg-c-input-list-width);--mg-c-popover-max-height:calc(50 * var(--mg-b-size-8) - var(--mg-b-size-32))}.mg-c-input.mg-c-input--combobox .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--combobox .mg-c-input__box{cursor:pointer}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-container{display:flex;flex-direction:column;gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-input__load-more{padding:0 var(--mg-b-size-8) var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list{padding:0;margin:0;cursor:pointer;list-style:none}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item{display:flex;padding:var(--mg-b-size-8)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item:hover,.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--focus-visible{background-color:var(--mg-b-color-neutral-20)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected{font-weight:700}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected mg-icon{margin-left:auto}.mg-c-input.mg-c-input--combobox.mg-c-input--width-2 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-24) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-4 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-48) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-16 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + calc(23 * var(--mg-b-size-8)) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full mg-popover{--mg-c-popover-max-width:var(--mg-c-input-list-width, var(--mg-c-popover-max-width))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__input-group-container{display:flex;width:100%}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__box{flex:1}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box-append{position:absolute;top:0;right:0}";export{y as mg_input_combobox}