@mgdis/mg-components 6.21.0 → 6.22.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 (158) hide show
  1. package/dist/cjs/{index-CCsGMNyq.js → index-BxB20_Vw.js} +8 -0
  2. package/dist/cjs/index-C2viYwrR.js +4 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/mg-action-more_37.cjs.entry.js +116 -137
  5. package/dist/cjs/mg-alert.cjs.entry.js +1 -1
  6. package/dist/cjs/mg-breadcrumb.cjs.entry.js +63 -0
  7. package/dist/cjs/mg-components.cjs.js +1 -1
  8. package/dist/cjs/mg-fieldset.cjs.entry.js +1 -1
  9. package/dist/cjs/mg-input-combobox.cjs.entry.js +3 -3
  10. package/dist/cjs/mg-input-file.cjs.entry.js +3 -3
  11. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +40071 -15808
  12. package/dist/cjs/mg-loader.cjs.entry.js +2 -2
  13. package/dist/cjs/mg-progress.cjs.entry.js +1 -1
  14. package/dist/collection/assets/icons/index.js +1 -1
  15. package/dist/collection/collection-manifest.json +2 -1
  16. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +1 -1
  17. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +1 -1
  18. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
  19. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.js +2 -2
  21. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  22. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
  23. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -1
  24. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -2
  26. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +1 -1
  28. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +1 -1
  29. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
  30. package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +2 -2
  31. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  32. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +2 -2
  33. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
  34. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/custom-properties.scss +212 -0
  35. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.js +1 -0
  36. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +300 -94
  37. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.js +29 -0
  38. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +160 -50
  39. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  40. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
  41. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
  43. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +3 -36
  44. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.conf.js +0 -4
  45. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +21 -43
  46. package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +65 -38
  47. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
  48. package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.js +1 -0
  49. package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.js +92 -0
  50. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  51. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +1 -1
  52. package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
  53. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  54. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  55. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  56. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  57. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
  58. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  59. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  60. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  61. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  62. package/dist/collection/components/molecules/mg-table/mg-table.js +37 -0
  63. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +0 -4
  64. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +13 -33
  65. package/dist/collection/locales/en/messages.json +3 -0
  66. package/dist/collection/locales/fr/messages.json +3 -0
  67. package/dist/components/index3.js +1 -1
  68. package/dist/components/mg-action-more.js +1 -1
  69. package/dist/components/mg-breadcrumb.d.ts +11 -0
  70. package/dist/components/mg-breadcrumb.js +1 -0
  71. package/dist/components/mg-card2.js +1 -1
  72. package/dist/components/mg-character-left2.js +1 -1
  73. package/dist/components/mg-details.js +1 -1
  74. package/dist/components/mg-divider2.js +1 -1
  75. package/dist/components/mg-fieldset.js +1 -1
  76. package/dist/components/mg-form.js +1 -1
  77. package/dist/components/mg-icon2.js +1 -1
  78. package/dist/components/mg-illustrated-message.js +1 -1
  79. package/dist/components/mg-input-checkbox-paginated2.js +1 -1
  80. package/dist/components/mg-input-checkbox.js +1 -1
  81. package/dist/components/mg-input-combobox.js +1 -1
  82. package/dist/components/mg-input-date.js +1 -1
  83. package/dist/components/mg-input-file.js +1 -1
  84. package/dist/components/mg-input-numeric.js +1 -1
  85. package/dist/components/mg-input-password.js +1 -1
  86. package/dist/components/mg-input-radio.js +1 -1
  87. package/dist/components/mg-input-rich-text-editor.js +1663 -1
  88. package/dist/components/mg-input-select2.js +1 -1
  89. package/dist/components/mg-input-text2.js +1 -1
  90. package/dist/components/mg-input-textarea.js +1 -1
  91. package/dist/components/mg-input-title2.js +1 -1
  92. package/dist/components/mg-input-toggle.js +1 -1
  93. package/dist/components/mg-input2.js +1 -1
  94. package/dist/components/mg-item-more2.js +1 -1
  95. package/dist/components/mg-loader2.js +1 -1
  96. package/dist/components/mg-menu-item2.js +1 -1
  97. package/dist/components/mg-message2.js +1 -1
  98. package/dist/components/mg-modal.js +1 -1
  99. package/dist/components/mg-panel.js +1 -1
  100. package/dist/components/mg-popover-content2.js +1 -1
  101. package/dist/components/mg-popover2.js +1 -1
  102. package/dist/components/mg-progress.js +1 -1
  103. package/dist/components/mg-skip-links.js +1 -1
  104. package/dist/components/mg-table.js +1 -1
  105. package/dist/components/mg-tabs2.js +1 -1
  106. package/dist/components/mg-tag.js +1 -1
  107. package/dist/components/mg-tooltip-content2.js +1 -1
  108. package/dist/components/mg-tooltip2.js +1 -1
  109. package/dist/esm/index-DFwaH2hS.js +4 -0
  110. package/dist/esm/{index-D-uaxCxH.js → index-DSEloqPn.js} +8 -0
  111. package/dist/esm/loader.js +1 -1
  112. package/dist/esm/mg-action-more_37.entry.js +116 -137
  113. package/dist/esm/mg-alert.entry.js +1 -1
  114. package/dist/esm/mg-breadcrumb.entry.js +61 -0
  115. package/dist/esm/mg-components.js +1 -1
  116. package/dist/esm/mg-fieldset.entry.js +1 -1
  117. package/dist/esm/mg-input-combobox.entry.js +3 -3
  118. package/dist/esm/mg-input-file.entry.js +3 -3
  119. package/dist/esm/mg-input-rich-text-editor.entry.js +40057 -15794
  120. package/dist/esm/mg-loader.entry.js +2 -2
  121. package/dist/esm/mg-progress.entry.js +1 -1
  122. package/dist/mg-components/locales/en/messages.json +3 -0
  123. package/dist/mg-components/locales/fr/messages.json +3 -0
  124. package/dist/mg-components/mg-components.esm.js +1 -1
  125. package/dist/mg-components/p-0482eb9f.entry.js +1 -0
  126. package/dist/mg-components/{p-6b57f249.entry.js → p-2ee92f38.entry.js} +1 -1
  127. package/dist/mg-components/{p-c3d116b9.entry.js → p-3b653226.entry.js} +1 -1
  128. package/dist/mg-components/{p-dd1934f4.entry.js → p-5745fbea.entry.js} +1 -1
  129. package/dist/mg-components/p-DSEloqPn.js +1 -0
  130. package/dist/mg-components/{p-988c282e.entry.js → p-adec7fcc.entry.js} +1 -1
  131. package/dist/mg-components/p-c63f97f0.entry.js +1658 -0
  132. package/dist/mg-components/{p-4175dcbe.entry.js → p-c8c8cfc1.entry.js} +1 -1
  133. package/dist/mg-components/{p-6b655830.entry.js → p-cc793586.entry.js} +1 -1
  134. package/dist/mg-components/p-d5e69c95.entry.js +1 -0
  135. package/dist/types/assets/icons/index.d.ts +2 -0
  136. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +1 -1
  137. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.d.ts +17 -0
  138. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/index.d.ts +27 -19
  139. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.d.ts +3 -0
  140. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +48 -14
  141. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.conf.d.ts +0 -5
  142. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.d.ts +1 -6
  143. package/dist/types/components/molecules/menus/mg-menu/mg-menu.conf.d.ts +2 -10
  144. package/dist/types/components/molecules/menus/mg-menu/mg-menu.d.ts +7 -7
  145. package/dist/types/components/molecules/menus/mg-menu-item/mg-menu-item.d.ts +12 -8
  146. package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.d.ts +18 -0
  147. package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.d.ts +34 -0
  148. package/dist/types/components/molecules/mg-table/mg-table.d.ts +6 -0
  149. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +1 -9
  150. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +4 -4
  151. package/dist/types/components.d.ts +93 -38
  152. package/ide/intellij/web-types.json +139 -51
  153. package/ide/vscode/css-custom-data.json +10 -2
  154. package/ide/vscode/html-custom-data.json +111 -32
  155. package/package.json +20 -19
  156. package/dist/mg-components/p-08fa327b.entry.js +0 -1
  157. package/dist/mg-components/p-D-uaxCxH.js +0 -1
  158. package/dist/mg-components/p-a79b1f19.entry.js +0 -1
