@mgdis/mg-components 5.0.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{mg-badge_24.cjs.entry.js → mg-badge_27.cjs.entry.js} +892 -295
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +2 -0
  5. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
  6. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +1 -0
  7. package/dist/collection/components/atoms/mg-button/mg-button.css +8 -0
  8. package/dist/collection/components/atoms/mg-button/mg-button.js +41 -3
  9. package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +18 -0
  10. package/dist/collection/components/atoms/mg-card/mg-card.css +7 -0
  11. package/dist/collection/components/atoms/mg-card/mg-card.js +26 -0
  12. package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +18 -0
  13. package/dist/collection/components/atoms/mg-divider/mg-divider.css +9 -0
  14. package/dist/collection/components/atoms/mg-divider/mg-divider.js +57 -0
  15. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  16. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -5
  17. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -20
  18. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +1 -1
  19. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +2 -1
  20. package/dist/collection/components/molecules/inputs/MgInput.js +3 -11
  21. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +41 -20
  22. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +50 -39
  23. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +25 -6
  24. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +42 -33
  25. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +25 -6
  26. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +36 -17
  27. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +35 -14
  28. package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +2 -3
  29. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +28 -6
  30. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +36 -17
  31. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +25 -6
  32. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +38 -19
  33. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +25 -6
  34. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +37 -18
  35. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
  36. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +1 -0
  37. package/dist/collection/components/molecules/mg-details/mg-details.css +29 -0
  38. package/dist/collection/components/molecules/mg-details/mg-details.js +26 -4
  39. package/dist/collection/components/molecules/mg-form/mg-form.js +73 -27
  40. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +6 -6
  41. package/dist/collection/components/molecules/mg-message/mg-message.js +1 -1
  42. package/dist/collection/components/molecules/mg-modal/mg-modal.css +2 -1
  43. package/dist/collection/components/molecules/mg-modal/mg-modal.js +48 -4
  44. package/dist/collection/components/molecules/mg-panel/mg-panel.css +5 -14
  45. package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -5
  46. package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
  47. package/dist/collection/components/molecules/mg-popover/mg-popover.js +3 -2
  48. package/dist/collection/utils/components.utils.js +10 -6
  49. package/dist/collection/utils/unit.test.utils.js +51 -0
  50. package/dist/collection/variables.css +23 -8
  51. package/dist/components/MgInput.js +4 -12
  52. package/dist/components/components.utils.js +11 -7
  53. package/dist/components/index.d.ts +2 -0
  54. package/dist/components/index.js +2 -0
  55. package/dist/components/mg-badge2.js +1 -1
  56. package/dist/components/mg-button2.js +23 -4
  57. package/dist/components/mg-card.d.ts +11 -0
  58. package/dist/components/mg-card.js +42 -0
  59. package/dist/components/mg-details.js +8 -3
  60. package/dist/components/mg-divider.d.ts +11 -0
  61. package/dist/components/mg-divider.js +51 -0
  62. package/dist/components/mg-form.js +67 -26
  63. package/dist/components/mg-input-checkbox.js +36 -21
  64. package/dist/components/mg-input-date.js +44 -39
  65. package/dist/components/mg-input-numeric.js +37 -34
  66. package/dist/components/mg-input-password.js +32 -19
  67. package/dist/components/mg-input-radio.js +30 -15
  68. package/dist/components/mg-input-select2.js +32 -19
  69. package/dist/components/mg-input-text2.js +34 -21
  70. package/dist/components/mg-input-textarea.js +32 -19
  71. package/dist/components/mg-input-toggle.js +1 -1
  72. package/dist/components/mg-message.js +1 -1
  73. package/dist/components/mg-modal.js +49 -5
  74. package/dist/components/mg-panel.js +1 -1
  75. package/dist/components/mg-popover.js +3 -2
  76. package/dist/components/mg-tag.js +1 -1
  77. package/dist/components/mg-tooltip2.js +2 -4
  78. package/dist/esm/loader.js +1 -1
  79. package/dist/esm/{mg-badge_24.entry.js → mg-badge_27.entry.js} +839 -245
  80. package/dist/esm/mg-components.js +1 -1
  81. package/dist/mg-components/mg-components.css +1 -1
  82. package/dist/mg-components/mg-components.esm.js +1 -1
  83. package/dist/mg-components/p-b2b07c3f.entry.js +1 -0
  84. package/dist/mg-components/variables.css +23 -8
  85. package/dist/types/components/atoms/mg-button/mg-button.d.ts +8 -2
  86. package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +6 -0
  87. package/dist/types/components/atoms/mg-card/mg-card.d.ts +11 -0
  88. package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +6 -0
  89. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +15 -0
  90. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -6
  91. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -8
  92. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +1 -1
  93. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +10 -8
  94. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +3 -8
  95. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +3 -8
  96. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -3
  97. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
  98. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -3
  99. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +5 -4
  100. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -3
  101. package/dist/types/components/molecules/mg-details/mg-details.d.ts +4 -0
  102. package/dist/types/components/molecules/mg-form/mg-form.d.ts +21 -1
  103. package/dist/types/components/molecules/mg-message/mg-message.d.ts +3 -0
  104. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +11 -0
  105. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -6
  106. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
  107. package/dist/types/components.d.ts +55 -6
  108. package/dist/types/utils/components.utils.d.ts +7 -3
  109. package/package.json +9 -9
  110. package/dist/cjs/index-179621c8.js +0 -244
  111. package/dist/cjs/mg-modal.cjs.entry.js +0 -128
  112. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -20
  113. package/dist/collection/utils/test.utils.js +0 -38
  114. package/dist/esm/index-7efedd97.js +0 -238
  115. package/dist/esm/mg-modal.entry.js +0 -124
  116. package/dist/mg-components/p-5f89600c.js +0 -1
  117. package/dist/mg-components/p-b60a4c53.entry.js +0 -1
  118. package/dist/mg-components/p-df947fa5.entry.js +0 -1
  119. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -8
  120. package/dist/types/utils/test.utils.d.ts +0 -17
