@mgdis/mg-components 6.12.0 → 6.13.1

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 (120) hide show
  1. package/dist/cjs/{index-DyUB3KmT.js → index-CwjAofQ1.js} +3 -3
  2. package/dist/cjs/{index-DyUB3KmT.js.map → index-CwjAofQ1.js.map} +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/mg-action-more_37.cjs.entry.js +229 -57
  5. package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
  6. package/dist/cjs/mg-alert.cjs.entry.js +1 -1
  7. package/dist/cjs/mg-components.cjs.js +1 -1
  8. package/dist/cjs/mg-input-combobox.cjs.entry.js +39 -17
  9. package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -1
  10. package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -1
  11. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +35 -17
  12. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js.map +1 -1
  13. package/dist/cjs/mg-input-rich-text-editor.entry.cjs.js.map +1 -1
  14. package/dist/cjs/mg-loader.cjs.entry.js +1 -1
  15. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -1
  16. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  17. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +49 -6
  18. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  19. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +38 -16
  20. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js.map +1 -1
  21. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +39 -5
  22. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  23. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +41 -6
  24. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +39 -4
  26. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +40 -4
  28. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  29. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +51 -16
  30. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js.map +1 -1
  31. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +39 -4
  32. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  33. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +19 -7
  34. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +39 -4
  36. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  37. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +40 -6
  38. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  39. package/dist/collection/components/molecules/mg-form/mg-form.js +23 -1
  40. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  41. package/dist/components/index3.js +1 -1
  42. package/dist/components/index3.js.map +1 -1
  43. package/dist/components/mg-form.js +9 -1
  44. package/dist/components/mg-form.js.map +1 -1
  45. package/dist/components/mg-input-checkbox-paginated2.js +2 -1
  46. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  47. package/dist/components/mg-input-checkbox.js +34 -7
  48. package/dist/components/mg-input-checkbox.js.map +1 -1
  49. package/dist/components/mg-input-combobox.js +38 -16
  50. package/dist/components/mg-input-combobox.js.map +1 -1
  51. package/dist/components/mg-input-date.js +24 -6
  52. package/dist/components/mg-input-date.js.map +1 -1
  53. package/dist/components/mg-input-numeric.js +24 -5
  54. package/dist/components/mg-input-numeric.js.map +1 -1
  55. package/dist/components/mg-input-password.js +24 -5
  56. package/dist/components/mg-input-password.js.map +1 -1
  57. package/dist/components/mg-input-radio.js +25 -5
  58. package/dist/components/mg-input-radio.js.map +1 -1
  59. package/dist/components/mg-input-rich-text-editor.js +35 -16
  60. package/dist/components/mg-input-rich-text-editor.js.map +1 -1
  61. package/dist/components/mg-input-select2.js +24 -5
  62. package/dist/components/mg-input-select2.js.map +1 -1
  63. package/dist/components/mg-input-text2.js +19 -7
  64. package/dist/components/mg-input-text2.js.map +1 -1
  65. package/dist/components/mg-input-textarea.js +24 -5
  66. package/dist/components/mg-input-textarea.js.map +1 -1
  67. package/dist/components/mg-input-toggle.js +25 -7
  68. package/dist/components/mg-input-toggle.js.map +1 -1
  69. package/dist/components/mg-popover-content2.js +1 -1
  70. package/dist/components/mg-popover-content2.js.map +1 -1
  71. package/dist/components/mg-table.js +1 -1
  72. package/dist/components/mg-table.js.map +1 -1
  73. package/dist/esm/{index-CwZ2wzxw.js → index-Bv7NHR-W.js} +3 -3
  74. package/dist/esm/{index-CwZ2wzxw.js.map → index-Bv7NHR-W.js.map} +1 -1
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/mg-action-more_37.entry.js +229 -57
  77. package/dist/esm/mg-action-more_37.entry.js.map +1 -1
  78. package/dist/esm/mg-alert.entry.js +1 -1
  79. package/dist/esm/mg-components.js +1 -1
  80. package/dist/esm/mg-input-combobox.entry.js +39 -17
  81. package/dist/esm/mg-input-combobox.entry.js.map +1 -1
  82. package/dist/esm/mg-input-rich-text-editor.entry.js +35 -17
  83. package/dist/esm/mg-input-rich-text-editor.entry.js.map +1 -1
  84. package/dist/esm/mg-loader.entry.js +1 -1
  85. package/dist/mg-components/mg-components.esm.js +1 -1
  86. package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -1
  87. package/dist/mg-components/mg-input-rich-text-editor.entry.esm.js.map +1 -1
  88. package/dist/mg-components/{p-3853afb5.entry.js → p-19cbc6e6.entry.js} +3 -3
  89. package/dist/mg-components/p-19cbc6e6.entry.js.map +1 -0
  90. package/dist/mg-components/p-269e2a80.entry.js +2 -0
  91. package/dist/mg-components/p-269e2a80.entry.js.map +1 -0
  92. package/dist/mg-components/p-2dea7d37.entry.js +2 -0
  93. package/dist/mg-components/p-2dea7d37.entry.js.map +1 -0
  94. package/dist/mg-components/{p-da1e7950.entry.js → p-415f14fb.entry.js} +2 -2
  95. package/dist/mg-components/{p-CwZ2wzxw.js → p-Bv7NHR-W.js} +2 -2
  96. package/dist/mg-components/{p-CwZ2wzxw.js.map → p-Bv7NHR-W.js.map} +1 -1
  97. package/dist/mg-components/{p-d711941b.entry.js → p-fe974d2b.entry.js} +2 -2
  98. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -0
  99. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +1 -1
  100. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -0
  101. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +6 -2
  102. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -0
  103. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -0
  104. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -0
  105. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -0
  106. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +1 -1
  107. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -0
  108. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +9 -4
  109. package/dist/types/components/molecules/mg-form/mg-form.d.ts +4 -0
  110. package/dist/types/components.d.ts +47 -6
  111. package/ide/intellij/web-types.json +21 -17
  112. package/ide/vscode/html-custom-data.json +14 -14
  113. package/package.json +17 -22
  114. package/dist/mg-components/p-3853afb5.entry.js.map +0 -1
  115. package/dist/mg-components/p-5a05b1da.entry.js +0 -2
  116. package/dist/mg-components/p-5a05b1da.entry.js.map +0 -1
  117. package/dist/mg-components/p-74b5112a.entry.js +0 -2
  118. package/dist/mg-components/p-74b5112a.entry.js.map +0 -1
  119. /package/dist/mg-components/{p-da1e7950.entry.js.map → p-415f14fb.entry.js.map} +0 -0
  120. /package/dist/mg-components/{p-d711941b.entry.js.map → p-fe974d2b.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{r as e,h as t,g as a}from"./p-CAuxALt5.js";import{i}from"./p-CwZ2wzxw.js";import{c as r,t as s}from"./p-Dr7GYvIz.js";const o=".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}}:host{display:block}.mg-c-loader{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--mg-b-size-4);text-align:center}";const n=class{constructor(t){e(this,t);this.messageHide=false}watchMessage(e){if(e&&!r(e))throw new Error(`<mg-loader> prop "message" must be a valid string. Passed value: ${s(e)}.`)}componentWillLoad(){this.messages=i(this.element).messages;this.watchMessage(this.message)}render(){return t("div",{key:"ad7aa5e4fa0704cf2fa174ae1ed960f72deb79e3",class:"mg-c-loader","aria-live":"polite"},t("mg-icon",{key:"47e6df1e459a74851bf370e460438b7bdc2ed3d0",icon:"loader",spin:true}),t("span",{key:"44d36e8492401cacb911f21fc707c1de03ae7a5d",class:{"mg-u-visually-hidden":this.messageHide}},this.message||this.messages.loader.inProgress))}get element(){return a(this)}static get watchers(){return{message:["watchMessage"]}}};n.style=o;export{n as mg_loader};
2
- //# sourceMappingURL=p-da1e7950.entry.js.map
1
+ import{r as e,h as t,g as a}from"./p-CAuxALt5.js";import{i}from"./p-Bv7NHR-W.js";import{c as r,t as s}from"./p-Dr7GYvIz.js";const o=".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}}:host{display:block}.mg-c-loader{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--mg-b-size-4);text-align:center}";const n=class{constructor(t){e(this,t);this.messageHide=false}watchMessage(e){if(e&&!r(e))throw new Error(`<mg-loader> prop "message" must be a valid string. Passed value: ${s(e)}.`)}componentWillLoad(){this.messages=i(this.element).messages;this.watchMessage(this.message)}render(){return t("div",{key:"ad7aa5e4fa0704cf2fa174ae1ed960f72deb79e3",class:"mg-c-loader","aria-live":"polite"},t("mg-icon",{key:"47e6df1e459a74851bf370e460438b7bdc2ed3d0",icon:"loader",spin:true}),t("span",{key:"44d36e8492401cacb911f21fc707c1de03ae7a5d",class:{"mg-u-visually-hidden":this.messageHide}},this.message||this.messages.loader.inProgress))}get element(){return a(this)}static get watchers(){return{message:["watchMessage"]}}};n.style=o;export{n as mg_loader};
2
+ //# sourceMappingURL=p-415f14fb.entry.js.map
@@ -1,2 +1,2 @@
1
- const e={required:"This field is required."};const t="{counter} characters left.";const a={select:{placeholder:"Select a value"},checkbox:{selectedValues:"{nb} selected values",selectedValue:"{nb} selected value",editButton:"Edit",selectButton:"Select values",showButton:"Show",label:"Enter a value",result:"result",results:"results",searchResults:"Search result(s) list.",noResult:"No result.",sections:{selected:{title:"Selected",titlePlural:"Selected",action:"Unselect all",tooltip:"Unselect all current search results"},notSelected:{title:"Not selected",titlePlural:"Not selected",action:"Select all",tooltip:"Select all current search results"}}},date:{pattern:{dd:"dd",mm:"mm",yyyy:"yyyy"},helpText:{expectedFormat:"Expected format: {pattern} (ex: {date})",min:"The date must be after or equal to {min}",max:"The date must be before or equal to {max}",minMax:"The date must be between {min} and {max}"},error:{badInput:"The date is inexistent or incorrect, the expected format is {pattern} (ex: {date})"}},numeric:{helpText:{min:"The value must be greater than or equal to {min}",max:"The value must be less than or equal to {max}",minMax:"The value must be between {min} and {max}"}},password:{display:"Display password value",hide:"Hide password value"},combobox:{notFound:"No elements match your input",notAvailable:"No elements available",loadMore:"Load more",search:"Search…"},text:{helpText:{email:"Expected format: name@example.com",emails:"Expected format: first@example.com, second@example.com",url:"Expected format: https://example.com"},errors:{typeMismatch:{email:"The value is incorrect, the expected format is name@example.com",emails:"The value is incorrect, the expected format is first@example.com, second@example.com",url:"The value is incorrect, the expected format is https://example.com"}}}};const s={required:'Fields with a <strong class="mg-u-is-asterisk">*</strong> are required',requiredSingle:'Field with a <strong class="mg-u-is-asterisk">*</strong> is required',allRequired:"All fields are required",allRequiredSingle:"The field is required"};const n={closeButton:"Close message"};const l={closeButton:"Close modal"};const r={label:"Pagination",page:"page",pages:"pages",nextLabel:"Next page",previousLabel:"Previous page",selectPage:"Select the page to display."};const o={editLabel:"Edit section title."};const i={navLabel:"Quick access"};const c={confirm:"Confirm",cancel:"Cancel",close:"Close",next:"next",previous:"previous",reset:"reset"};const u={badgeLabel:"Include notification(s)",openNewTab:"Open link in a new tab"};const m={menuLabel:"Additional menu"};const d={label:"Actions"};const p={inProgress:"Loading in progress…"};const h={sortableCaption:"(column headers with buttons are sortable)"};var b={errors:e,nbCharLeft:t,input:a,form:s,alert:n,modal:l,pagination:r,panel:o,skipLinks:i,general:c,menuItem:u,itemMore:m,actionMore:d,loader:p,table:h};const g={required:"Ce champ est obligatoire."};const x="{counter} caractères disponibles.";const f={select:{placeholder:"Sélectionnez une valeur"},checkbox:{selectedValues:"{nb} valeurs sélectionnées",selectedValue:"{nb} valeur sélectionnée",editButton:"Modifier",selectButton:"Sélectionner des valeurs",showButton:"Voir",label:"Saisissez une valeur",result:"résultat",results:"résultats",searchResults:"Liste de résultat(s) de la recherche.",noResult:"Aucun résultat.",sections:{selected:{title:"Sélectionné",titlePlural:"Sélectionnés",action:"Tout désélectionner",tooltip:"Désélectionne tous les résultats de la recherche en cours"},notSelected:{title:"Non sélectionné",titlePlural:"Non sélectionnés",action:"Tout sélectionner",tooltip:"Sélectionne tous les résultats de la recherche en cours"}}},date:{pattern:{dd:"jj",mm:"mm",yyyy:"aaaa"},helpText:{expectedFormat:"Format attendu&nbsp;: {pattern} (ex&nbsp;: {date})",min:"La date doit être postérieure ou égale au {min}",max:"La date doit être antérieure ou égale au {max}",minMax:"La date doit être comprise entre le {min} et le {max}"},error:{badInput:"La date est inexistante ou incorrecte, le format attendu est {pattern} (ex&nbsp;: {date})"}},numeric:{helpText:{min:"La valeur doit être supérieure ou égale à {min}",max:"La valeur doit être inférieure ou égale à {max}",minMax:"La valeur doit être comprise entre {min} et {max}"}},password:{display:"Afficher le mot de passe",hide:"Masquer le mot de passe"},combobox:{notFound:"Aucun élément ne correspondont a votre saisie",notAvailable:"Aucun élément disponible",loadMore:"Afficher plus",search:"Recherche…"},text:{helpText:{email:"Format attendu&nbsp;: nom@exemple.fr",emails:"Format attendu&nbsp;: premier@exemple.fr, second@exemple.fr",url:"Format attendu&nbsp;: https://exemple.fr"},errors:{typeMismatch:{email:"La valeur est incorrecte, le format attendu est nom@exemple.fr",emails:"La valeur est incorrecte, le format attendu est premier@exemple.fr, second@exemple.fr",url:"La valeur est incorrecte, le format attendu est https://exemple.fr"}}}};const v={required:'Les champs marqués d\'un <strong class="mg-u-is-asterisk">*</strong> sont obligatoires',requiredSingle:'Le champ marqué d\'un <strong class="mg-u-is-asterisk">*</strong> est obligatoire',allRequired:"Tous les champs sont obligatoires",allRequiredSingle:"Le champ est obligatoire"};const L={closeButton:"Fermer le message"};const y={closeButton:"Fermer la modale"};const T={label:"Pagination",page:"page",pages:"pages",nextLabel:"Page suivante",previousLabel:"Page précédente",selectPage:"Sélectionner la page à afficher."};const S={editLabel:"Modifier le titre de la section."};const q={navLabel:"Accès rapide"};const w={confirm:"Valider",cancel:"Annuler",close:"Fermer",next:"suivant",previous:"précédent",reset:"réinitialiser"};const F={badgeLabel:"Notification(s) incluse(s)",openNewTab:"Ouvrir le lien dans un nouvel onglet"};const M={menuLabel:"Menu complémentaire"};const A={label:"Actions"};const P={inProgress:"Chargement en cours…"};const k={sortableCaption:"(les en-têtes de colonnes avec des boutons peuvent être triés)"};var C={errors:g,nbCharLeft:x,input:f,form:v,alert:L,modal:y,pagination:T,panel:S,skipLinks:q,general:w,menuItem:F,itemMore:M,actionMore:A,loader:P,table:k};const N=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;const I=e=>{const t={value:"2023",pattern:"yyyy"};const a={value:"12",pattern:"mm"};const s={value:"24",pattern:"dd"};return j([t.value,a.value,s.value].join("-"),e,{timeZone:"UTC"}).replace(t.value,t.pattern).replace(a.value,a.pattern).replace(s.value,s.pattern)};const B=(e,t,a)=>{const s=e.closest("[lang]");const n=Intl.NumberFormat.supportedLocalesOf(s?.lang);const l=n.length>0&&typeof n[0]==="string"?n[0]:navigator.language||a;const r=l.split("-").shift();if(Object.keys(t).length===0){return{locale:l,messages:{lang:a}}}return{locale:l,messages:t[r]||t[a]||{lang:a}}};const D=(e,t,a)=>new Intl.NumberFormat(t,{style:"currency",currency:a}).format(e);const R=(e,t,a=0)=>new Intl.NumberFormat(t,{minimumFractionDigits:a}).format(Number(e));const E=(e,t,a=0)=>new Intl.NumberFormat(t,{style:"percent",minimumFractionDigits:a,maximumFractionDigits:a}).format(e);const V=(e,t,a,s="short",n=0)=>new Intl.NumberFormat(t,{style:"unit",unit:a,unitDisplay:s,minimumFractionDigits:n,maximumFractionDigits:n}).format(e);const j=(e,t,a)=>typeof e!=="string"||e===""||!N.test(e)?"":new Intl.DateTimeFormat(t,a).format(new Date(e));const O=(e,t)=>a=>B(a,e,t);const U="en";const z={en:b,fr:C};const H=O(z,U);export{I as a,R as b,V as c,E as d,D as e,H as i,j as l};
2
- //# sourceMappingURL=p-CwZ2wzxw.js.map
1
+ const e={required:"This field is required."};const t="{counter} characters left.";const a={select:{placeholder:"Select a value"},checkbox:{selectedValues:"{nb} selected values",selectedValue:"{nb} selected value",editButton:"Edit",selectButton:"Select values",showButton:"Show",label:"Enter a value",result:"result",results:"results",searchResults:"Search result(s) list.",noResult:"No result.",sections:{selected:{title:"Selected",titlePlural:"Selected",action:"Unselect all",tooltip:"Unselect all current search results"},notSelected:{title:"Not selected",titlePlural:"Not selected",action:"Select all",tooltip:"Select all current search results"}}},date:{pattern:{dd:"dd",mm:"mm",yyyy:"yyyy"},helpText:{expectedFormat:"Expected format: {pattern} (ex: {date})",min:"The date must be after or equal to {min}",max:"The date must be before or equal to {max}",minMax:"The date must be between {min} and {max}"},error:{badInput:"The date is inexistent or incorrect, the expected format is {pattern} (ex: {date})"}},numeric:{helpText:{min:"The value must be greater than or equal to {min}",max:"The value must be less than or equal to {max}",minMax:"The value must be between {min} and {max}"}},password:{display:"Display password value",hide:"Hide password value"},combobox:{notFound:"No elements match your input",notAvailable:"No elements available",loadMore:"Load more",search:"Search…"},text:{helpText:{email:"Expected format: name@example.com",emails:"Expected format: first@example.com, second@example.com",url:"Expected format: https://example.com"},errors:{typeMismatch:{email:"The value is incorrect, the expected format is name@example.com",emails:"The value is incorrect, the expected format is first@example.com, second@example.com",url:"The value is incorrect, the expected format is https://example.com"}}}};const s={required:'Fields with a <strong class="mg-u-is-asterisk">*</strong> are required',requiredSingle:'Field with a <strong class="mg-u-is-asterisk">*</strong> is required',allRequired:"All fields are required",allRequiredSingle:"The field is required"};const n={closeButton:"Close message"};const l={closeButton:"Close modal"};const r={label:"Pagination",page:"page",pages:"pages",nextLabel:"Next page",previousLabel:"Previous page",selectPage:"Select the page to display."};const o={editLabel:"Edit section title."};const i={navLabel:"Quick access"};const c={confirm:"Confirm",cancel:"Cancel",close:"Close",next:"next",previous:"previous",reset:"reset"};const u={badgeLabel:"Include notification(s)",openNewTab:"Open link in a new tab"};const m={menuLabel:"Additional menu"};const d={label:"Actions"};const p={inProgress:"Loading in progress…"};const h={sortableCaption:"(column headers with buttons are sortable)"};var b={errors:e,nbCharLeft:t,input:a,form:s,alert:n,modal:l,pagination:r,panel:o,skipLinks:i,general:c,menuItem:u,itemMore:m,actionMore:d,loader:p,table:h};const g={required:"Ce champ est obligatoire."};const x="{counter} caractères disponibles.";const f={select:{placeholder:"Sélectionnez une valeur"},checkbox:{selectedValues:"{nb} valeurs sélectionnées",selectedValue:"{nb} valeur sélectionnée",editButton:"Modifier",selectButton:"Sélectionner des valeurs",showButton:"Voir",label:"Saisissez une valeur",result:"résultat",results:"résultats",searchResults:"Liste de résultat(s) de la recherche.",noResult:"Aucun résultat.",sections:{selected:{title:"Sélectionné",titlePlural:"Sélectionnés",action:"Tout désélectionner",tooltip:"Désélectionne tous les résultats de la recherche en cours"},notSelected:{title:"Non sélectionné",titlePlural:"Non sélectionnés",action:"Tout sélectionner",tooltip:"Sélectionne tous les résultats de la recherche en cours"}}},date:{pattern:{dd:"jj",mm:"mm",yyyy:"aaaa"},helpText:{expectedFormat:"Format attendu&nbsp;: {pattern} (ex&nbsp;: {date})",min:"La date doit être postérieure ou égale au {min}",max:"La date doit être antérieure ou égale au {max}",minMax:"La date doit être comprise entre le {min} et le {max}"},error:{badInput:"La date est inexistante ou incorrecte, le format attendu est {pattern} (ex&nbsp;: {date})"}},numeric:{helpText:{min:"La valeur doit être supérieure ou égale à {min}",max:"La valeur doit être inférieure ou égale à {max}",minMax:"La valeur doit être comprise entre {min} et {max}"}},password:{display:"Afficher le mot de passe",hide:"Masquer le mot de passe"},combobox:{notFound:"Aucun élément ne correspondont a votre saisie",notAvailable:"Aucun élément disponible",loadMore:"Afficher plus",search:"Recherche…"},text:{helpText:{email:"Format attendu&nbsp;: nom@exemple.fr",emails:"Format attendu&nbsp;: premier@exemple.fr, second@exemple.fr",url:"Format attendu&nbsp;: https://exemple.fr"},errors:{typeMismatch:{email:"La valeur est incorrecte, le format attendu est nom@exemple.fr",emails:"La valeur est incorrecte, le format attendu est premier@exemple.fr, second@exemple.fr",url:"La valeur est incorrecte, le format attendu est https://exemple.fr"}}}};const v={required:'Les champs marqués d\'un <strong class="mg-u-is-asterisk">*</strong> sont obligatoires',requiredSingle:'Le champ marqué d\'un <strong class="mg-u-is-asterisk">*</strong> est obligatoire',allRequired:"Tous les champs sont obligatoires",allRequiredSingle:"Le champ est obligatoire"};const L={closeButton:"Fermer le message"};const y={closeButton:"Fermer la modale"};const T={label:"Pagination",page:"page",pages:"pages",nextLabel:"Page suivante",previousLabel:"Page précédente",selectPage:"Sélectionner la page à afficher."};const S={editLabel:"Modifier le titre de la section."};const q={navLabel:"Accès rapide"};const w={confirm:"Valider",cancel:"Annuler",close:"Fermer",next:"suivant",previous:"précédent",reset:"réinitialiser"};const F={badgeLabel:"Notification(s) incluse(s)",openNewTab:"Ouvrir le lien dans un nouvel onglet"};const M={menuLabel:"Menu complémentaire"};const A={label:"Actions"};const P={inProgress:"Chargement en cours…"};const k={sortableCaption:"(les en-têtes de colonnes avec des boutons peuvent être triés)"};var C={errors:g,nbCharLeft:x,input:f,form:v,alert:L,modal:y,pagination:T,panel:S,skipLinks:q,general:w,menuItem:F,itemMore:M,actionMore:A,loader:P,table:k};const N=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;const I=e=>{const t={value:"2023",pattern:"yyyy"};const a={value:"12",pattern:"mm"};const s={value:"24",pattern:"dd"};return j([t.value,a.value,s.value].join("-"),e,{timeZone:"UTC"}).replace(t.value,t.pattern).replace(a.value,a.pattern).replace(s.value,s.pattern)};const B=(e,t,a)=>{const s=e.closest("[lang]");const n=Intl.NumberFormat.supportedLocalesOf(s?.lang);const l=n.length>0&&typeof n[0]==="string"?n[0]:navigator.language||a;const r=l.split("-").shift();if(Object.keys(t).length===0){return{locale:l,messages:{lang:a}}}return{locale:l,messages:t[r]??t[a]??{lang:a}}};const D=(e,t,a)=>new Intl.NumberFormat(t,{style:"currency",currency:a}).format(e);const R=(e,t,a=0)=>new Intl.NumberFormat(t,{minimumFractionDigits:a}).format(Number(e));const E=(e,t,a=0)=>new Intl.NumberFormat(t,{style:"percent",minimumFractionDigits:a,maximumFractionDigits:a}).format(e);const V=(e,t,a,s="short",n=0)=>new Intl.NumberFormat(t,{style:"unit",unit:a,unitDisplay:s,minimumFractionDigits:n,maximumFractionDigits:n}).format(e);const j=(e,t,a)=>typeof e!=="string"||e===""||!N.test(e)?"":new Intl.DateTimeFormat(t,a).format(new Date(e));const O=(e,t)=>a=>B(a,e,t);const U="en";const z={en:b,fr:C};const H=O(z,U);export{I as a,R as b,V as c,E as d,D as e,H as i,j as l};
2
+ //# sourceMappingURL=p-Bv7NHR-W.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"p-CwZ2wzxw.js","sources":["../helpers/dist/locale/index.js","src/locales/index.ts"],"sourcesContent":["/**\n * Date RegExp, usefull to test if string is a follow the date pattern\n * @example\n * ```ts\n * dateRegExp.test('mystring') // false\n * dateRegExp.test('2020-12-31') // true\n * ```\n */\nconst dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n\n/**\n * Gets the date pattern based on the specified locale.\n * @param locale - the locale to refer to\n * @returns date pattern\n * @example\n * ```ts\n * localeDatePattern('fr') // 'dd/mm/yyyy'\n * ```\n */\nconst localeDatePattern = (locale) => {\n const year = { value: '2023', pattern: 'yyyy' };\n const month = { value: '12', pattern: 'mm' };\n const day = { value: '24', pattern: 'dd' };\n return localeDate([year.value, month.value, day.value].join('-'), locale, { timeZone: 'UTC' })\n .replace(year.value, year.pattern)\n .replace(month.value, month.pattern)\n .replace(day.value, day.pattern);\n};\n/**\n * Get locale and messages\n * We load the defined locale but for now we only support the first subtag for messages\n * @param element - element we need to get the language\n * @param messages - messages to use\n * @param defaultLocale - default messages locale\n * @returns messages object\n */\nconst localeMessages = (element, messages, defaultLocale) => {\n // Get local\n const closestLangAttribute = element.closest('[lang]');\n const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);\n const locale = closestLang.length > 0 && typeof closestLang[0] === 'string' ? closestLang[0] : navigator.language || defaultLocale;\n // Only keep first subtag\n const localeSubtag = locale.split('-').shift();\n // If messages is empty, return a default object\n if (Object.keys(messages).length === 0) {\n return {\n locale,\n messages: { lang: defaultLocale },\n };\n }\n // Return\n return {\n locale,\n messages: (messages[localeSubtag] || messages[defaultLocale] || { lang: defaultLocale }),\n };\n};\n/**\n * Format number to the locale currency\n * @param number - number to format\n * @param locale - locale to apply\n * @param currency - currency to apply\n * @returns formatted currency\n * @example\n * ```ts\n * localeCurrency(1234567890.12, 'fr', 'EUR') // '1 234 567 890,12\\xa0€'\n * ```\n */\nconst localeCurrency = (number, locale, currency) => new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);\n/**\n * Format number to locale\n * @param number - number to format\n * @param locale - locale to apply\n * @param decimalLength - decimal length to apply\n * @returns formatted number\n * @example\n * ```ts\n * localeNumber(1234567890.12, 'fr') // 1 234 567 890,12\n * ```\n */\nconst localeNumber = (number, locale, decimalLength = 0) => new Intl.NumberFormat(locale, { minimumFractionDigits: decimalLength }).format(Number(number));\n/**\n * Format number as percentage based on locale\n * @param number - number to format\n * @param locale - locale to apply\n * @param decimalLength - decimal length to apply\n * @returns formatted percentage\n * @example\n * ```ts\n * localePercent(0.42, 'fr', 2) // '42,00 %'\n * localePercent(0.42, 'en', 2) // '42.00%'\n * ```\n */\nconst localePercent = (number, locale, decimalLength = 0) => {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n minimumFractionDigits: decimalLength,\n maximumFractionDigits: decimalLength,\n }).format(number);\n};\n/**\n * Format number with standardized unit based on locale using Intl unit formatting\n * @param number - number to format\n * @param locale - locale to apply\n * @param unit - standardized unit (e.g., 'kilometer', 'kilogram', 'celsius')\n * @param unitDisplay - how to display the unit ('short', 'long', 'narrow')\n * @param decimalLength - decimal length to apply\n * @returns formatted number with localized unit\n * @example\n * ```ts\n * localeUnit(1234567890.12, 'fr', 'kilometer') // '1 234 567 890,12 km'\n * localeUnit(23, 'fr', 'celsius') // '23 °C'\n * localeUnit(10, 'fr', 'kilometer', 0, 'long') // '10 kilomètres'\n * ```\n */\nconst localeUnit = (number, locale, unit, unitDisplay = 'short', decimalLength = 0) => {\n return new Intl.NumberFormat(locale, {\n style: 'unit',\n unit,\n unitDisplay,\n minimumFractionDigits: decimalLength,\n maximumFractionDigits: decimalLength,\n }).format(number);\n};\n/**\n * Locale date format\n * @param date - date to format\n * @param locale - locale to apply\n * @param config - DateTimeFormatOptions object to apply\n * @returns formatted date\n * @example\n * ```ts\n * localeDate('2022-06-02', 'fr') // '02/06/2022'\n * ```\n */\nconst localeDate = (date, locale, config) => typeof date !== 'string' || date === '' || !dateRegExp.test(date) ? '' : new Intl.DateTimeFormat(locale, config).format(new Date(date));\n/**\n * Get Intl object\n * @param messages - locales to render in object format. `ex: { en: { porp: \"test\" }, fr: { porp: \"test\" }}`.\n * @param defaultLocale - fallback locale to render. `ex: 'en'`.\n * @returns from the element passed in return function you will get the matching messages object\n * @example\n * ```ts\n * import en from './en/messages.json';\n * import fr from './fr/messages.json';\n * import { defineLocales } from '@mgdis/core-ui-helpers/dist/utils';\n *\n * const defaultLocale = 'en';\n * const messages = { en, fr };\n *\n * export const initLocales = defineLocales(messages, defaultLocale);\n * ```\n */\nconst defineLocales = (messages, defaultLocale) => (element) => localeMessages(element, messages, defaultLocale);\n\nexport { defineLocales, localeCurrency, localeDate, localeDatePattern, localeNumber, localePercent, localeUnit };\n//# sourceMappingURL=index.js.map\n","import en from './en/messages.json';\nimport fr from './fr/messages.json';\nimport { defineLocales } from '@mgdis/core-ui-helpers/dist/locale';\n\nconst defaultLocale = 'en';\nconst messages = { en, fr };\n\n/**\n * Get Intl object\n * @param element - element we need to get the language\n * @returns messages object\n */\nexport const initLocales = defineLocales(messages, defaultLocale);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,UAAU,GAAG,+CAA+C;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACK,MAAC,iBAAiB,GAAG,CAAC,MAAM,KAAK;AACtC,IAAI,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;AACnD,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;AAChD,IAAI,MAAM,GAAG,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;AAC9C,IAAI,OAAO,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;AACjG,SAAS,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO;AACzC,SAAS,OAAO,CAAC,KAAK,CAAC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,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;AACnL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,aAAa,KAAK,CAAC,OAAO,KAAK,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC;;ACpJhH,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,QAAQ,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE;AAE3B;;;;AAIG;AACU,MAAA,WAAW,GAAG,aAAa,CAAC,QAAQ,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"p-Bv7NHR-W.js","sources":["../helpers/dist/locale/index.js","src/locales/index.ts"],"sourcesContent":["/**\n * Date RegExp, usefull to test if string is a follow the date pattern\n * @example\n * ```ts\n * dateRegExp.test('mystring') // false\n * dateRegExp.test('2020-12-31') // true\n * ```\n */\nconst dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n\n/**\n * Gets the date pattern based on the specified locale.\n * @param locale - the locale to refer to\n * @returns date pattern\n * @example\n * ```ts\n * localeDatePattern('fr') // 'dd/mm/yyyy'\n * ```\n */\nconst localeDatePattern = (locale) => {\n const year = { value: '2023', pattern: 'yyyy' };\n const month = { value: '12', pattern: 'mm' };\n const day = { value: '24', pattern: 'dd' };\n return localeDate([year.value, month.value, day.value].join('-'), locale, { timeZone: 'UTC' })\n .replace(year.value, year.pattern)\n .replace(month.value, month.pattern)\n .replace(day.value, day.pattern);\n};\n/**\n * Get locale and messages\n * We load the defined locale but for now we only support the first subtag for messages\n * @param element - element we need to get the language\n * @param messages - messages to use\n * @param defaultLocale - default messages locale\n * @returns messages object\n */\nconst localeMessages = (element, messages, defaultLocale) => {\n // Get local\n const closestLangAttribute = element.closest('[lang]');\n const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);\n const locale = closestLang.length > 0 && typeof closestLang[0] === 'string' ? closestLang[0] : navigator.language || defaultLocale;\n // Only keep first subtag\n const localeSubtag = locale.split('-').shift();\n // If messages is empty, return a default object\n if (Object.keys(messages).length === 0) {\n return {\n locale,\n messages: { lang: defaultLocale },\n };\n }\n // Return\n return {\n locale,\n messages: (messages[localeSubtag] ?? messages[defaultLocale] ?? { lang: defaultLocale }),\n };\n};\n/**\n * Format number to the locale currency\n * @param number - number to format\n * @param locale - locale to apply\n * @param currency - currency to apply\n * @returns formatted currency\n * @example\n * ```ts\n * localeCurrency(1234567890.12, 'fr', 'EUR') // '1 234 567 890,12\\xa0€'\n * ```\n */\nconst localeCurrency = (number, locale, currency) => new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);\n/**\n * Format number to locale\n * @param number - number to format\n * @param locale - locale to apply\n * @param decimalLength - decimal length to apply\n * @returns formatted number\n * @example\n * ```ts\n * localeNumber(1234567890.12, 'fr') // 1 234 567 890,12\n * ```\n */\nconst localeNumber = (number, locale, decimalLength = 0) => new Intl.NumberFormat(locale, { minimumFractionDigits: decimalLength }).format(Number(number));\n/**\n * Format number as percentage based on locale\n * @param number - number to format\n * @param locale - locale to apply\n * @param decimalLength - decimal length to apply\n * @returns formatted percentage\n * @example\n * ```ts\n * localePercent(0.42, 'fr', 2) // '42,00 %'\n * localePercent(0.42, 'en', 2) // '42.00%'\n * ```\n */\nconst localePercent = (number, locale, decimalLength = 0) => {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n minimumFractionDigits: decimalLength,\n maximumFractionDigits: decimalLength,\n }).format(number);\n};\n/**\n * Format number with standardized unit based on locale using Intl unit formatting\n * @param number - number to format\n * @param locale - locale to apply\n * @param unit - standardized unit (e.g., 'kilometer', 'kilogram', 'celsius')\n * @param unitDisplay - how to display the unit ('short', 'long', 'narrow')\n * @param decimalLength - decimal length to apply\n * @returns formatted number with localized unit\n * @example\n * ```ts\n * localeUnit(1234567890.12, 'fr', 'kilometer') // '1 234 567 890,12 km'\n * localeUnit(23, 'fr', 'celsius') // '23 °C'\n * localeUnit(10, 'fr', 'kilometer', 0, 'long') // '10 kilomètres'\n * ```\n */\nconst localeUnit = (number, locale, unit, unitDisplay = 'short', decimalLength = 0) => {\n return new Intl.NumberFormat(locale, {\n style: 'unit',\n unit,\n unitDisplay,\n minimumFractionDigits: decimalLength,\n maximumFractionDigits: decimalLength,\n }).format(number);\n};\n/**\n * Locale date format\n * @param date - date to format\n * @param locale - locale to apply\n * @param config - DateTimeFormatOptions object to apply\n * @returns formatted date\n * @example\n * ```ts\n * localeDate('2022-06-02', 'fr') // '02/06/2022'\n * ```\n */\nconst localeDate = (date, locale, config) => typeof date !== 'string' || date === '' || !dateRegExp.test(date) ? '' : new Intl.DateTimeFormat(locale, config).format(new Date(date));\n/**\n * Get Intl object\n * @param messages - locales to render in object format. `ex: { en: { porp: \"test\" }, fr: { porp: \"test\" }}`.\n * @param defaultLocale - fallback locale to render. `ex: 'en'`.\n * @returns from the element passed in return function you will get the matching messages object\n * @example\n * ```ts\n * import en from './en/messages.json';\n * import fr from './fr/messages.json';\n * import { defineLocales } from '@mgdis/core-ui-helpers/dist/utils';\n *\n * const defaultLocale = 'en';\n * const messages = { en, fr };\n *\n * export const initLocales = defineLocales(messages, defaultLocale);\n * ```\n */\nconst defineLocales = (messages, defaultLocale) => (element) => localeMessages(element, messages, defaultLocale);\n\nexport { defineLocales, localeCurrency, localeDate, localeDatePattern, localeNumber, localePercent, localeUnit };\n//# sourceMappingURL=index.js.map\n","import en from './en/messages.json';\nimport fr from './fr/messages.json';\nimport { defineLocales } from '@mgdis/core-ui-helpers/dist/locale';\n\nconst defaultLocale = 'en';\nconst messages = { en, fr };\n\n/**\n * Get Intl object\n * @param element - element we need to get the language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AC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;AACnL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,aAAa,KAAK,CAAC,OAAO,KAAK,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC;;ACpJhH,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,QAAQ,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE;AAE3B;;;;AAIG;AACU,MAAA,WAAW,GAAG,aAAa,CAAC,QAAQ,EAAE,aAAa;;;;"}
@@ -1,2 +1,2 @@
1
- import{r as t,c as s,f as e,h as i,g as a}from"./p-CAuxALt5.js";import{C as h,t as o}from"./p-Dr7GYvIz.js";import{i as r}from"./p-CwZ2wzxw.js";const n=["info","warning","success","danger"];const c=["bar-left","background"];const l=".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}";const u=class{constructor(e){t(this,e);this.componentShow=s(this,"component-show");this.componentHide=s(this,"component-hide");this.componentClose=s(this,"component-close");this.classCloseButton="mg-c-alert--close-button";this.storedTimer=null;this.isFocused=false;this.isHovered=false;this.variant="info";this.variantStyle="bar-left";this.classCollection=new h(["mg-c-alert"]);this.hasActions=false;this.setTimer=()=>{this.storedTimer=setTimeout((()=>this.element.hidden=true),this.delay*1e3)};this.clearTimer=()=>{clearTimeout(this.storedTimer)};this.timerEvents=t=>{this.clearTimer();const s=t.type==="mouseenter";this[s?"isHovered":"isFocused"]=true;this.element.addEventListener(s?"mouseleave":"focusout",(t=>{this[t.type==="mouseleave"?"isHovered":"isFocused"]=false;if(!this.isFocused&&!this.isHovered)this.setTimer()}),{once:true})};this.handleClose=()=>{this.element.hidden=true;this.componentClose.emit()}}watchDelay(t){if(t!==undefined&&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){if(typeof t==="string"&&t===""){t=true}if(t){this.componentHide.emit();["focusin","mouseenter"].forEach((t=>{this.element.removeEventListener(t,this.timerEvents)}));this.clearTimer()}else{this.componentShow.emit();if(this.delay>1){this.setTimer();["focusin","mouseenter"].forEach((t=>{this.element.addEventListener(t,this.timerEvents)}))}}e(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=this.element.querySelector('[slot="actions"]')!==null;if(!this.hasActions){this.classCollection.add(this.classCloseButton)}}render(){return i("mg-message",{key:"12216af414367fc3eea31cffb2d7e38c724038a3",class:this.classCollection.join(),role:["info","success"].includes(this.variant)?"status":"alert",variant:this.variant,variantStyle:this.variantStyle},i("slot",{key:"bdab00611363a879e8d2bd23442e62ab5e7238e3"}),this.hasActions?i("span",{slot:"actions"},i("slot",{name:"actions"})):i("span",{class:"mg-c-alert__close-button"},i("mg-button",{"is-icon":true,variant:"flat",label:this.messages.alert.closeButton,onClick:this.handleClose},i("mg-icon",{icon:"cross"}))))}get element(){return a(this)}static get watchers(){return{delay:["watchDelay"],variant:["watchVariant"],variantStyle:["watchVariantStyle"],hidden:["watchHidden"]}}};u.style=l;export{u as mg_alert};
2
- //# sourceMappingURL=p-d711941b.entry.js.map
1
+ import{r as t,c as s,f as e,h as i,g as a}from"./p-CAuxALt5.js";import{C as h,t as o}from"./p-Dr7GYvIz.js";import{i as r}from"./p-Bv7NHR-W.js";const n=["info","warning","success","danger"];const c=["bar-left","background"];const l=".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}";const u=class{constructor(e){t(this,e);this.componentShow=s(this,"component-show");this.componentHide=s(this,"component-hide");this.componentClose=s(this,"component-close");this.classCloseButton="mg-c-alert--close-button";this.storedTimer=null;this.isFocused=false;this.isHovered=false;this.variant="info";this.variantStyle="bar-left";this.classCollection=new h(["mg-c-alert"]);this.hasActions=false;this.setTimer=()=>{this.storedTimer=setTimeout((()=>this.element.hidden=true),this.delay*1e3)};this.clearTimer=()=>{clearTimeout(this.storedTimer)};this.timerEvents=t=>{this.clearTimer();const s=t.type==="mouseenter";this[s?"isHovered":"isFocused"]=true;this.element.addEventListener(s?"mouseleave":"focusout",(t=>{this[t.type==="mouseleave"?"isHovered":"isFocused"]=false;if(!this.isFocused&&!this.isHovered)this.setTimer()}),{once:true})};this.handleClose=()=>{this.element.hidden=true;this.componentClose.emit()}}watchDelay(t){if(t!==undefined&&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){if(typeof t==="string"&&t===""){t=true}if(t){this.componentHide.emit();["focusin","mouseenter"].forEach((t=>{this.element.removeEventListener(t,this.timerEvents)}));this.clearTimer()}else{this.componentShow.emit();if(this.delay>1){this.setTimer();["focusin","mouseenter"].forEach((t=>{this.element.addEventListener(t,this.timerEvents)}))}}e(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=this.element.querySelector('[slot="actions"]')!==null;if(!this.hasActions){this.classCollection.add(this.classCloseButton)}}render(){return i("mg-message",{key:"12216af414367fc3eea31cffb2d7e38c724038a3",class:this.classCollection.join(),role:["info","success"].includes(this.variant)?"status":"alert",variant:this.variant,variantStyle:this.variantStyle},i("slot",{key:"bdab00611363a879e8d2bd23442e62ab5e7238e3"}),this.hasActions?i("span",{slot:"actions"},i("slot",{name:"actions"})):i("span",{class:"mg-c-alert__close-button"},i("mg-button",{"is-icon":true,variant:"flat",label:this.messages.alert.closeButton,onClick:this.handleClose},i("mg-icon",{icon:"cross"}))))}get element(){return a(this)}static get watchers(){return{delay:["watchDelay"],variant:["watchVariant"],variantStyle:["watchVariantStyle"],hidden:["watchHidden"]}}};u.style=l;export{u as mg_alert};
2
+ //# sourceMappingURL=p-fe974d2b.entry.js.map
@@ -159,6 +159,10 @@ export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, '
159
159
  * Emited event when checking validity
160
160
  */
161
161
  inputValid: EventEmitter<HTMLMgInputCheckboxElement['valid']>;
162
+ /**
163
+ * Set focus on input.
164
+ */
165
+ setFocus(): Promise<void>;
162
166
  /**
163
167
  * Display input error if it exists.
164
168
  */
@@ -212,7 +212,7 @@ export declare class MgInputCombobox {
212
212
  */
213
213
  fetchError: EventEmitter<Error>;
214
214
  /**
215
- * Public method to play input focus
215
+ * Set focus on input.
216
216
  */
217
217
  setFocus(): Promise<void>;
218
218
  /**
@@ -111,6 +111,10 @@ export declare class MgInputDate {
111
111
  * Emited event when checking validity
112
112
  */
113
113
  inputValid: EventEmitter<HTMLMgInputDateElement['valid']>;
114
+ /**
115
+ * Set focus on input.
116
+ */
117
+ setFocus(): Promise<void>;
114
118
  /**
115
119
  * Display input error if it exists.
116
120
  */
@@ -132,11 +132,11 @@ export declare class MgInputNumeric {
132
132
  decimalLength: number;
133
133
  validateDecimalLength(newValue: MgInputNumeric['decimalLength']): void;
134
134
  /**
135
- * Define input pattern to validate
135
+ * Define input valid state
136
136
  */
137
137
  valid: boolean;
138
138
  /**
139
- * Define input pattern error message
139
+ * Define input invalid state
140
140
  */
141
141
  invalid: boolean;
142
142
  /**
@@ -159,6 +159,10 @@ export declare class MgInputNumeric {
159
159
  * Emited event when checking validity
160
160
  */
161
161
  inputValid: EventEmitter<HTMLMgInputNumericElement['valid']>;
162
+ /**
163
+ * Set focus on input.
164
+ */
165
+ setFocus(): Promise<void>;
162
166
  /**
163
167
  * Display input error if it exists.
164
168
  */
@@ -111,6 +111,10 @@ export declare class MgInputPassword {
111
111
  * Emited event when checking validity
112
112
  */
113
113
  inputValid: EventEmitter<HTMLMgInputPasswordElement['valid']>;
114
+ /**
115
+ * Set focus on input.
116
+ */
117
+ setFocus(): Promise<void>;
114
118
  /**
115
119
  * Display input error if it exists.
116
120
  */
@@ -113,6 +113,10 @@ export declare class MgInputRadio {
113
113
  * Emited event when checking validity
114
114
  */
115
115
  inputValid: EventEmitter<HTMLMgInputRadioElement['valid']>;
116
+ /**
117
+ * Set focus on input.
118
+ */
119
+ setFocus(): Promise<void>;
116
120
  /**
117
121
  * Display input error if it exists.
118
122
  */
@@ -113,6 +113,10 @@ export declare class MgInputRichTextEditor {
113
113
  * Emited event when value change
114
114
  */
115
115
  valueChange: EventEmitter<string>;
116
+ /**
117
+ * Set focus on input.
118
+ */
119
+ setFocus(): Promise<void>;
116
120
  /**
117
121
  * Get editor content as HTML
118
122
  * @returns HTML content of the editor
@@ -129,6 +129,10 @@ export declare class MgInputSelect {
129
129
  * Emited event when checking validity
130
130
  */
131
131
  inputValid: EventEmitter<HTMLMgInputCheckboxElement['valid']>;
132
+ /**
133
+ * Set focus on input.
134
+ */
135
+ setFocus(): Promise<void>;
132
136
  /**
133
137
  * Display input error if it exists.
134
138
  */
@@ -151,7 +151,7 @@ export declare class MgInputText {
151
151
  */
152
152
  inputValid: EventEmitter<HTMLMgInputTextElement['valid']>;
153
153
  /**
154
- * Public method to play input focus
154
+ * Set focus on input.
155
155
  */
156
156
  setFocus(): Promise<void>;
157
157
  /**
@@ -133,6 +133,10 @@ export declare class MgInputTextarea {
133
133
  * Emited event when checking validity
134
134
  */
135
135
  inputValid: EventEmitter<HTMLMgInputTextareaElement['valid']>;
136
+ /**
137
+ * Set focus on input.
138
+ */
139
+ setFocus(): Promise<void>;
136
140
  /**
137
141
  * Display input error if it exists.
138
142
  */
@@ -10,6 +10,7 @@ export declare class MgInputToggle {
10
10
  /************
11
11
  * Internal *
12
12
  ************/
13
+ private button;
13
14
  private readonly classIsActive;
14
15
  private readonly classOnOff;
15
16
  private readonly classIcon;
@@ -112,6 +113,10 @@ export declare class MgInputToggle {
112
113
  * Emited event when checking validity
113
114
  */
114
115
  inputValid: EventEmitter<boolean>;
116
+ /**
117
+ * Set focus on input.
118
+ */
119
+ setFocus(): Promise<void>;
115
120
  /**
116
121
  * Set an error and display a custom error message.
117
122
  * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
@@ -121,15 +126,15 @@ export declare class MgInputToggle {
121
126
  * @param errorMessage - the error message to display
122
127
  */
123
128
  setError(valid: boolean, errorMessage: string): Promise<void>;
129
+ /**
130
+ * Reset value, validity, error and visual state
131
+ */
132
+ reset(): Promise<void>;
124
133
  /**
125
134
  * Set input error message
126
135
  * @param errorMessage - errorMessage override
127
136
  */
128
137
  private setErrorMessage;
129
- /**
130
- * Reset value, validity, error and visual state
131
- */
132
- reset(): Promise<void>;
133
138
  /**
134
139
  * Change checked value
135
140
  */
@@ -87,6 +87,10 @@ export declare class MgForm {
87
87
  * Emitted event on form submit
88
88
  */
89
89
  formSubmit: EventEmitter<boolean>;
90
+ /**
91
+ * Emitted event on form reset
92
+ */
93
+ formReset: EventEmitter<boolean>;
90
94
  /**
91
95
  * Display input error if it exists.
92
96
  */
@@ -387,6 +387,10 @@ export namespace Components {
387
387
  * @param errorMessage - the error message to display
388
388
  */
389
389
  "setError": (valid: MgInputCheckbox["valid"], errorMessage: string) => Promise<void>;
390
+ /**
391
+ * Set focus on input.
392
+ */
393
+ "setFocus": () => Promise<void>;
390
394
  /**
391
395
  * Overwrite default "show" button message
392
396
  */
@@ -534,7 +538,7 @@ export namespace Components {
534
538
  */
535
539
  "setError": (valid: MgInputCombobox["valid"], errorMessage: string) => Promise<void>;
536
540
  /**
537
- * Public method to play input focus
541
+ * Set focus on input.
538
542
  */
539
543
  "setFocus": () => Promise<void>;
540
544
  /**
@@ -617,6 +621,10 @@ export namespace Components {
617
621
  * @param errorMessage - the error message to display
618
622
  */
619
623
  "setError": (valid: MgInputDate["valid"], errorMessage: string) => Promise<void>;
624
+ /**
625
+ * Set focus on input.
626
+ */
627
+ "setFocus": () => Promise<void>;
620
628
  /**
621
629
  * Add a tooltip message next to the input
622
630
  */
@@ -668,7 +676,7 @@ export namespace Components {
668
676
  */
669
677
  "integerLength": number;
670
678
  /**
671
- * Define input pattern error message
679
+ * Define input invalid state
672
680
  */
673
681
  "invalid": boolean;
674
682
  /**
@@ -721,6 +729,10 @@ export namespace Components {
721
729
  * @param errorMessage - the error message to display
722
730
  */
723
731
  "setError": (valid: MgInputNumeric["valid"], errorMessage: string) => Promise<void>;
732
+ /**
733
+ * Set focus on input.
734
+ */
735
+ "setFocus": () => Promise<void>;
724
736
  /**
725
737
  * Add a tooltip message next to the input
726
738
  */
@@ -742,7 +754,7 @@ export namespace Components {
742
754
  */
743
755
  "unitDisplay": Intl.NumberFormatOptions['unitDisplay'];
744
756
  /**
745
- * Define input pattern to validate
757
+ * Define input valid state
746
758
  */
747
759
  "valid": boolean;
748
760
  /**
@@ -817,6 +829,10 @@ export namespace Components {
817
829
  * @param errorMessage - the error message to display
818
830
  */
819
831
  "setError": (valid: MgInputPassword["valid"], errorMessage: string) => Promise<void>;
832
+ /**
833
+ * Set focus on input.
834
+ */
835
+ "setFocus": () => Promise<void>;
820
836
  /**
821
837
  * Add a tooltip message next to the input
822
838
  */
@@ -897,6 +913,10 @@ export namespace Components {
897
913
  * @param errorMessage - the error message to display
898
914
  */
899
915
  "setError": (valid: MgInputRadio["valid"], errorMessage: string) => Promise<void>;
916
+ /**
917
+ * Set focus on input.
918
+ */
919
+ "setFocus": () => Promise<void>;
900
920
  /**
901
921
  * Add a tooltip message next to the input
902
922
  */
@@ -995,6 +1015,10 @@ export namespace Components {
995
1015
  * @param errorMessage - the error message to display
996
1016
  */
997
1017
  "setError": (valid: MgInputRichTextEditor["valid"], errorMessage: string) => Promise<void>;
1018
+ /**
1019
+ * Set focus on input.
1020
+ */
1021
+ "setFocus": () => Promise<void>;
998
1022
  /**
999
1023
  * Add a tooltip message next to the input
1000
1024
  */
@@ -1087,6 +1111,10 @@ export namespace Components {
1087
1111
  * @param errorMessage - the error message to display
1088
1112
  */
1089
1113
  "setError": (valid: MgInputSelect["valid"], errorMessage: string) => Promise<void>;
1114
+ /**
1115
+ * Set focus on input.
1116
+ */
1117
+ "setFocus": () => Promise<void>;
1090
1118
  /**
1091
1119
  * Add a tooltip message next to the input
1092
1120
  */
@@ -1192,7 +1220,7 @@ export namespace Components {
1192
1220
  */
1193
1221
  "setError": (valid: MgInputText["valid"], errorMessage: string) => Promise<void>;
1194
1222
  /**
1195
- * Public method to play input focus
1223
+ * Set focus on input.
1196
1224
  */
1197
1225
  "setFocus": () => Promise<void>;
1198
1226
  /**
@@ -1303,6 +1331,10 @@ export namespace Components {
1303
1331
  * @param errorMessage - the error message to display
1304
1332
  */
1305
1333
  "setError": (valid: MgInputTextarea["valid"], errorMessage: string) => Promise<void>;
1334
+ /**
1335
+ * Set focus on input.
1336
+ */
1337
+ "setFocus": () => Promise<void>;
1306
1338
  /**
1307
1339
  * Add a tooltip message next to the input
1308
1340
  */
@@ -1393,6 +1425,10 @@ export namespace Components {
1393
1425
  * @param errorMessage - the error message to display
1394
1426
  */
1395
1427
  "setError": (valid: boolean, errorMessage: string) => Promise<void>;
1428
+ /**
1429
+ * Set focus on input.
1430
+ */
1431
+ "setFocus": () => Promise<void>;
1396
1432
  /**
1397
1433
  * Add a tooltip message next to the input
1398
1434
  */
@@ -1892,6 +1928,7 @@ declare global {
1892
1928
  interface HTMLMgFormElementEventMap {
1893
1929
  "form-valid": HTMLMgFormElement['valid'];
1894
1930
  "form-submit": boolean;
1931
+ "form-reset": boolean;
1895
1932
  }
1896
1933
  interface HTMLMgFormElement extends Components.MgForm, HTMLStencilElement {
1897
1934
  addEventListener<K extends keyof HTMLMgFormElementEventMap>(type: K, listener: (this: HTMLMgFormElement, ev: MgFormCustomEvent<HTMLMgFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -2566,6 +2603,10 @@ declare namespace LocalJSX {
2566
2603
  * Input name If not set the value equals the identifier
2567
2604
  */
2568
2605
  "name"?: string;
2606
+ /**
2607
+ * Emitted event on form reset
2608
+ */
2609
+ "onForm-reset"?: (event: MgFormCustomEvent<boolean>) => void;
2569
2610
  /**
2570
2611
  * Emitted event on form submit
2571
2612
  */
@@ -3003,7 +3044,7 @@ declare namespace LocalJSX {
3003
3044
  */
3004
3045
  "integerLength"?: number;
3005
3046
  /**
3006
- * Define input pattern error message
3047
+ * Define input invalid state
3007
3048
  */
3008
3049
  "invalid"?: boolean;
3009
3050
  /**
@@ -3075,7 +3116,7 @@ declare namespace LocalJSX {
3075
3116
  */
3076
3117
  "unitDisplay"?: Intl.NumberFormatOptions['unitDisplay'];
3077
3118
  /**
3078
- * Define input pattern to validate
3119
+ * Define input valid state
3079
3120
  */
3080
3121
  "valid"?: boolean;
3081
3122
  /**