@mgdis/mg-components 5.12.0 → 5.13.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 (69) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{mg-action-more_31.cjs.entry.js → mg-action-more_32.cjs.entry.js} +325 -137
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/cjs/mg-item-more.cjs.entry.js +1 -1
  5. package/dist/cjs/{mg-menu.conf-79f0c761.js → mg-menu.conf-857748e1.js} +20 -2
  6. package/dist/collection/collection-manifest.json +1 -0
  7. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +15 -0
  8. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +259 -0
  9. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +16 -0
  10. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +41 -3
  11. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +106 -100
  12. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
  13. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +1 -1
  14. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -1
  15. package/dist/collection/components/molecules/mg-details/mg-details.css +3 -5
  16. package/dist/collection/components/molecules/mg-modal/mg-modal.js +1 -1
  17. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +3 -0
  18. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
  19. package/dist/collection/components/molecules/mg-panel/mg-panel.conf.js +8 -0
  20. package/dist/collection/components/molecules/mg-panel/mg-panel.css +9 -5
  21. package/dist/collection/components/molecules/mg-panel/mg-panel.js +133 -47
  22. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +1 -0
  23. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  24. package/dist/collection/locales/en/messages.json +13 -1
  25. package/dist/collection/locales/fr/messages.json +7 -1
  26. package/dist/collection/stories/icon-gallery.js +9 -0
  27. package/dist/collection/variables.css +7 -2
  28. package/dist/components/index.d.ts +1 -0
  29. package/dist/components/index.js +1 -0
  30. package/dist/components/index2.js +20 -2
  31. package/dist/components/mg-details.js +1 -1
  32. package/dist/components/mg-input-checkbox-paginated.d.ts +11 -0
  33. package/dist/components/mg-input-checkbox-paginated.js +6 -0
  34. package/dist/components/mg-input-checkbox-paginated2.js +205 -0
  35. package/dist/components/mg-input-checkbox.js +114 -108
  36. package/dist/components/mg-menu-item2.js +1 -1
  37. package/dist/components/mg-menu2.js +1 -1
  38. package/dist/components/mg-pagination2.js +4 -2
  39. package/dist/components/mg-panel.js +83 -37
  40. package/dist/components/mg-tabs.js +1 -1
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/{mg-action-more_31.entry.js → mg-action-more_32.entry.js} +325 -138
  43. package/dist/esm/mg-components.js +1 -1
  44. package/dist/esm/mg-item-more.entry.js +1 -1
  45. package/dist/esm/{mg-menu.conf-850d4c6e.js → mg-menu.conf-c31828ca.js} +20 -2
  46. package/dist/mg-components/locales/en/messages.json +13 -1
  47. package/dist/mg-components/locales/fr/messages.json +7 -1
  48. package/dist/mg-components/mg-components.css +1 -1
  49. package/dist/mg-components/mg-components.esm.js +1 -1
  50. package/dist/mg-components/p-622e2323.js +1 -0
  51. package/dist/mg-components/p-bda0b795.entry.js +1 -0
  52. package/dist/mg-components/{p-67ba5d05.entry.js → p-d37b29bb.entry.js} +1 -1
  53. package/dist/mg-components/variables.css +7 -2
  54. package/dist/types/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.d.ts +8 -0
  55. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +103 -0
  56. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +50 -12
  57. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +48 -53
  58. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -1
  59. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +0 -1
  60. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +4 -0
  61. package/dist/types/components/molecules/mg-panel/mg-panel.conf.d.ts +16 -0
  62. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +44 -10
  63. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +0 -1
  64. package/dist/types/components.d.ts +125 -19
  65. package/dist/types/locales/index.d.ts +18 -0
  66. package/dist/types/stories/icon-gallery.d.ts +6 -0
  67. package/package.json +23 -13
  68. package/dist/mg-components/p-60b7afd9.entry.js +0 -1
  69. package/dist/mg-components/p-689503fc.js +0 -1
@@ -3,7 +3,8 @@ import { h } from '@stencil/core';
3
3
  import { MgInput } from '../MgInput';
4
4
  import { ClassList } from '../../../../utils/components.utils';
5
5
  import { initLocales } from '../../../../locales';