@@ -1,238 +0,0 @@
1
- /**
2
- * Create random ID
3
- *
4
- * @param {string} prefix add prefix to created ID
5
- * @param {number} length ID length
6
- * @returns {string} ID
7
- */
8
- function createID(prefix = '', length = 10) {
9
- let ID = '';
10
- const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
11
- const charsLength = chars.length;
12
- for (let i = 0; i < length; i++) {
13
- ID += chars.charAt(Math.floor(Math.random() * charsLength));
14
- }
15
- return (prefix !== '' ? `${prefix}-` : '') + ID;
16
- }
17
- /**
18
- * Class to manage component classlist
19
- * Set() are not working when imported in project
20
- */
21
- class ClassList {
22
- constructor(classlist = []) {
23
- /**
24
- * Add class
25
- *
26
- * @param {string} className class name to add
27
- * @returns {void}
28
- */
29
- this.add = (className) => {
30
- if (!this.has(className)) {
31
- this.classes.push(className);
32
- }
33
- };
34
- /**
35
- * Delete class
36
- *
37
- * @param {string} className class name to delete
38
- * @returns {void}
39
- */
40
- this.delete = (className) => {
41
- const index = this.classes.indexOf(className);
42
- if (index > -1) {
43
- this.classes.splice(index, 1);
44
- }
45
- };
46
- /**
47
- * Check if class exist in list
48
- *
49
- * @param {string} className class name to check
50
- * @returns {boolean} class name is in the list
51
- */
52
- this.has = (className) => {
53
- return this.classes.includes(className);
54
- };
55
- /**
56
- * Join classes seperated by spaces
57
- *
58
- * @returns {string} joined values
59
- */
60
- this.join = () => {
61
- return this.classes.join(' ');
62
- };
63
- this.classes = classlist;
64
- }
65
- }
66
- /**
67
- * Check if all items are string
68
- *
69
- * @param {string[]} items items to check
70
- * @returns {boolean} all items are string
71
- */
72
- function allItemsAreString(items) {
73
- return items && items.every(item => typeof item === 'string');
74
- }
75
- /**
76
- * Check if element is a heading
77
- *
78
- * @param {Element} element slotted element
79
- * @param {string[]} tagNames allowed tag names list
80
- * @returns {boolean} element is a heading
81
- */
82
- function isTagName(element, tagNames) {
83
- return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
84
- }
85
-
86
- const errors$1 = {
87
- required: "This field is required.",
88
- date: {
89
- badInput: "The date format must be <span aria-hidden=\"true\">mm/dd/yyyy</span><span class=\"sr-only\">m m / d d / y y y y</span> and the date must be greater than {min}",
90
- min: "The date cannot be earlier than {min}",
91
- max: "The date cannot be later than {max}",
92
- minMax: "The date must be between {min} and {max}"
93
- },
94
- numeric: {
95
- min: "The value cannot be less than {min}",
96
- max: "The value cannot be greater than {max}",
97
- minMax: "The value must be between {min} et {max}"
98
- }
99
- };
100
- const nbCharLeft$1 = "{counter} characters left.";
101
- const input$1 = {
102
- select: {
103
- placeholder: "Select a value"
104
- }
105
- };
106
- const form$1 = {
107
- required: "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
108
- allRequired: "All fields are required"
109
- };
110
- const message$1 = {
111
- closeButton: "Close message"
112
- };
113
- const modal$1 = {
114
- closeButton: "Close modal"
115
- };
116
- const pagination$1 = {
117
- label: "Pagination",
118
- page: "page",
119
- pages: "pages",
120
- nextPage: "Next page",
121
- previousPage: "Previous page",
122
- selectPage: "Select the page to display."
123
- };
124
- const panel$1 = {
125
- editLabel: "Edit section title."
126
- };
127
- const general$1 = {
128
- confirm: "Confirm",
129
- cancel: "Cancel",
130
- close: "Close",
131
- next: "next",
132
- previous: "previous"
133
- };
134
- const en = {
135
- errors: errors$1,
136
- nbCharLeft: nbCharLeft$1,
137
- input: input$1,
138
- form: form$1,
139
- message: message$1,
140
- modal: modal$1,
141
- pagination: pagination$1,
142
- panel: panel$1,
143
- general: general$1
144
- };
145
-
146
- const errors = {
147
- required: "Ce champ est obligatoire.",
148
- date: {
149
- badInput: "Le format de la date doit être du type <span aria-hidden=\"true\">jj/mm/aaaa</span><span class=\"sr-only\">j j / m m / a a a a</span> et la date supérieure au {min}",
150
- min: "La date ne peut pas être antérieure au {min}",
151
- max: "La date ne peut pas être postérieure au {max}",
152
- minMax: "La date doit être comprise entre le {min} et le {max}"
153
- },
154
- numeric: {
155
- min: "La valeur ne peut pas être inférieure à {min}",
156
- max: "La valeur ne peut pas être supérieure à {max}",
157
- minMax: "La valeur doit être comprise entre {min} et {max}"
158
- }
159
- };
160
- const nbCharLeft = "{counter} caractères disponibles.";
161
- const input = {
162
- select: {
163
- placeholder: "Sélectionnez une valeur"
164
- }
165
- };
166
- const form = {
167
- required: "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
168
- allRequired: "Tous les champs sont obligatoires"
169
- };
170
- const message = {
171
- closeButton: "Fermer le message"
172
- };
173
- const modal = {
174
- closeButton: "Fermer la modale"
175
- };
176
- const pagination = {
177
- label: "Pagination",
178
- page: "page",
179
- pages: "pages",
180
- nextPage: "Page suivante",
181
- previousPage: "Page précédente",
182
- selectPage: "Sélectionner la page à afficher."
183
- };
184
- const panel = {
185
- editLabel: "Modifier le titre de la section."
186
- };
187
- const general = {
188
- confirm: "Valider",
189
- cancel: "Annuler",
190
- close: "Fermer",
191
- next: "suivant",
192
- previous: "précédent"
193
- };
194
- const fr = {
195
- errors: errors,
196
- nbCharLeft: nbCharLeft,
197
- input: input,
198
- form: form,
199
- message: message,
200
- modal: modal,
201
- pagination: pagination,
202
- panel: panel,
203
- general: general
204
- };
205
-
206
- const defaultLocale = 'en';
207
- const messages = { en, fr };
208
- /**
209
- * Get locale
210
- *
211
- * @param {HTMLElement} element element that needs to know the locale to use
212
- * @returns {string} locale
213
- */
214
- const getLocale = (element) => {
215
- var _a;
216
- return ((_a = element.closest('[lang]')) === null || _a === void 0 ? void 0 : _a.lang) || navigator.language || defaultLocale;
217
- };
218
- /**
219
- * Get Intl object
220
- * We load the defined locale but for now we only support the first subtag for messages
221
- *
222
- * @param {HTMLElement} element element we need to get the language
223
- * @returns {{ locale: string; messages: unknown }} messages object
224
- */
225
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
- const initLocales = (element) => {
227
- // Get local
228
- const locale = getLocale(element);
229
- // Only keep first subtag
230
- const localeSubtag = locale.split('-').shift();
231
- // Return
232
- return {
233
- locale,
234
- messages: messages[localeSubtag] || messages[defaultLocale],
235
- };
236
- };
237
-
238
- export { ClassList as C, isTagName as a, allItemsAreString as b, createID as c, initLocales as i };
@@ -1,124 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-aad0184c.js';
2
- import { c as createID, C as ClassList, i as initLocales } from './index-7efedd97.js';
3
-
4
- const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
5
-
6
- const MgModal = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.componentShow = createEvent(this, "component-show", 7);
10
- this.componentHide = createEvent(this, "component-hide", 7);
11
- /************
12
- * Internal *
13
- ************/
14
- // Classes
15
- this.classHide = 'mg-modal--hide';
16
- // IDs
17
- this.closeButtonId = '';
18
- this.titleId = '';
19
- /**
20
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
21
- * If not set, it will be created.
22
- */
23
- this.identifier = createID('mg-modal');
24
- /**
25
- * Define if modal has a cross button
26
- */
27
- this.closeButton = false;
28
- /**
29
- * Define if modal is hidden
30
- */
31
- this.hide = false;
32
- /**
33
- * Define if component is using actions slot
34
- */
35
- this.hasActions = false;
36
- /**
37
- * Define if component is using content slot
38
- */
39
- this.hasContent = false;
40
- /**
41
- * Component classes
42
- */
43
- this.classList = new ClassList(['mg-modal']);
44
- /*************
45
- * Handlers *
46
- *************/
47
- /**
48
- * Handle close button
49
- *
50
- * @returns {void}
51
- */
52
- this.handleClose = () => {
53
- this.hide = true;
54
- };
55
- }
56
- validateModalTitle(newValue) {
57
- if (typeof newValue !== 'string' || newValue.trim() === '') {
58
- throw new Error('<mg-modal> prop "modalTitle" is required.');
59
- }
60
- }
61
- validateHide(newValue) {
62
- if (newValue) {
63
- this.componentHide.emit();
64
- this.classList.add(this.classHide);
65
- document.body.style.overflow = this.bodyOverflow;
66
- }
67
- else {
68
- this.componentShow.emit();
69
- this.classList.delete(this.classHide);
70
- document.body.style.overflow = 'hidden';
71
- }
72
- }
73
- /**
74
- * Handle 'escape' key down
75
- *
76
- * @param {KeyboardEvent} event keydown event
77
- * @returns {void}
78
- */
79
- handleKeyDown(event) {
80
- // we can use 'Escape button" when this not a blocking modal, induced by closeButton value.
81
- if (this.closeButton && event.key === 'Escape') {
82
- this.hide = true;
83
- }
84
- }
85
- /*************
86
- * Lifecycle *
87
- *************/
88
- /**
89
- * Check if component props are well configured on init
90
- *
91
- * @returns {void}
92
- */
93
- componentWillLoad() {
94
- // Store body overflow
95
- this.bodyOverflow = document.body.style.overflow;
96
- // Get locales
97
- this.messages = initLocales(this.element).messages;
98
- // Validate
99
- this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
100
- this.hasContent = this.element.querySelector('[slot="content"]') !== null;
101
- if (this.closeButton) {
102
- this.closeButtonId = `${this.identifier}-close-button`;
103
- }
104
- this.titleId = `${this.identifier}-title`;
105
- this.validateModalTitle(this.modalTitle);
106
- this.validateHide(this.hide);
107
- }
108
- /**
109
- * Render
110
- *
111
- * @returns {HTMLElement} HTML Element
112
- */
113
- render() {
114
- return (h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("article", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" }))))));
115
- }
116
- get element() { return getElement(this); }
117
- static get watchers() { return {
118
- "modalTitle": ["validateModalTitle"],
119
- "hide": ["validateHide"]
120
- }; }
121
- };
122
- MgModal.style = mgModalCss;
123
-
124
- export { MgModal as mg_modal };
@@ -1 +0,0 @@
1
- function e(e="",a=10){let t="";const n="abcdefghijklmnopqrstuvwxyz0123456789",r=n.length;for(let e=0;e<a;e++)t+=n.charAt(Math.floor(Math.random()*r));return(""!==e?`${e}-`:"")+t}class a{constructor(e=[]){this.add=e=>{this.has(e)||this.classes.push(e)},this.delete=e=>{const a=this.classes.indexOf(e);a>-1&&this.classes.splice(a,1)},this.has=e=>this.classes.includes(e),this.join=()=>this.classes.join(" "),this.classes=e}}function t(e){return e&&e.every((e=>"string"==typeof e))}function n(e,a){return a.includes(null==e?void 0:e.tagName.toLowerCase())}const r={en:{errors:{required:"This field is required.",date:{badInput:'The date format must be <span aria-hidden="true">mm/dd/yyyy</span><span class="sr-only">m m / d d / y y y y</span> and the date must be greater than {min}',min:"The date cannot be earlier than {min}",max:"The date cannot be later than {max}",minMax:"The date must be between {min} and {max}"},numeric:{min:"The value cannot be less than {min}",max:"The value cannot be greater than {max}",minMax:"The value must be between {min} et {max}"}},nbCharLeft:"{counter} characters left.",input:{select:{placeholder:"Select a value"}},form:{required:'Fields with a <strong class="is-asterisk">*</strong> are required',allRequired:"All fields are required"},message:{closeButton:"Close message"},modal:{closeButton:"Close modal"},pagination:{label:"Pagination",page:"page",pages:"pages",nextPage:"Next page",previousPage:"Previous page",selectPage:"Select the page to display."},panel:{editLabel:"Edit section title."},general:{confirm:"Confirm",cancel:"Cancel",close:"Close",next:"next",previous:"previous"}},fr:{errors:{required:"Ce champ est obligatoire.",date:{badInput:'Le format de la date doit être du type <span aria-hidden="true">jj/mm/aaaa</span><span class="sr-only">j j / m m / a a a a</span> et la date supérieure au {min}',min:"La date ne peut pas être antérieure au {min}",max:"La date ne peut pas être postérieure au {max}",minMax:"La date doit être comprise entre le {min} et le {max}"},numeric:{min:"La valeur ne peut pas être inférieure à {min}",max:"La valeur ne peut pas être supérieure à {max}",minMax:"La valeur doit être comprise entre {min} et {max}"}},nbCharLeft:"{counter} caractères disponibles.",input:{select:{placeholder:"Sélectionnez une valeur"}},form:{required:'Les champs marqués d\'un <strong class="is-asterisk">*</strong> sont obligatoires',allRequired:"Tous les champs sont obligatoires"},message:{closeButton:"Fermer le message"},modal:{closeButton:"Fermer la modale"},pagination:{label:"Pagination",page:"page",pages:"pages",nextPage:"Page suivante",previousPage:"Page précédente",selectPage:"Sélectionner la page à afficher."},panel:{editLabel:"Modifier le titre de la section."},general:{confirm:"Valider",cancel:"Annuler",close:"Fermer",next:"suivant",previous:"précédent"}}},s=e=>{const a=(e=>{var a;return(null===(a=e.closest("[lang]"))||void 0===a?void 0:a.lang)||navigator.language||"en"})(e),t=a.split("-").shift();return{locale:a,messages:r[t]||r.en}};export{a as C,n as a,t as b,e as c,s as i}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as o,g as a}from"./p-3899d5d2.js";import{c as e,C as s,i as l}from"./p-5f89600c.js";const n=class{constructor(o){t(this,o),this.componentShow=i(this,"component-show",7),this.componentHide=i(this,"component-hide",7),this.classHide="mg-modal--hide",this.closeButtonId="",this.titleId="",this.identifier=e("mg-modal"),this.closeButton=!1,this.hide=!1,this.hasActions=!1,this.hasContent=!1,this.classList=new s(["mg-modal"]),this.handleClose=()=>{this.hide=!0}}validateModalTitle(t){if("string"!=typeof t||""===t.trim())throw new Error('<mg-modal> prop "modalTitle" is required.')}validateHide(t){t?(this.componentHide.emit(),this.classList.add(this.classHide),document.body.style.overflow=this.bodyOverflow):(this.componentShow.emit(),this.classList.delete(this.classHide),document.body.style.overflow="hidden")}handleKeyDown(t){this.closeButton&&"Escape"===t.key&&(this.hide=!0)}componentWillLoad(){this.bodyOverflow=document.body.style.overflow,this.messages=l(this.element).messages,this.hasActions=null!==this.element.querySelector('[slot="actions"]'),this.hasContent=null!==this.element.querySelector('[slot="content"]'),this.closeButton&&(this.closeButtonId=`${this.identifier}-close-button`),this.titleId=`${this.identifier}-title`,this.validateModalTitle(this.modalTitle),this.validateHide(this.hide)}render(){return o("section",{role:"dialog",id:this.identifier,class:this.classList.join(),tabindex:"-1","aria-labelledby":this.titleId,"aria-modal":"true","aria-hidden":this.hide},o("article",{class:"mg-modal__dialog"},o("header",{class:"mg-modal__header"},this.closeButton&&o("span",{class:"mg-modal__close-button"},o("mg-button",{identifier:this.closeButtonId,"is-icon":!0,variant:"flat",label:this.messages.modal.closeButton,onClick:this.handleClose},o("mg-icon",{icon:"cross"}))),o("h1",{class:"mg-modal__title",id:this.titleId},this.modalTitle)),this.hasContent&&o("article",{class:"mg-modal__content"},o("slot",{name:"content"})),this.hasActions&&o("footer",{class:"mg-modal__footer"},o("slot",{name:"actions"}))))}get element(){return a(this)}static get watchers(){return{modalTitle:["validateModalTitle"],hide:["validateHide"]}}};n.style=".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";export{n as mg_modal}