@mgdis/mg-components 6.15.0 → 6.16.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 (88) hide show
  1. package/dist/cjs/events.utils-D5SAtkpQ.js +25 -0
  2. package/dist/cjs/{index-BGxkpQwi.js → index-T3-qWqFE.js} +2 -2
  3. package/dist/cjs/{index-iUZvsp-F.js → index-YM1EJx9X.js} +8 -20
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/mg-action-more_37.cjs.entry.js +68 -305
  6. package/dist/cjs/mg-alert.cjs.entry.js +2 -2
  7. package/dist/cjs/mg-components.cjs.js +3 -3
  8. package/dist/cjs/mg-input-combobox.cjs.entry.js +78 -140
  9. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +3 -3
  10. package/dist/cjs/{mg-input.conf-CwjEAih3.js → mg-input.conf-WTsvDfpC.js} +0 -7
  11. package/dist/cjs/mg-loader.cjs.entry.js +2 -2
  12. package/dist/cjs/mg-progress.cjs.entry.js +1 -1
  13. package/dist/collection/collection-manifest.json +1 -1
  14. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +0 -6
  15. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +22 -93
  16. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -2
  17. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +13 -69
  18. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +54 -136
  19. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -63
  20. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +6 -54
  21. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -142
  22. package/dist/collection/locales/en/messages.json +3 -8
  23. package/dist/collection/locales/fr/messages.json +3 -8
  24. package/dist/components/index2.js +1 -1
  25. package/dist/components/index3.js +8 -20
  26. package/dist/components/mg-details.js +97 -1
  27. package/dist/components/mg-input-checkbox-paginated2.js +1 -2
  28. package/dist/components/mg-input-checkbox.js +19 -63
  29. package/dist/components/mg-input-combobox.js +60 -130
  30. package/dist/components/mg-input-date.js +1 -7
  31. package/dist/components/mg-input-numeric.js +1 -7
  32. package/dist/components/mg-input-password.js +2 -8
  33. package/dist/components/mg-input-radio.js +12 -53
  34. package/dist/components/mg-input-rich-text-editor.js +1 -7
  35. package/dist/components/mg-input-select2.js +8 -44
  36. package/dist/components/mg-input-text2.js +2 -8
  37. package/dist/components/mg-input-textarea.js +2 -8
  38. package/dist/components/mg-input-toggle.js +11 -96
  39. package/dist/components/mg-input2.js +22 -99
  40. package/dist/components/mg-pagination.js +2 -8
  41. package/dist/components/mg-panel.js +7 -13
  42. package/dist/esm/events.utils-yMGqY8YG.js +23 -0
  43. package/dist/esm/{index-CKB-AnCZ.js → index-Bab8_u8S.js} +8 -20
  44. package/dist/esm/{index-DhAOnZJn.js → index-JHj_9FSs.js} +2 -2
  45. package/dist/esm/loader.js +3 -3
  46. package/dist/esm/mg-action-more_37.entry.js +64 -301
  47. package/dist/esm/mg-alert.entry.js +2 -2
  48. package/dist/esm/mg-components.js +4 -4
  49. package/dist/esm/mg-input-combobox.entry.js +59 -121
  50. package/dist/esm/mg-input-rich-text-editor.entry.js +3 -3
  51. package/dist/esm/{mg-input.conf-BAUTlb6r.js → mg-input.conf-CNgv8hc5.js} +1 -7
  52. package/dist/esm/mg-loader.entry.js +2 -2
  53. package/dist/esm/mg-progress.entry.js +1 -1
  54. package/dist/mg-components/locales/en/messages.json +3 -8
  55. package/dist/mg-components/locales/fr/messages.json +3 -8
  56. package/dist/mg-components/mg-components.esm.js +1 -1
  57. package/dist/mg-components/{p-420daa1e.entry.js → p-42a90251.entry.js} +1 -1
  58. package/dist/mg-components/p-54156253.entry.js +1 -0
  59. package/dist/mg-components/{p-47e19783.entry.js → p-658f828c.entry.js} +1 -1
  60. package/dist/mg-components/{p-67af6274.entry.js → p-82455ac7.entry.js} +1 -1
  61. package/dist/mg-components/p-Bab8_u8S.js +1 -0
  62. package/dist/mg-components/p-CNgv8hc5.js +1 -0
  63. package/dist/mg-components/{p-DhAOnZJn.js → p-JHj_9FSs.js} +1 -1
  64. package/dist/mg-components/p-abbd151c.entry.js +1 -0
  65. package/dist/mg-components/{p-a0fa44cf.entry.js → p-c85b5d10.entry.js} +1 -1
  66. package/dist/mg-components/p-yMGqY8YG.js +1 -0
  67. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +0 -13
  68. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +4 -15
  69. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +3 -21
  70. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +2 -16
  71. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -18
  72. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -18
  73. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -40
  74. package/dist/types/components.d.ts +7 -63
  75. package/ide/intellij/web-types.json +10 -136
  76. package/ide/vscode/html-custom-data.json +6 -104
  77. package/package.json +20 -20
  78. package/dist/cjs/mg-input.utils-D-ASK4ua.js +0 -49
  79. package/dist/collection/components/molecules/inputs/mg-input/mg-input.utils.js +0 -21
  80. package/dist/components/mg-details2.js +0 -99
  81. package/dist/components/mg-input.utils.js +0 -24
  82. package/dist/esm/mg-input.utils-BYI03zSi.js +0 -46
  83. package/dist/mg-components/p-31856cff.entry.js +0 -1
  84. package/dist/mg-components/p-698dfc6c.entry.js +0 -1
  85. package/dist/mg-components/p-BAUTlb6r.js +0 -1
  86. package/dist/mg-components/p-CKB-AnCZ.js +0 -1
  87. package/dist/mg-components/p-PuX-pdL4.js +0 -1
  88. package/dist/types/components/molecules/inputs/mg-input/mg-input.utils.d.ts +0 -8