6
- import { checkboxTypes } from './mg-input-checkbox.conf';
6
+ import { checkboxTypes, SectionKind } from './mg-input-checkbox.conf';
7
+ import { MgInputCheckboxList } from './MgInputCheckboxList';
7
8
  /**
8
9
  * type CheckboxItem validation function
9
10
  * @param items - Checkbox item
@@ -13,30 +14,20 @@ const isCheckboxItems = (items) => Array.isArray(items) &&
13
14
  items.every(item => typeof item === 'object' && typeof item.title === 'string' && (item.value === null || typeof item.value === 'boolean') && item.value !== undefined);
14
15
  export class MgInputCheckbox {
15
16
  constructor() {
16
- /************
17
- * Internal *
18
- ************/
19
- // HTML selector
20
- this.inputs = [];
21
17
  // hasDisplayedError (triggered by blur event)
22
18
  this.hasDisplayedError = false;
23
19
  // style
24
20
  this.baseClassName = 'mg-input--checkbox';
21
+ // "multi" setup
25
22
  this.multiStart = 5;
26
23
  this.searchStart = 10;
27
- this.searchOffset = 10;
28
24
  /**
29
25
  * Handle input event
30
26
  * @param event - input event
31
27
  */
32
28
  this.handleInput = (event) => {
33
- this.checkboxItems = this.checkboxItems.map(item => {
34
- if (item.id === event.target.id) {
35
- item.value = Boolean(event.target.checked);
36
- }
37
- return item;
38
- });
39
- this.value = this.checkboxItems.map(o => ({ value: o.value, title: o.title, disabled: o.disabled }));
29
+ this.updateCheckboxItems('value', Boolean(event.target.checked), item => item.id === event.target.id);
30
+ this.updateValues();
40
31
  this.checkValidity();
41
32
  };
42
33
  /**
@@ -47,10 +38,17 @@ export class MgInputCheckbox {
47
38
  var _a;
48
39
  // track "Tab" key event when popover display (is "multi" type selected)
49
40
  if (event.key === 'Tab' && ((_a = this.mgPopover) === null || _a === void 0 ? void 0 : _a.display)) {
50
- const enableInputs = this.checkboxItems.filter(input => !input.disabled).map(({ id }) => id);
41
+ // when search input and do a back tab we close the popover
42
+ if (Boolean(this.searchInput) && event.shiftKey && this.searchInput.id === event.target.id) {
43
+ this.mgPopover.display = false;
44
+ return;
45
+ }
46
+ const enableInputs = Array.from(this.element.shadowRoot.querySelectorAll('input'))
47
+ .filter(input => !Boolean(input.getAttribute('disabled')))
48
+ .map(({ id }) => id);
51
49
  const originInputIndex = enableInputs.findIndex(id => id === event.target.id);
52
50
  // close popover when tab trigger focus outside its DOM
53
- if ((originInputIndex + 1 >= enableInputs.length && !event.shiftKey) || (originInputIndex === 0 && event.shiftKey))
51
+ if ((originInputIndex + 1 >= enableInputs.length && !event.shiftKey) || (originInputIndex === 0 && event.shiftKey && !Boolean(this.searchInput)))
54
52
  this.mgPopover.display = false;
55
53
  }
56
54
  };
@@ -70,29 +68,54 @@ export class MgInputCheckbox {
70
68
  this.searchValue = event.detail;
71
69
  };
72
70
  /**
73
- * Handle mg-pagination current page change event
74
- * @param event - pagination current page change event
71
+ * popover display-change handler
72
+ * @param event - mg-popover display-change custom event
75
73
  */
76
- this.handleCurrentPageChange = (event) => {
77
- this.currentSearchPage = Number(event.detail);
78
- };
79
74
  this.handleMgPopoverDisplayChange = (event) => {
80
75
  // reset search value
81
76
  if (!event.detail) {
82
77
  this.searchValue = '';
83
- this.setCurrentSearchPage();
78
+ this.checkValidity();
84
79
  }
85
80
  };
81
+ /**
82
+ * Handle select all button
83
+ * @param event - mass action event trigger a global select/unselect on values
84
+ */
85
+ this.handleMassAction = (event) => {
86
+ this.updateCheckboxItems('value', event.detail !== 'selected');
87
+ this.updateValues();
88
+ };
89
+ /**
90
+ * Update values
91
+ */
92
+ this.updateValues = () => {
93
+ this.value = this.checkboxItems.map(o => ({ value: o.value, title: o.title, disabled: o.disabled }));
94
+ };
86
95
  /**
87
96
  * get invalid element
88
97
  * @returns element
89
98
  */