@@ -1 +1 @@
1
- import{transformTag as t,proxyCustomElement as i,HTMLElement as e,createEvent as s,h as a}from"@stencil/core/internal/client";import{C as n,d as r,t as o,i as h}from"./index2.js";import{a as l,c as m,b as p}from"./mg-input.conf.js";import{i as c}from"./index3.js";import{d as u}from"./mg-icon2.js";import{d}from"./mg-input2.js";import{d as g}from"./mg-input-title2.js";import{d as b}from"./mg-tooltip2.js";import{d as f}from"./mg-tooltip-content2.js";const v=t=>"object"==typeof t&&"string"==typeof t.title&&void 0!==t.value,y=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.valueChange=s(this,"value-change",7),this.inputValid=s(this,"input-valid",7),this.inputs=[],this.classVerticalList="mg-c-input--vertical-list",this.hasDisplayedError=!1,this.customErrorMessage={lock:!1},this.name=this.identifier,this.labelOnTop=!1,this.labelHide=!1,this.inputVerticalList=!1,this.required=!1,this.readonly=!1,this.disabled=!1,this.tooltipPosition="input",this.classCollection=new n(["mg-c-input--radio",l]),this.handleInput=t=>{this.checkValidity(),this.value=this.options[t.target.value].value},this.handleBlur=()=>{this.handlerInProgress="blur",this.checkValidity(),this.setErrorMessage(),this.handlerInProgress=void 0},this.checkValidity=()=>{this.setValidity(this.readonly||this.disabled||void 0===this.getInvalidElement())},this.setErrorMessage=(t=!1)=>{const i=this.getInvalidElement();this.errorMessage=void 0,this.valid||(t||this.customErrorMessage.lock&&void 0!==this.customErrorMessage.message?this.errorMessage=this.customErrorMessage.message:i.validity.valueMissing&&(this.errorMessage=this.messages.errors.required))},this.getInvalidElement=()=>this.inputs.find((t=>!t.disabled&&!t.readOnly&&!t.checkValidity()))}watchValue(t){var i;this.readonlyValue=r(this.items)&&"string"==typeof t?t:Array.isArray(this.items)&&this.items.every(v)?null===(i=this.items.find((i=>i.value===t)))||void 0===i?void 0:i.title:null,this.valueChange.emit(t)}validateItems(t){if("object"==typeof t&&t.length<2)throw Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${o(t)}.`);if(r(t))this.options=t.map((t=>({title:t,value:t,disabled:this.disabled})));else{if(!t||!t.every((t=>v(t))))throw Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${o(t)}.`);this.options=t}}watchInputVerticalList(t){t?this.classCollection.add(this.classVerticalList):this.classCollection.delete(this.classVerticalList)}watchReadonly(t){t?this.classCollection.add(m):this.classCollection.delete(m)}handleValidityChange(t,i,e){this.inputs.forEach((i=>{i[e]=t})),this.checkValidity(),this.hasDisplayedError&&(this.setErrorMessage(),this.hasDisplayedError=!1)}watchDisabled(t){t?this.classCollection.add(p):this.classCollection.delete(p)}async setFocus(){this.inputs.length>0&&this.inputs[0].focus()}displayError(){return new Promise((t=>{requestAnimationFrame((()=>{this.checkValidity(),this.setErrorMessage(),this.hasDisplayedError=this.invalid,t()}))}))}async setError(t,i,e=!1){if("boolean"!=typeof t)throw Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');if(void 0!==i&&!h(i))throw Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');this.customErrorMessage={lock:!t&&e,message:t?void 0:i},this.setValidity(t),this.setErrorMessage(!0),this.hasDisplayedError=this.invalid}async reset(){if(!this.readonly)return this.value=void 0,new Promise((t=>{requestAnimationFrame((()=>{this.customErrorMessage={lock:!1},this.checkValidity(),this.errorMessage=void 0,this.hasDisplayedError=!1,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=c(this.element).messages,this.validateItems(this.items),this.watchInputVerticalList(this.inputVerticalList),this.watchReadonly(this.readonly),this.watchDisabled(this.disabled),this.watchValue(this.value),setTimeout((()=>{this.checkValidity()}),0)}render(){return a("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&&a("b",{class:"mg-c-input__readonly-value"},this.readonlyValue):a("ul",{class:"mg-c-input__input-group-container",role:"list"},this.options.map(((t,i)=>a("li",{key:t.title,class:{"mg-c-input__input-group":!0,"mg-c-input__input-group--disabled":this.disabled||t.disabled}},a("input",{type:"radio",id:this.identifier+"_"+i,name:this.identifier,value:i,checked:JSON.stringify(this.value)===JSON.stringify(this.options[i].value),disabled:this.disabled||t.disabled,required:this.required,onBlur:this.handleBlur,onInput:this.handleInput,ref:t=>{null!==t&&(this.inputs[i]=t)}}),a("label",{htmlFor:this.identifier+"_"+i},t.title))))))}get element(){return this}static get watchers(){return{value:[{watchValue:0}],items:[{validateItems:0}],inputVerticalList:[{watchInputVerticalList:0}],readonly:[{watchReadonly:0},{handleValidityChange:0}],required:[{handleValidityChange:0}],disabled:[{handleValidityChange:0},{watchDisabled:0}]}}static get style(){return".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-c-input.mg-c-input--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-c-input-check-size);height:var(--mg-c-input-check-size);flex-shrink:0;margin:calc((var(--mg-b-font-size)*var(--mg-b-line-height) - var(--mg-c-input-check-size))/2) var(--mg-b-size-8) 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);gap:var(--mg-b-size-12) var(--mg-b-size-24);list-style:none}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group.mg-c-input__input-group--disabled label{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:var(--mg-b-size-8)}.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}"}},[1,"mg-input-radio",{value:[1032],items:[16],identifier:[1],name:[1],label:[1],labelOnTop:[4,"label-on-top"],labelHide:[4,"label-hide"],inputVerticalList:[4,"input-vertical-list"],required:[4],readonly:[4],disabled:[4],tooltip:[1],tooltipPosition:[1,"tooltip-position"],helpText:[1,"help-text"],valid:[1028],invalid:[1028],classCollection:[32],errorMessage:[32],options:[32],readonlyValue:[32],setFocus:[64],displayError:[64],setError:[64],reset:[64]},void 0,{value:[{watchValue:0}],items:[{validateItems:0}],inputVerticalList:[{watchInputVerticalList:0}],readonly:[{watchReadonly:0},{handleValidityChange:0}],required:[{handleValidityChange:0}],disabled:[{handleValidityChange:0},{watchDisabled:0}]}]);function w(){"undefined"!=typeof customElements&&["mg-input-radio","mg-icon","mg-input","mg-input-title","mg-tooltip","mg-tooltip-content"].forEach((i=>{switch(i){case"mg-input-radio":customElements.get(t(i))||customElements.define(t(i),y);break;case"mg-icon":customElements.get(t(i))||u();break;case"mg-input":customElements.get(t(i))||d();break;case"mg-input-title":customElements.get(t(i))||g();break;case"mg-tooltip":customElements.get(t(i))||b();break;case"mg-tooltip-content":customElements.get(t(i))||f()}}))}w();const _=y,E=w;export{_ as MgInputRadio,E as defineCustomElement}
1
+ import{transformTag as t,proxyCustomElement as i,HTMLElement as e,createEvent as s,h as n}from"@stencil/core/internal/client";import{C as a,d as r,t as o,i as h}from"./index2.js";import{a as l,c as m,b as p}from"./mg-input.conf.js";import{i as c}from"./index3.js";import{d as u}from"./mg-icon2.js";import{d}from"./mg-input2.js";import{d as g}from"./mg-input-title2.js";import{d as b}from"./mg-tooltip2.js";import{d as v}from"./mg-tooltip-content2.js";const f=t=>"object"==typeof t&&"string"==typeof t.title&&void 0!==t.value,y=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.valueChange=s(this,"value-change",7),this.inputValid=s(this,"input-valid",7),this.inputs=[],this.classVerticalList="mg-c-input--vertical-list",this.hasDisplayedError=!1,this.customErrorMessage={lock:!1},this.name=this.identifier,this.labelOnTop=!1,this.labelHide=!1,this.inputVerticalList=!1,this.required=!1,this.readonly=!1,this.disabled=!1,this.tooltipPosition="input",this.classCollection=new a(["mg-c-input--radio",l]),this.handleInput=t=>{this.checkValidity(),this.value=this.options[t.target.value].value},this.handleBlur=()=>{this.handlerInProgress="blur",this.checkValidity(),this.setErrorMessage(),this.handlerInProgress=void 0},this.checkValidity=()=>{this.setValidity(this.readonly||this.disabled||void 0===this.getInvalidElement())},this.setErrorMessage=(t=!1)=>{const i=this.getInvalidElement();this.errorMessage=void 0,this.valid||(t||this.customErrorMessage.lock&&void 0!==this.customErrorMessage.message?this.errorMessage=this.customErrorMessage.message:i.validity.valueMissing&&(this.errorMessage=this.messages.errors.required))},this.getInvalidElement=()=>this.inputs.find((t=>!t.disabled&&!t.readOnly&&!t.checkValidity()))}watchValue(t){var i;this.readonlyValue=r(this.items)&&"string"==typeof t?t:Array.isArray(this.items)&&this.items.every(f)?null===(i=this.items.find((i=>i.value===t)))||void 0===i?void 0:i.title:null,this.valueChange.emit(t)}validateItems(t){if("object"==typeof t&&t.length<2)throw Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${o(t)}.`);if(r(t))this.options=t.map((t=>({title:t,value:t,disabled:this.disabled})));else{if(!t||!t.every((t=>f(t))))throw Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${o(t)}.`);this.options=t}}watchInputVerticalList(t){t?this.classCollection.add(this.classVerticalList):this.classCollection.delete(this.classVerticalList)}watchReadonly(t){t?this.classCollection.add(m):this.classCollection.delete(m)}handleValidityChange(t,i,e){this.inputs.forEach((i=>{i[e]=t})),this.checkValidity(),this.hasDisplayedError&&(this.setErrorMessage(),this.hasDisplayedError=!1)}watchDisabled(t){t?this.classCollection.add(p):this.classCollection.delete(p)}async setFocus(){this.inputs.length>0&&this.inputs[0].focus()}displayError(){return new Promise((t=>{requestAnimationFrame((()=>{this.checkValidity(),this.setErrorMessage(),this.hasDisplayedError=this.invalid,t()}))}))}async setError(t,i,e=!1){if("boolean"!=typeof t)throw Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');if(void 0!==i&&!h(i))throw Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');this.customErrorMessage={lock:!t&&e,message:t?void 0:i},this.setValidity(t),this.setErrorMessage(!0),this.hasDisplayedError=this.invalid}async reset(){if(!this.readonly)return this.value=void 0,new Promise((t=>{requestAnimationFrame((()=>{this.customErrorMessage={lock:!1},this.checkValidity(),this.errorMessage=void 0,this.hasDisplayedError=!1,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=c(this.element).messages,this.validateItems(this.items),this.watchInputVerticalList(this.inputVerticalList),this.watchReadonly(this.readonly),this.watchDisabled(this.disabled),this.watchValue(this.value),setTimeout((()=>{this.checkValidity()}),0)}render(){return n("mg-input",{key:"bdeb5a98bc7f4567beb293c1fcf4f99169089fa6",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&&n("b",{class:"mg-c-input__readonly-value"},this.readonlyValue):n("div",{class:"mg-c-input__input-group-container"},this.options.map(((t,i)=>n("div",{key:t.title,class:{"mg-c-input__input-group":!0,"mg-c-input__input-group--disabled":this.disabled||t.disabled}},n("input",{type:"radio",id:this.identifier+"_"+i,name:this.identifier,value:i,checked:JSON.stringify(this.value)===JSON.stringify(this.options[i].value),disabled:this.disabled||t.disabled,required:this.required,onBlur:this.handleBlur,onInput:this.handleInput,ref:t=>{null!==t&&(this.inputs[i]=t)}}),n("label",{htmlFor:this.identifier+"_"+i},t.title))))))}get element(){return this}static get watchers(){return{value:[{watchValue:0}],items:[{validateItems:0}],inputVerticalList:[{watchInputVerticalList:0}],readonly:[{watchReadonly:0},{handleValidityChange:0}],required:[{handleValidityChange:0}],disabled:[{handleValidityChange:0},{watchDisabled:0}]}}static get style(){return".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-c-input.mg-c-input--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-c-input-check-size);height:var(--mg-c-input-check-size);flex-shrink:0;margin:calc((var(--mg-b-font-size)*var(--mg-b-line-height) - var(--mg-c-input-check-size))/2) var(--mg-b-size-8) 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);gap:var(--mg-b-size-12) var(--mg-b-size-24);list-style:none}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group.mg-c-input__input-group--disabled label{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:var(--mg-b-size-8)}.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}"}},[1,"mg-input-radio",{value:[1032],items:[16],identifier:[1],name:[1],label:[1],labelOnTop:[4,"label-on-top"],labelHide:[4,"label-hide"],inputVerticalList:[4,"input-vertical-list"],required:[4],readonly:[4],disabled:[4],tooltip:[1],tooltipPosition:[1,"tooltip-position"],helpText:[1,"help-text"],valid:[1028],invalid:[1028],classCollection:[32],errorMessage:[32],options:[32],readonlyValue:[32],setFocus:[64],displayError:[64],setError:[64],reset:[64]},void 0,{value:[{watchValue:0}],items:[{validateItems:0}],inputVerticalList:[{watchInputVerticalList:0}],readonly:[{watchReadonly:0},{handleValidityChange:0}],required:[{handleValidityChange:0}],disabled:[{handleValidityChange:0},{watchDisabled:0}]}]);function w(){"undefined"!=typeof customElements&&["mg-input-radio","mg-icon","mg-input","mg-input-title","mg-tooltip","mg-tooltip-content"].forEach((i=>{switch(i){case"mg-input-radio":customElements.get(t(i))||customElements.define(t(i),y);break;case"mg-icon":customElements.get(t(i))||u();break;case"mg-input":customElements.get(t(i))||d();break;case"mg-input-title":customElements.get(t(i))||g();break;case"mg-tooltip":customElements.get(t(i))||b();break;case"mg-tooltip-content":customElements.get(t(i))||v()}}))}w();const _=y,E=w;export{_ as MgInputRadio,E as defineCustomElement}