@@ -1,8 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { ClassList, allItemsAreString, isValidString, toString } from "@mgdis/core-ui-helpers/dist/utils";
3
3
  import { classDisabled, classReadonly } from "../mg-input/mg-input.conf";
4
- import { initLocales } from "../../../../locales";
5
- import { defineErrorMessage } from "../mg-input/mg-input.utils";
6
4
  /**
7
5
  * type Option validation function
8
6
  * @param option - radio option
@@ -60,29 +58,6 @@ export class MgInputToggle {
60
58
  * Checked internal value
61
59
  */
62
60
  this.checked = false;
63
- /**
64
- * Check if input is valid
65
- */
66
- this.checkValidity = () => {
67
- this.setValidity(this.readonly || this.disabled || this.hasInputItems());
68
- };
69
- /**
70
- * Reset error message
71
- */
72
- this.resetErrorMessage = () => {
73
- this.checkValidity();
74
- this.errorMessage = undefined;
75
- };
76
- /**
77
- * Test if component has items
78
- * @returns truthy if component has items
79
- */
80
- this.hasInputItems = () => { var _a; return ((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) > 0; };
81
- /**
82
- * Test if component has no value error message displayed
83
- * @returns truthy if compent display no value error message
84
- */
85
- this.hasNoValueErrorMessageDisplay = () => this.errorMessage === this.messages.errors.noValue;
86
61
  /**
87
62
  * Set input error message
88
63
  * @param errorMessage - errorMessage override
@@ -91,13 +66,8 @@ export class MgInputToggle {
91
66
  // Set error message
92
67
  this.errorMessage = undefined;
93
68
  // Does have a custom error message
94
- if (!this.valid) {
95
- if (errorMessage !== undefined) {
96
- this.errorMessage = errorMessage;
97
- }
98
- else if (!this.hasInputItems()) {
99
- this.errorMessage = this.messages.errors.noValue;
100
- }
69
+ if (!this.valid && errorMessage !== undefined) {
70
+ this.errorMessage = errorMessage;
101
71
  }
102
72
  };
103
73
  /**
@@ -112,7 +82,7 @@ export class MgInputToggle {
112
82
  this.validateSlots = () => {
113
83
  const slots = Array.from(this.element.children);
114
84
  if (slots.length !== 2) {
115
- console.error('<mg-input-toggle> 2 slots are required.');
85
+ throw new Error('<mg-input-toggle> 2 slots are required.');
116
86
  }
117
87
  else if (!this.isIcon) {
118
88
  // Due to text-overflow set to ellipsis
@@ -143,28 +113,16 @@ export class MgInputToggle {
143
113
  this.valueChange.emit(newValue);
144
114
  }
145
115
  validateItems(newValue) {
146
- if ([undefined, null].includes(newValue) || (Array.isArray(newValue) && newValue.length === 0)) {
147
- this.options = [];
148
- this.displayError();
149
- }
150
- else if (Array.isArray(newValue) && this.items.length !== 2) {
116
+ if (typeof newValue === 'object' && this.items.length !== 2) {
151
117
  throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${toString(newValue)}.`);
152
118
  }
153
119
  // String array
154
120
  else if (allItemsAreString(newValue)) {
155
121
  this.options = newValue.map(item => ({ title: item, value: item }));
156
- // force to reset error when noValueError is displaied
157
- if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
158
- this.resetErrorMessage();
159
- }
160
122
  }
161
123
  // Object array
162
124
  else if (Array.isArray(newValue) && newValue.every(isOption)) {
163
125
  this.options = newValue;
164
- // force to reset error when noValueError is displaied
165
- if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
166
- this.resetErrorMessage();
167
- }
168
126
  }
169
127
  else {
170
128
  throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${toString(newValue)}.`);
@@ -226,7 +184,8 @@ export class MgInputToggle {
226
184
  throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
227
185
  }
228
186
  else {
229
- this.setValidity(valid);
187
+ this.valid = valid;
188
+ this.inputValid.emit(valid);
230
189
  this.setErrorMessage(valid ? undefined : errorMessage);
231
190
  }
232
191
  }
@@ -245,43 +204,12 @@ export class MgInputToggle {
245
204
  // - Keep everything in sync both inside and outside the component
246
205
  return new Promise(resolve => {
247
206
  requestAnimationFrame(() => {
248
- this.resetErrorMessage();
207
+ this.errorMessage = undefined;
249
208
  resolve();
250
209
  });
251
210
  });
252
211
  }
253
212
  }
254
- /**
255
- * Display input error if it exists.
256
- */
257
- displayError() {
258
- // Use `Promise` as requested for stencil method
259
- // Use `requestAnimationFrame` to ensure:
260
- // - DOM is fully updated before validation
261
- // - Async operations are completed
262
- // - No timing issues with Stencil's render cycle
263
- // - Keep everything in sync both inside and outside the component
264
- return new Promise(resolve => {
265
- requestAnimationFrame(() => {
266
- this.checkValidity();
267
- this.setErrorMessage();
268
- resolve();
269
- });
270
- });
271
- }
272
- /**
273
- * Method to set validity values
274
- * @param newValue - valid new value
275
- */
276
- setValidity(newValue) {
277
- const oldValidValue = this.valid;
278
- this.valid = newValue;
279
- this.invalid = !this.valid;
280
- // We need to send valid event even if it is the same value
281
- if (this.valid !== oldValidValue) {
282
- this.inputValid.emit(this.valid);
283
- }
284
- }
285
213
  /**
286
214
  * set checked state
287
215
  */
@@ -300,9 +228,6 @@ export class MgInputToggle {
300
228
  const selectedValue = this.value === this.options[optionTrueValueIndex].value;
301
229
  this.checked = optionTrueValueIndex === 0 ? !selectedValue : selectedValue;
302
230
  }
303
- else if (Array.isArray(this.options) && this.options.length === 0) {
304
- return;
305
- }
306
231
  else {
307
232
  this.checked = this.value === this.options[1].value;
308
233
  }
@@ -314,8 +239,6 @@ export class MgInputToggle {
314
239
  * Check if component props are well configured on init
315
240
  */
316
241
  componentWillLoad() {
317
- // Get locales
318
- this.messages = initLocales(this.element).messages;
319
242
  // Check items format
320
243
  this.validateItems(this.items);
321
244
  // Check slots
@@ -334,7 +257,7 @@ export class MgInputToggle {
334
257
  */
335
258
  render() {
336
259
  const checkedItem = this.getCheckedItem(this.checked);
337
- return (h("mg-input", { key: 'a17e505f60d3c7e37f18db5d5c94e8d4a03b3949', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: defineErrorMessage(this.errorMessage, this.noValueErrorDetail) }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly || !this.hasInputItems(), onClick: this.toggleChecked, ref: el => {
260
+ return (h("mg-input", { key: '7611cffaf1c01e30c3fa7a27555f94ab357dd374', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked, ref: el => {
338
261
  if (el !== null)
339
262
  this.button = el;
340
263
  } }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
@@ -637,63 +560,6 @@ export class MgInputToggle {
637
560
  "getter": false,
638
561
  "setter": false,
639
562
  "reflect": false
640
- },
641
- "noValueErrorDetail": {
642
- "type": "string",
643
- "attribute": "no-value-error-detail",
644
- "mutable": false,
645
- "complexType": {
646
- "original": "string",
647
- "resolved": "string",
648
- "references": {}
649
- },
650
- "required": false,
651
- "optional": true,
652
- "docs": {
653
- "tags": [],
654
- "text": "Define no value error detail"
655
- },
656
- "getter": false,
657
- "setter": false,
658
- "reflect": false
659
- },
660
- "valid": {
661
- "type": "boolean",
662
- "attribute": "valid",
663
- "mutable": true,
664
- "complexType": {
665
- "original": "boolean",
666
- "resolved": "boolean",
667
- "references": {}
668
- },
669
- "required": false,
670
- "optional": false,
671
- "docs": {
672
- "tags": [],
673
- "text": "Define input valid state"
674
- },
675
- "getter": false,
676
- "setter": false,
677
- "reflect": false
678
- },
679
- "invalid": {
680
- "type": "boolean",
681
- "attribute": "invalid",
682
- "mutable": true,
683
- "complexType": {
684
- "original": "boolean",
685
- "resolved": "boolean",
686
- "references": {}
687
- },
688
- "required": false,
689
- "optional": false,
690
- "docs": {
691
- "tags": [],
692
- "text": "Define input invalid state"
693
- },
694
- "getter": false,
695
- "setter": false,
696
- "reflect": false
697
563
  }
698
564
  };
699
565
  }
@@ -702,6 +568,7 @@ export class MgInputToggle {
702
568
  "classCollection": {},
703
569
  "options": {},
704
570
  "errorMessage": {},
571
+ "valid": {},
705
572
  "checked": {}
706
573
  };
707
574
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "errors": {
3
- "required": "This field is required.",
4
- "noValue": "No value."
3
+ "required": "This field is required."
5
4
  },
6
5
  "nbCharLeft": "{counter} characters left.",
7
6
  "input": {
@@ -116,8 +115,8 @@
116
115
  "confirm": "Confirm",
117
116
  "cancel": "Cancel",
118
117
  "close": "Close",
119
- "next": "next",
120
- "previous": "previous",
118
+ "next": "Next",
119
+ "previous": "Previous",
121
120
  "reset": "reset"
122
121
  },
123
122
  "menuItem": {
@@ -135,9 +134,5 @@
135
134
  },
136
135
  "table": {
137
136
  "sortableCaption": "(column headers with buttons are sortable)"
138
- },
139
- "details": {
140
- "toggleClosed": "Show details",
141
- "toggleOpened": "Hide details"
142
137
  }
143
138
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "errors": {
3
- "required": "Ce champ est obligatoire.",
4
- "noValue": "Aucune valeur."
3
+ "required": "Ce champ est obligatoire."
5
4
  },
6
5
  "nbCharLeft": "{counter} caractères disponibles.",
7
6
  "input": {
@@ -116,8 +115,8 @@
116
115
  "confirm": "Valider",
117
116
  "cancel": "Annuler",
118
117
  "close": "Fermer",
119
- "next": "suivant",
120
- "previous": "précédent",
118
+ "next": "Suivant",
119
+ "previous": "Précédent",
121
120
  "reset": "réinitialiser"
122
121
  },
123
122
  "menuItem": {
@@ -135,9 +134,5 @@
135
134
  },
136
135
  "table": {
137
136
  "sortableCaption": "(les en-têtes de colonnes avec des boutons peuvent être triés)"
138
- },
139
- "details": {
140
- "toggleClosed": "Voir le detail",
141
- "toggleOpened": "Masquer le detail"
142
137
  }
143
138
  }
@@ -405,4 +405,4 @@ const getChildWindows = (localWindow, windows = []) => {
405
405
  return windows;
406
406
  };
407
407
 
408
- export { ClassList as C, Paginate as P, isValideID as a, isTagName as b, createID as c, allItemsAreString as d, Cursor as e, formatID as f, getWindows as g, isObject as h, isValidString as i, Page as j, getObjectValueFromKey as k, focusableElements as l, cleanString as m, nextTick as n, dateRegExp as o, dateToString as p, isValidNumber as q, toString as t };
408
+ export { ClassList as C, Paginate as P, isValideID as a, isTagName as b, createID as c, allItemsAreString as d, Cursor as e, formatID as f, getWindows as g, Page as h, isValidString as i, getObjectValueFromKey as j, isObject as k, focusableElements as l, cleanString as m, nextTick as n, dateRegExp as o, dateToString as p, isValidNumber as q, toString as t };
@@ -1,6 +1,5 @@
1
1
  const errors$1 = {
2
- required: "This field is required.",
3
- noValue: "No value."
2
+ required: "This field is required."
4
3
  };
5
4
  const nbCharLeft$1 = "{counter} characters left.";
6
5
  const input$1 = {
@@ -117,8 +116,8 @@ const general$1 = {
117
116
  confirm: "Confirm",
118
117
  cancel: "Cancel",
119
118
  close: "Close",
120
- next: "next",
121
- previous: "previous",
119
+ next: "Next",
120
+ previous: "Previous",
122
121
  reset: "reset"
123
122
  };
124
123
  const menuItem$1 = {
@@ -137,10 +136,6 @@ const loader$1 = {
137
136
  const table$1 = {
138
137
  sortableCaption: "(column headers with buttons are sortable)"
139
138
  };
140
- const details$1 = {
141
- toggleClosed: "Show details",
142
- toggleOpened: "Hide details"
143
- };
144
139
  var en = {
145
140
  errors: errors$1,
146
141
  nbCharLeft: nbCharLeft$1,
@@ -156,13 +151,11 @@ var en = {
156
151
  itemMore: itemMore$1,
157
152
  actionMore: actionMore$1,
158
153
  loader: loader$1,
159
- table: table$1,
160
- details: details$1
154
+ table: table$1
161
155
  };
162
156
 
163
157
  const errors = {
164
- required: "Ce champ est obligatoire.",
165
- noValue: "Aucune valeur."
158
+ required: "Ce champ est obligatoire."
166
159
  };
167
160
  const nbCharLeft = "{counter} caractères disponibles.";
168
161
  const input = {
@@ -279,8 +272,8 @@ const general = {
279
272
  confirm: "Valider",
280
273
  cancel: "Annuler",
281
274
  close: "Fermer",
282
- next: "suivant",
283
- previous: "précédent",
275
+ next: "Suivant",
276
+ previous: "Précédent",
284
277
  reset: "réinitialiser"
285
278
  };
286
279
  const menuItem = {
@@ -299,10 +292,6 @@ const loader = {
299
292
  const table = {
300
293
  sortableCaption: "(les en-têtes de colonnes avec des boutons peuvent être triés)"
301
294
  };
302
- const details = {
303
- toggleClosed: "Voir le detail",
304
- toggleOpened: "Masquer le detail"
305
- };
306
295
  var fr = {
307
296
  errors: errors,
308
297
  nbCharLeft: nbCharLeft,
@@ -318,8 +307,7 @@ var fr = {
318
307
  itemMore: itemMore,
319
308
  actionMore: actionMore,
320
309
  loader: loader,
321
- table: table,
322
- details: details
310
+ table: table
323
311
  };
324
312
 
325
313
  /**
@@ -1,4 +1,100 @@
1
- import { M as MgDetails$1, d as defineCustomElement$1 } from './mg-details2.js';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { i as isValidString } from './index2.js';
3
+ import { d as defineCustomElement$2 } from './mg-icon2.js';
4
+
5
+ const mgDetailsCss = ".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}}/*!\n * @prop --mg-c-details-spacing: Defines the spacing between the summary and the details. Default value: `--mg-b-size-8`.\n */.mg-c-details summary{display:inline-flex;align-items:baseline;cursor:pointer;gap:var(--mg-b-size-16)}.mg-c-details summary::-webkit-details-marker{display:none}.mg-c-details.mg-c-details--empty-summary summary{gap:unset}.mg-c-details__toggle{display:flex;min-height:calc(var(--mg-b-font-size)*var(--mg-b-line-height));flex-shrink:0;align-items:center;align-self:flex-start;gap:var(--mg-b-size-4)}.mg-c-details__toggle-icon.mg-c-details__toggle-icon--reverse{transform:rotate(180deg)}.mg-c-details__details{margin-top:var(--mg-c-details-spacing)}@media (width < 43.75rem){.mg-c-details:not(.mg-c-details--empty-summary) .mg-c-details__toggle>span{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}}";
6
+
7
+ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class MgDetails extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ this.expandedChange = createEvent(this, "expanded-change", 7);
13
+ /**
14
+ * Hide summary element
15
+ */
16
+ this.hideSummary = false;
17
+ /**
18
+ * Define if details are diplayed
19
+ */
20
+ this.expanded = false;
21
+ /**
22
+ * Handle details toggle
23
+ */
24
+ this.handleToggle = () => {
25
+ this.expanded = this.details.open;
26
+ };
27
+ }
28
+ validateTitles(newValue) {
29
+ if (!isValidString(newValue)) {
30
+ throw new Error(`<mg-details> prop "toggleClosed" and "toggleOpened" is required and must be a valid string. Passed value: "toggleClosed='${this.toggleClosed}'" and "toggleOpened='${this.toggleOpened}'".`);
31
+ }
32
+ }
33
+ handleExpanded(newValue) {
34
+ this.expandedChange.emit(newValue);
35
+ }
36
+ /*************
37
+ * Lifecycle *
38
+ *************/
39
+ /**
40
+ * Check if component props are well configured on init
41
+ */
42
+ componentWillLoad() {
43
+ this.validateTitles(this.toggleClosed);
44
+ this.validateTitles(this.toggleOpened);
45
+ // Check if summary slot is empty
46
+ const summarySlot = this.element.querySelector('[slot="summary"]');
47
+ this.isEmptySummary = summarySlot === null || !isValidString(summarySlot.textContent);
48
+ // Add event listener to prevent default action on summary click
49
+ this.element.addEventListener('click', (event) => {
50
+ if (event.target.closest('[slot="summary"] mg-button, mg-button[slot="summary"]') !== null) {
51
+ event.preventDefault();
52
+ }
53
+ });
54
+ }
55
+ /**
56
+ * Render
57
+ * @returns HTML Element
58
+ */
59
+ render() {
60
+ return (h("details", { key: '4da17afd7a964a14b5b101bcfadc241be569d55a', class: { 'mg-c-details': true, 'mg-c-details--empty-summary': this.isEmptySummary }, onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: '515d6c4e117b547fe80a310fb90e114900f645e8' }, h("slot", { key: '0c9c0dcc47dd418e34e541d878bfc03ca137c68d', name: "summary" }), h("span", { key: 'c94f52994843b10c1161c0d85f38f8cb917ea806', class: "mg-c-details__toggle" }, h("mg-icon", { key: '9421452572af3deb03146a8dfd189369b249ba2d', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: 'dbfb0b34da00e37f55ec07236611c2babdd6b7c5', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: '1b18b65a98e39a8663fa5d7e51eef5fbe2b92f76', class: "mg-c-details__details" }, h("slot", { key: '81c213594b1b67747db439624090784eaa5e6fcd', name: "details" }))));
61
+ }
62
+ get element() { return this; }
63
+ static get watchers() { return {
64
+ "toggleClosed": ["validateTitles"],
65
+ "toggleOpened": ["validateTitles"],
66
+ "expanded": ["handleExpanded"]
67
+ }; }
68
+ static get style() { return mgDetailsCss; }
69
+ }, [257, "mg-details", {
70
+ "toggleClosed": [1, "toggle-closed"],
71
+ "toggleOpened": [1, "toggle-opened"],
72
+ "hideSummary": [4, "hide-summary"],
73
+ "expanded": [1028]
74
+ }, undefined, {
75
+ "toggleClosed": ["validateTitles"],
76
+ "toggleOpened": ["validateTitles"],
77
+ "expanded": ["handleExpanded"]
78
+ }]);
79
+ function defineCustomElement$1() {
80
+ if (typeof customElements === "undefined") {
81
+ return;
82
+ }
83
+ const components = ["mg-details", "mg-icon"];
84
+ components.forEach(tagName => { switch (tagName) {
85
+ case "mg-details":
86
+ if (!customElements.get(tagName)) {
87
+ customElements.define(tagName, MgDetails$1);
88
+ }
89
+ break;
90
+ case "mg-icon":
91
+ if (!customElements.get(tagName)) {
92
+ defineCustomElement$2();
93
+ }
94
+ break;
95
+ } });
96
+ }
97
+ defineCustomElement$1();
2
98
 
3
99
  const MgDetails = MgDetails$1;
4
100
  const defineCustomElement = defineCustomElement$1;
@@ -8,8 +8,7 @@ import { d as defineCustomElement$1 } from './mg-icon2.js';
8
8
  * @param props - MgInputCheckboxList Interface Props
9
9
  * @returns input template
10
10
  */
11
- const MgInputCheckboxList = (props) => Array.isArray(props.checkboxes) &&
12
- props.checkboxes.length > 0 && (h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-labelledby": props.labelledby, id: props.id }, props.checkboxes.map(input => {
11
+ const MgInputCheckboxList = (props) => (h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-labelledby": props.labelledby, id: props.id }, props.checkboxes.map(input => {
13
12
  var _a, _b;
14
13
  return (h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } },
15
14
  h("input", { type: "checkbox", id: input._id, name: props.name, value: (_a = input.value) === null || _a === void 0 ? void 0 : _a.toString(), checked: Boolean(input.value), required: input.required, "aria-invalid": ((_b = props.invalid) === null || _b === void 0 ? void 0 : _b.toString()) || 'false', disabled: props.disabled || input.disabled, indeterminate: input.value === null, onInput: input._handleInput, onBlur: input._handleBlur, onKeyDown: input._handleKeydown }),