90
- this.getInvalidElement = () => this.inputs.find((input) => input !== null && !input.disabled && !input.checkValidity());
99
+ this.getInvalidElement = () => {
100
+ const items = Array.from(this.element.shadowRoot.querySelectorAll('input[type="checkbox"]'));
101
+ return items.find(input => input !== null && !input.disabled && !input.checkValidity());
102
+ };
103
+ /**
104
+ * Method to update searchResults
105
+ */
106
+ this.updateSearchResults = () => {
107
+ this.searchResults = this.checkboxItems.filter(item => item.title.toLocaleLowerCase().includes(this.searchValue.trim().toLocaleLowerCase()));
108
+ };
109
+ /**
110
+ * Methode to validate if one of inputs value is checked id required
111
+ * @returns truthy if condition is valid
112
+ */
113
+ this.validateRequired = () => !this.required || this.checkboxItems.some(({ value }) => value);
91
114
  /**
92
115
  * Check if input is valid
93
116
  */
94
117
  this.checkValidity = () => {
95
- this.valid = this.readonly || this.disabled || this.getInvalidElement() === undefined;
118
+ this.valid = this.readonly || this.disabled || (this.getInvalidElement() === undefined && this.validateRequired());
96
119
  this.invalid = !this.valid;
97
120
  // We need to send valid event even if it is the same value
98
121
  this.inputValid.emit(this.valid);
@@ -112,14 +135,13 @@ export class MgInputCheckbox {
112
135
  };
113
136
  /**
114
137
  * Set input error message
138
+ * @param displayError - dispay error condition
115
139
  */
116
- this.setErrorMessage = () => {
117
- const invalidElement = this.getInvalidElement();
140
+ this.setErrorMessage = (displayError = true) => {
118
141
  // Set error message
119
142
  this.errorMessage = undefined;
120
- if (!this.valid && invalidElement.validity.valueMissing) {
143
+ if (displayError && !this.valid && !this.validateRequired())
121
144
  this.errorMessage = this.messages.errors.required;
122
- }
123
145
  };
124
146
  /**
125
147
  * Method to get mg-popover identifier
@@ -131,12 +153,6 @@ export class MgInputCheckbox {
131
153
  * @returns items to display
132
154
  */
133
155
  this.getDisplayItems = () => (this.searchValue.length > 0 ? this.searchResults : this.checkboxItems);
134
- /**
135
- * Method to get pagination total-page
136
- * @param checkboxes - checkboxes to paginate
137
- * @returns total page number for pagination
138
- */
139
- this.getPaginationTotalPages = (checkboxes) => Math.ceil(checkboxes.length / this.searchOffset);
140
156
  this.value = undefined;
141
157
  this.type = checkboxTypes[0];
142
158
  this.identifier = undefined;
@@ -157,7 +173,6 @@ export class MgInputCheckbox {
157
173
  this.errorMessage = undefined;
158
174
  this.checkboxItems = [];
159
175
  this.displaySearchInput = undefined;
160
- this.currentSearchPage = 0;
161
176
  this.searchValue = '';
162
177
  this.searchResults = [];
163
178
  }
@@ -168,6 +183,10 @@ export class MgInputCheckbox {
168
183
  title: item.title,
169
184
  value: item.value,
170
185
  disabled: item.disabled,
186
+ required: item.required,
187
+ handleInput: this.handleInput.bind(this),
188
+ handleBlur: this.handleBlur.bind(this),
189
+ handleKeydown: this.handleKeydown.bind(this),
171
190
  }));
172
191
  this.valueChange.emit(newValue);
173
192
  }
@@ -194,13 +213,12 @@ export class MgInputCheckbox {
194
213
  throw new Error('<mg-input-checkbox> prop "displaySelectedValues" can only be used with prop type "multi".');
195
214
  }
196
215
  handleValidityChange(newValue, _oldValue, prop) {
197
- this.inputs.forEach(input => {
198
- input[prop] = newValue;
199
- });
216
+ if (prop !== 'readonly')
217
+ this.updateCheckboxItems(prop, newValue);
200
218
  this.checkValidity();
201
219
  if (this.hasDisplayedError) {
202
- this.setErrorMessage();
203
- this.hasDisplayedError = false;
220
+ this.hasDisplayedError = prop !== 'required';
221
+ this.setErrorMessage(this.hasDisplayedError);
204
222
  }
205
223
  }
