@mgdis/mg-components 6.13.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.
- package/dist/cjs/{index-DyUB3KmT.js → index-CwjAofQ1.js} +3 -3
- package/dist/cjs/{index-DyUB3KmT.js.map → index-CwjAofQ1.js.map} +1 -1
- package/dist/cjs/mg-action-more_37.cjs.entry.js +20 -14
- package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +1 -1
- package/dist/cjs/mg-input-combobox.cjs.entry.js +2 -2
- package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -1
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +2 -2
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-input-rich-text-editor.entry.cjs.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/components/index3.js +1 -1
- package/dist/components/index3.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +9 -3
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-combobox.js +1 -1
- package/dist/components/mg-input-combobox.js.map +1 -1
- package/dist/components/mg-input-date.js +1 -1
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +1 -1
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +1 -1
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-rich-text-editor.js +1 -1
- package/dist/components/mg-input-rich-text-editor.js.map +1 -1
- package/dist/components/mg-input-select2.js +1 -1
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +1 -1
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-table.js +1 -1
- package/dist/components/mg-table.js.map +1 -1
- package/dist/esm/{index-CwZ2wzxw.js → index-Bv7NHR-W.js} +3 -3
- package/dist/esm/{index-CwZ2wzxw.js.map → index-Bv7NHR-W.js.map} +1 -1
- package/dist/esm/mg-action-more_37.entry.js +20 -14
- package/dist/esm/mg-action-more_37.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +1 -1
- package/dist/esm/mg-input-combobox.entry.js +2 -2
- package/dist/esm/mg-input-combobox.entry.js.map +1 -1
- package/dist/esm/mg-input-rich-text-editor.entry.js +2 -2
- package/dist/esm/mg-input-rich-text-editor.entry.js.map +1 -1
- package/dist/esm/mg-loader.entry.js +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -1
- package/dist/mg-components/mg-input-rich-text-editor.entry.esm.js.map +1 -1
- package/dist/mg-components/{p-e7a7c651.entry.js → p-19cbc6e6.entry.js} +3 -3
- package/dist/mg-components/{p-e7a7c651.entry.js.map → p-19cbc6e6.entry.js.map} +1 -1
- package/dist/mg-components/p-269e2a80.entry.js +2 -0
- package/dist/mg-components/p-269e2a80.entry.js.map +1 -0
- package/dist/mg-components/p-2dea7d37.entry.js +2 -0
- package/dist/mg-components/p-2dea7d37.entry.js.map +1 -0
- package/dist/mg-components/{p-da1e7950.entry.js → p-415f14fb.entry.js} +2 -2
- package/dist/mg-components/{p-CwZ2wzxw.js → p-Bv7NHR-W.js} +2 -2
- package/dist/mg-components/{p-CwZ2wzxw.js.map → p-Bv7NHR-W.js.map} +1 -1
- package/dist/mg-components/{p-d711941b.entry.js → p-fe974d2b.entry.js} +2 -2
- package/ide/intellij/web-types.json +1 -1
- package/package.json +16 -21
- package/dist/mg-components/p-3e92299a.entry.js +0 -2
- package/dist/mg-components/p-3e92299a.entry.js.map +0 -1
- package/dist/mg-components/p-c907ddac.entry.js +0 -2
- package/dist/mg-components/p-c907ddac.entry.js.map +0 -1
- /package/dist/mg-components/{p-da1e7950.entry.js.map → p-415f14fb.entry.js.map} +0 -0
- /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-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
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 : {pattern} (ex : {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 : {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 : nom@exemple.fr",emails:"Format attendu : premier@exemple.fr, second@exemple.fr",url:"Format attendu : 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]
|
|
2
|
-
//# sourceMappingURL=p-
|
|
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 : {pattern} (ex : {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 : {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 : nom@exemple.fr",emails:"Format attendu : premier@exemple.fr, second@exemple.fr",url:"Format attendu : 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-
|
|
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-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgdis/mg-components",
|
|
3
|
-
"version": "6.13.
|
|
3
|
+
"version": "6.13.1",
|
|
4
4
|
"description": "MG Components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -36,27 +36,22 @@
|
|
|
36
36
|
"@popperjs/core": "2.11.8",
|
|
37
37
|
"@stencil/core": "4.28.2",
|
|
38
38
|
"quill": "2.0.3",
|
|
39
|
-
"@mgdis/core-ui-helpers": "1.0.
|
|
40
|
-
"@mgdis/img": "2.4.
|
|
41
|
-
"@mgdis/styles": "2.8.
|
|
39
|
+
"@mgdis/core-ui-helpers": "1.0.2",
|
|
40
|
+
"@mgdis/img": "2.4.5",
|
|
41
|
+
"@mgdis/styles": "2.8.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@playwright/test": "1.53.
|
|
45
|
-
"@storybook/addon-a11y": "
|
|
46
|
-
"@storybook/addon-
|
|
47
|
-
"@storybook/addon-
|
|
48
|
-
"@storybook/
|
|
49
|
-
"@storybook/
|
|
50
|
-
"@storybook/blocks": "8.6.14",
|
|
51
|
-
"@storybook/html": "8.6.14",
|
|
52
|
-
"@storybook/html-vite": "8.6.14",
|
|
53
|
-
"@storybook/manager-api": "8.6.14",
|
|
54
|
-
"@storybook/theming": "8.6.14",
|
|
44
|
+
"@playwright/test": "1.53.1",
|
|
45
|
+
"@storybook/addon-a11y": "9.0.13",
|
|
46
|
+
"@storybook/addon-docs": "9.0.13",
|
|
47
|
+
"@storybook/addon-links": "9.0.13",
|
|
48
|
+
"@storybook/html": "9.0.13",
|
|
49
|
+
"@storybook/html-vite": "9.0.13",
|
|
55
50
|
"@types/jest": "29.5.14",
|
|
56
|
-
"@types/node": "22.15.
|
|
57
|
-
"chromatic": "
|
|
51
|
+
"@types/node": "22.15.32",
|
|
52
|
+
"chromatic": "13.0.1",
|
|
58
53
|
"eslint": "8.57.1",
|
|
59
|
-
"eslint-plugin-storybook": "0.
|
|
54
|
+
"eslint-plugin-storybook": "9.0.13",
|
|
60
55
|
"jest": "29.7.0",
|
|
61
56
|
"jest-cli": "29.7.0",
|
|
62
57
|
"jest-junit": "16.0.0",
|
|
@@ -64,12 +59,12 @@
|
|
|
64
59
|
"react": "19.1.0",
|
|
65
60
|
"react-dom": "19.1.0",
|
|
66
61
|
"sass": "1.89.2",
|
|
67
|
-
"storybook": "
|
|
68
|
-
"storybook-addon-tag-badges": "
|
|
62
|
+
"storybook": "9.0.13",
|
|
63
|
+
"storybook-addon-tag-badges": "2.0.1",
|
|
69
64
|
"typescript": "5.8.3",
|
|
70
65
|
"vite": "6.3.5",
|
|
71
66
|
"@core-ui/jest-config": "1.0.9",
|
|
72
|
-
"@mgdis/linting-stencil": "1.3.
|
|
67
|
+
"@mgdis/linting-stencil": "1.3.8"
|
|
73
68
|
},
|
|
74
69
|
"license": "BSD-3-Clause",
|
|
75
70
|
"scripts": {
|