206
224
  validateDisabled(newValue) {
@@ -213,13 +231,15 @@ export class MgInputCheckbox {
213
231
  validateCheckboxItems(newValue) {
214
232
  if (newValue.length > this.multiStart)
215
233
  this.type = 'multi';
216
- if (newValue.length > this.searchStart)
234
+ if (newValue.length > this.searchStart) {
217
235
  this.displaySearchInput = this.type === 'multi';
236
+ // refresh search values
237
+ this.updateSearchResults();
238
+ }
218
239
  }
219
- validateSearchValue(newValue) {
220
- this.searchResults = this.checkboxItems.filter(item => item.title.toLocaleLowerCase().includes(newValue.trim().toLocaleLowerCase()));
221
- // after each query we reset pagination
222
- this.setCurrentSearchPage();
240
+ validateSearchValue() {
241
+ // refresh search values
242
+ this.updateSearchResults();
223
243
  }
224
244
  /**
225
245
  * Public method to display errors
@@ -230,29 +250,17 @@ export class MgInputCheckbox {
230
250
  this.hasDisplayedError = this.invalid;
231
251
  }
232
252
  /**
233
- * Reset current-search-page prop
234
- */
235
- setCurrentSearchPage() {
236
- this.currentSearchPage = this.getDisplayItems().length > 0 ? 1 : 0;
237
- }
238
- /**
239
- * Method to get a array range
240
- * @param from - array start index
241
- * @param to - array end index
242
- * @returns array's range
243
- */
244
- getArrayRange(array, from, to) {
245
- return array.slice(from, to);
246
- }
247
- /**
248
- * Get from and to index
249
- * @returns [from,to] index
253
+ * Update ckecboxes item
254
+ * @param key - property to update
255
+ * @param newValue - value to update with
256
+ * @param condition - condtion to applu change on item
250
257
  */
251
- getFromToIndexes() {
252
- const isFirstPage = this.currentSearchPage === 1;
253
- const checkboxItemsFromIndex = isFirstPage ? 0 : (this.currentSearchPage - 1) * this.searchOffset;
254
- const checkboxItemsToIndex = isFirstPage ? this.searchOffset : this.currentSearchPage * this.searchOffset;
255
- return [checkboxItemsFromIndex, checkboxItemsToIndex];
258
+ updateCheckboxItems(key, newValue, condition) {
259
+ this.checkboxItems = this.checkboxItems.map(item => {
260
+ if ((typeof condition === 'function' && condition(item)) || condition === undefined)
261
+ item[key] = newValue;
262
+ return item;
263
+ });
256
264
  }
257
265
  /*************
258
266
  * Lifecycle *
@@ -269,7 +277,6 @@ export class MgInputCheckbox {
269
277
  this.validateValue(this.value);
270
278
  this.validateDisabled(this.disabled);
271
279
  this.validateDisplaySelectedValues(this.displaySelectedValues);
272
- this.setCurrentSearchPage();
273
280
  // Check validity when component is ready
274
281
  // return a promise to process action only in the FIRST render().
275
282
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
@@ -277,6 +284,14 @@ export class MgInputCheckbox {
277
284
  this.checkValidity();
278
285
  }, 0);
279
286
  }
287
+ /**
288
+ * add listeners
289
+ */
290
+ componentDidLoad() {
291
+ var _a, _b;
292
+ this.searchInput = (_a = this.element.shadowRoot.querySelector('mg-input-text')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('input');
293
+ (_b = this.searchInput) === null || _b === void 0 ? void 0 : _b.addEventListener('keydown', this.handleKeydown);
294
+ }
280
295
  /**
281
296
  * Render checkbox multi display values
282
297
  * @param selectedValuesNb - selected values length
@@ -293,16 +308,25 @@ export class MgInputCheckbox {
293
308
  }
294
309
  }
295
310
  /**
296
- * Render paginated checkboxes
311
+ * Render checkboxes by section
297
312
  * @param checkboxes - checkboxes to render
298
- * @returns paginated checkboxes
313
+ * @returns render sections of checkboxes
299
314
  */
300
- renderPaginatedCheckboxes(checkboxes) {
301
- const [checkboxItemsFromIndex, checkboxItemsToIndex] = this.getFromToIndexes();
302
- return [
303
- this.renderCheckboxes(this.getArrayRange(checkboxes, checkboxItemsFromIndex, checkboxItemsToIndex)),
304
- h("mg-pagination", { key: "search-pagination", totalPages: this.getPaginationTotalPages(checkboxes), currentPage: this.currentSearchPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, identifier: `${this.identifier}-pagination` }),
315
+ renderCheckboxBySection(checkboxes) {
316
+ const [checkedValues, notCheckedValues] = checkboxes.reduce((acc, curr) => {
317
+ acc[curr.value ? 0 : 1].push(curr);
318
+ return acc;
319
+ }, [[], []]);
320
+ const baseSection = {
321
+ readonly: this.readonly,
322
+ disabled: this.disabled,
323
+ identifier: this.identifier,
324
+ };
325
+ const sections = [
326
+ Object.assign(Object.assign({}, baseSection), { sectionKind: SectionKind.SELECTED, checkboxes: checkedValues, messages: this.messages.input.checkbox.sections.selected }),
327
+ Object.assign(Object.assign({}, baseSection), { sectionKind: SectionKind.NOT_SELECTED, checkboxes: notCheckedValues, messages: this.messages.input.checkbox.sections.notSelected }),
305
328
  ];
329
+ return sections.map(section => h("mg-input-checkbox-paginated", Object.assign({}, section, { "onMass-action": this.handleMassAction })));
306
330
  }
307
331
  /**
308
332
  * render checkbox multi element
@@ -317,31 +341,14 @@ export class MgInputCheckbox {
317
341
  } }, h("mg-button", { variant: "secondary" }, h("mg-icon", { icon: "list" }), this.renderButtonText(selectedValuesNb)), h("div", { slot: "content" }, this.displaySearchInput && [
318
342
  h("mg-input-text", { key: "input-search", identifier: `${this.identifier}-input-search`, icon: "magnifying-glass", type: "search", placeholder: this.messages.input.checkbox.label, label: this.messages.input.checkbox.label, mgWidth: "full", value: this.searchValue, labelHide: true, displayCharacterLeft: false, name: "q", "onValue-change": this.handleSearchChange, "aria-controls": "search-results items-list" }),
319
343
  h("p", { key: "search-results", role: "status", class: "sr-only", id: "search-results" }, `${checkboxes.length} ${this.messages.input.checkbox[checkboxes.length > 0 ? 'results' : 'result']}`),
320
- ], this.displaySearchInput && this.getPaginationTotalPages(checkboxes) > 1 ? this.renderPaginatedCheckboxes(checkboxes) : this.renderCheckboxes(checkboxes), this.displaySearchInput && checkboxes.length === 0 && h("p", { class: "mg-input__input-checkbox-multi-no-result" }, this.messages.input.checkbox.noResult)))));
321
- }
322
- /**
323
- * Render checkbox element
324
- * @param checkboxes - checkboxes to render
325
- * @returns HTML Element
326
- */
327
- renderCheckboxes(checkboxes) {
328
- return (h("ul", { class: {
329
- 'mg-input__input-group-container': true,
330
- 'mg-input__input-group-container--vertical': this.inputVerticalList || (this.type === 'multi' && !this.readonly),
331
- 'mg-input__input-checkbox-multi-inputs': this.type === 'multi' && !this.readonly,
332
- }, role: "list", "aria-describedby": this.displaySearchInput ? 'search-results' : false, "aria-label": this.displaySearchInput ? this.messages.input.checkbox.searchResults : false, "aria-live": this.displaySearchInput ? 'polite' : false, id: "items-list", key: "checkboxes" }, checkboxes
333
- .filter(item => !this.readonly || item.value)
334
- .map((input, index) => (h("li", { key: input.id, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeydown, ref: el => {
335
- if (el !== null)
336
- this.inputs[index] = el;
337
- } }), h("label", { htmlFor: input.id }, input.title))))));
344
+ ], this.displaySearchInput ? (h("div", { class: "mg-input__input-checkbox-multi-sections-container" }, this.renderCheckboxBySection(checkboxes))) : (h(MgInputCheckboxList, { checkboxes: checkboxes, inputVerticalList: true, type: this.type, readonly: this.readonly, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name })), this.displaySearchInput && checkboxes.length === 0 && h("p", { class: "mg-input__input-checkbox-multi-no-result" }, this.messages.input.checkbox.noResult)))));
338
345
  }
339
346
  /**
340
347
  * Render
341
348
  * @returns HTML Element
342
349
  */
343
350
  render() {
344
- return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, this.type === 'checkbox' || this.readonly ? this.renderCheckboxes(this.checkboxItems) : this.renderCheckboxMulti()));
351
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, this.type === 'checkbox' || this.readonly ? (h(MgInputCheckboxList, { checkboxes: this.checkboxItems, inputVerticalList: this.inputVerticalList, type: this.type, readonly: this.readonly, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name })) : (this.renderCheckboxMulti())));
345
352
  }
346
353
  static get is() { return "mg-input-checkbox"; }
347
354
  static get encapsulation() { return "shadow"; }
@@ -374,7 +381,7 @@ export class MgInputCheckbox {
374
381
  "optional": false,
375
382
  "docs": {
376
383
  "tags": [],
377
- "text": "Component value\nIf item.value is `null`, checkbox will be indeterminate by default\nRequired"
384
+ "text": "Component value\nIf item.value is `null`, checkbox will be indeterminate by default"
378
385
  }
379
386
  },
380
387
  "type": {
@@ -429,7 +436,7 @@ export class MgInputCheckbox {
429
436
  "optional": false,
430
437
  "docs": {
431
438
  "tags": [],
432
- "text": "Input name\nIf not set the value equals the identifier"
439
+ "text": "Define input name\nIf not set the value equals the identifier"
433
440
  },
434
441
  "attribute": "name",
435
442
  "reflect": false,
@@ -447,7 +454,7 @@ export class MgInputCheckbox {
447
454
  "optional": false,
448
455
  "docs": {
449
456
  "tags": [],
450
- "text": "Input label"
457
+ "text": "Define input label"
451
458
  },
452
459
  "attribute": "label",
453
460
  "reflect": false
@@ -517,7 +524,7 @@ export class MgInputCheckbox {
517
524
  "optional": false,
518
525
  "docs": {
519
526
  "tags": [],
520
- "text": "Define if input is required"
527
+ "text": "Define if mg-input-checkbox is required"
521
528
  },
522
529
  "attribute": "required",
523
530
  "reflect": false,
@@ -535,7 +542,7 @@ export class MgInputCheckbox {
535
542
  "optional": false,
536
543
  "docs": {
537
544
  "tags": [],
538
- "text": "Define if input is readonly"
545
+ "text": "Define if mg-input-checkbox is readonly"
539
546
  },
540
547
  "attribute": "readonly",
541
548
  "reflect": false,
@@ -652,7 +659,6 @@ export class MgInputCheckbox {
652
659
  "errorMessage": {},
653
660
  "checkboxItems": {},
654
661
  "displaySearchInput": {},
655
- "currentSearchPage": {},
656
662
  "searchValue": {},
657
663
  "searchResults": {}
658
664
  };
@@ -194,7 +194,7 @@ export class MgInputRadio {
194
194
  "optional": false,
195
195
  "docs": {
196
196
  "tags": [],
197
- "text": "Items are the possible options to select\nRequired"
197
+ "text": "Items are the possible options to select"
198
198
  }
199
199
  },
200
200
  "identifier": {
@@ -153,7 +153,7 @@ export class MgMenu {
153
153
  * @returns HTML Element
154
154
  */
155
155
  render() {
156
- return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)));
156
+ return (h(Host, { role: "list", "aria-label": this.label }, h("slot", null)));
157
157
  }
158
158
  static get is() { return "mg-menu"; }
159
159
  static get encapsulation() { return "shadow"; }
@@ -279,7 +279,7 @@ export class MgMenuItem {
279
279
  [`${this.name}__collapse-container`]: true,
280
280
  [`${this.name}__collapse-container--first-level`]: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
281
281
  });
282
- return (h(Host, { role: !this.isItemMore && 'menuitem', "aria-haspopup": !this.isItemMore && this.hasChildren.toString() }, this.displayPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier() }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
282
+ return (h(Host, { role: "listitem" }, this.displayPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier() }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
283
283
  this.renderInteractiveElement(),
284
284
  h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
285
285
  ])));
@@ -25,9 +25,6 @@
25
25
  transition: none !important;
26
26
  }
27
27
  }
28
- .mg-details {
29
- container: mg-details/inline-size;
30
- }
31
28
  .mg-details summary {
32
29
  display: flex;
33
30
  align-items: baseline;
@@ -46,8 +43,9 @@
46
43
  margin-top: var(--mg-details-spacing);
47
44
  }
48
45
 
49
- @container mg-details (max-width: 60rem) {
50
- .mg-details__toggle span {
46
+ /* hide toggle button when < 700px */
47
+ @media (width < 43.75rem) {
48
+ .mg-details__toggle > span {
51
49
  border: 0 !important;
52
50
  clip: rect(1px, 1px, 1px, 1px) !important;
53
51
  -webkit-clip-path: inset(50%) !important;
@@ -169,7 +169,7 @@ export class MgModal {
169
169
  "optional": false,
170
170
  "docs": {
171
171
  "tags": [],
172
- "text": "Displayed modal title\nrequired"
172
+ "text": "Displayed modal title"
173
173
  },
174
174
  "attribute": "modal-title",
175
175
  "reflect": false
@@ -41,4 +41,7 @@
41
41
  }
42
42
  .mg-pagination mg-button:last-of-type {
43
43
  margin-left: 1rem;
44
+ }
45
+ .mg-pagination.mg-pagination--hide-page-count mg-button {
46
+ margin: 0;
44
47
  }
@@ -55,6 +55,7 @@ export class MgPagination {
55
55
  this.identifier = createID('mg-pagination');
56
56
  this.label = undefined;
57
57
  this.hideNavigationLabels = undefined;
58
+ this.hidePageCount = undefined;
58
59
  this.totalPages = 1;
59
60
  this.currentPage = 1;
60
61
  }
@@ -97,7 +98,7 @@ export class MgPagination {
97
98
  const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
98
99
  // eslint-disable-next-line react/jsx-no-bind
99
100
  onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
100
- return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
101
+ return (h("nav", { "aria-label": this.label, id: this.identifier, class: { 'mg-pagination': true, 'mg-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true })), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", { class: { 'sr-only': this.hidePageCount } }, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
101
102
  }
102
103
  static get is() { return "mg-pagination"; }
103
104
  static get encapsulation() { return "shadow"; }
@@ -165,6 +166,23 @@ export class MgPagination {
165
166
  "attribute": "hide-navigation-labels",
166
167
  "reflect": false
167
168
  },
169
+ "hidePageCount": {
170
+ "type": "boolean",
171
+ "mutable": false,
172
+ "complexType": {
173
+ "original": "boolean",
174
+ "resolved": "boolean",
175
+ "references": {}
176
+ },
177
+ "required": false,
178
+ "optional": false,
179
+ "docs": {
180
+ "tags": [],
181
+ "text": "Hide select input"
182
+ },
183
+ "attribute": "hide-page-count",
184
+ "reflect": false
185
+ },
168
186
  "totalPages": {
169
187
  "type": "number",
170
188
  "mutable": false,
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Available expand toggle display options
3
+ */
4
+ export const expandToggleDisplays = ['text', 'icon'];
5
+ /**
6
+ * Available title positions
7
+ */
8
+ export const titlePositions = ['left', 'right'];
@@ -13,24 +13,28 @@
13
13
  padding: 0 1rem 0 0.3rem;
14
14
  align-items: flex-start;
15
15
  }
16
- .mg-panel__header-left, .mg-panel__header-right {
16
+ .mg-panel__header.mg-panel__header--reverse {
17
+ padding-right: 0.3rem;
18
+ padding-left: 1rem;
19
+ }
20
+ .mg-panel__header-title, .mg-panel__header-content {
17
21
  display: flex;
18
22
  margin: 0.3rem 0;
19
23
  }
20
- .mg-panel__header-right {
24
+ .mg-panel__header-content {
21
25
  padding-left: 0.3rem;
22
26
  flex: 1 auto;
23
27
  min-height: var(--default-size);
24
28
  align-items: center;
25
29
  }
26
- .mg-panel__header-left mg-input-text {
30
+ .mg-panel__header-title mg-input-text {
27
31
  flex-grow: 1;
28
32
  margin-left: 0.3rem;
29
33
  }
30
- .mg-panel__header-left mg-button + mg-button:not([slot=append-input]) {
34
+ .mg-panel__header-title mg-button + mg-button:not([slot=append-input]) {
31
35
  margin-left: 0.3rem;
32
36
  }
33
- .mg-panel__header-left.mg-panel__header-left--full {
37
+ .mg-panel__header-title.mg-panel__header-title--full {
34
38
  flex: 1 1 auto;
35
39
  }
36
40
  .mg-panel__collapse-button-content {