@mgdis/mg-components 5.7.0 → 5.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mg-action-more_31.cjs.entry.js +351 -600
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/cjs/mg-item-more.cjs.entry.js +273 -0
  5. package/dist/cjs/mg-menu.conf-9afe6571.js +242 -0
  6. package/dist/collection/collection-manifest.json +2 -1
  7. package/dist/collection/components/atoms/mg-button/mg-button.js +24 -0
  8. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +8 -0
  9. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -2
  10. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +14 -10
  11. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +91 -21
  12. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +0 -13
  13. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +80 -76
  14. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +7 -5
  15. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +174 -78
  16. package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
  17. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js +1 -0
  18. package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +30 -0
  19. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +200 -0
  20. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -2
  21. package/dist/collection/styles/navigation-button.scss +1 -1
  22. package/dist/collection/utils/behaviors.utils.js +33 -29
  23. package/dist/collection/utils/components.utils.js +2 -4
  24. package/dist/collection/utils/unit.test.utils.js +25 -0
  25. package/dist/components/components.utils.js +2 -4
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/components/index.js +1 -0
  28. package/dist/components/mg-action-more.js +2 -1
  29. package/dist/components/mg-button2.js +4 -1
  30. package/dist/components/mg-form.js +1 -1
  31. package/dist/components/mg-icon2.js +8 -0
  32. package/dist/components/mg-input-checkbox.js +5 -4
  33. package/dist/components/mg-input-select2.js +83 -17
  34. package/dist/components/mg-item-more.d.ts +11 -0
  35. package/dist/components/mg-item-more.js +336 -0
  36. package/dist/components/mg-menu-item2.js +138 -251
  37. package/dist/components/mg-menu.conf.js +14 -0
  38. package/dist/components/mg-menu2.js +76 -111
  39. package/dist/components/mg-tabs.js +1 -1
  40. package/dist/components/mg-tooltip2.js +6 -2
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/mg-action-more_31.entry.js +321 -570
  43. package/dist/esm/mg-components.js +1 -1
  44. package/dist/esm/mg-item-more.entry.js +269 -0
  45. package/dist/esm/mg-menu.conf-881fbd82.js +235 -0
  46. package/dist/mg-components/mg-components.css +1 -1
  47. package/dist/mg-components/mg-components.esm.js +1 -1
  48. package/dist/mg-components/p-1221773c.entry.js +1 -0
  49. package/dist/mg-components/p-30bc87db.entry.js +1 -0
  50. package/dist/mg-components/p-367f92d2.js +1 -0
  51. package/dist/mg-components/styles/navigation-button.scss +1 -1
  52. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -0
  53. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +3 -3
  54. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +39 -4
  55. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +3 -27
  56. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +38 -30
  57. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -0
  58. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +69 -16
  59. package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +26 -0
  60. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +74 -0
  61. package/dist/types/components.d.ts +75 -17
  62. package/dist/types/utils/behaviors.utils.d.ts +12 -5
  63. package/dist/types/utils/components.utils.d.ts +2 -2
  64. package/dist/types/utils/unit.test.utils.d.ts +11 -0
  65. package/package.json +1 -1
  66. package/dist/mg-components/p-4cfd5423.entry.js +0 -1
@@ -1,13 +1,12 @@
1
1
  /**
2
- * MgMenuItem type guard
2
+ * MgItemMore type guard
3
3
  *
4
4
  * @param {HTMLElement} element element to control type
5
- * @returns {boolean} truthy if element is mg-menu-item
5
+ * @returns {boolean} truthy if element is mg-item-more
6
6
  */
7
- const isMgMenuItem = (element) => element.nodeName === 'MG-MENU-ITEM';
7
+ const isMgItemMore = (element) => element.nodeName === 'MG-ITEM-MORE';
8
8
  export var OverflowBehaviorElements;
9
9
  (function (OverflowBehaviorElements) {
10
- OverflowBehaviorElements["MORE"] = "data-overflow-more";
11
10
  OverflowBehaviorElements["BASE_INDEX"] = "data-overflow-base-index";
12
11
  OverflowBehaviorElements["PROXY_INDEX"] = "data-overflow-proxy-index";
13
12
  })(OverflowBehaviorElements || (OverflowBehaviorElements = {}));
@@ -24,7 +23,7 @@ export class OverflowBehavior {
24
23
  * @returns {void}
25
24
  */
26
25
  this.disconnect = () => {
27
- this.resizeObserver.disconnect();
26
+ this._resizeObserver.disconnect();
28
27
  };
29
28
  /************
30
29
  * Internal *
@@ -32,31 +31,35 @@ export class OverflowBehavior {
32
31
  /**
33
32
  * run overflow behavior
34
33
  *
35
- * @param {number} width width of the container
34
+ * @param {number} width width of the container. Optional.
36
35
  * @returns {void}
37
36
  */
38
37
  this.run = (width) => {
39
- if (this.moreElement === undefined) {
38
+ if (this._moreElement === undefined) {
40
39
  // set moreElement
41
- this.moreElement = this.render();
42
- this.moreElement.setAttribute(OverflowBehaviorElements.MORE, '');
40
+ this._moreElement = this.render();
43
41
  // set children
44
- this.children = Array.from(this.element.children);
45
- let moreElementChildren;
46
- const allowedElements = ['MG-MENU-ITEM', 'MG-BUTTON'];
47
- if (isMgMenuItem(this.moreElement)) {
48
- moreElementChildren = Array.from(this.moreElement.querySelector('mg-menu').children).filter(element => allowedElements.includes(element.nodeName));
42
+ this._baseChildren = this.getInteractiveItems(this.element);
43
+ if (isMgItemMore(this._moreElement)) {
44
+ this._proxyChildren = this.getInteractiveItems(this._moreElement.shadowRoot.querySelector('mg-menu'));
49
45
  }
50
- this.children.forEach((child, index) => {
46
+ // update children
47
+ this._baseChildren.forEach((child, index) => {
51
48
  child.setAttribute(OverflowBehaviorElements.BASE_INDEX, `${index}`);
52
- if (child.getAttribute(OverflowBehaviorElements.MORE) === null) {
53
- // set moreElement children
54
- moreElementChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
55
- }
49
+ // set moreElement children
50
+ this._proxyChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
56
51
  });
57
52
  }
58
- this.updateDisplayedItems(width);
53
+ if (width !== undefined)
54
+ this.updateDisplayedItems(width);
59
55
  };
56
+ /**
57
+ * Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
58
+ *
59
+ * @param {Element} element element to parse
60
+ * @returns {Element[]} children
61
+ */
62
+ this.getInteractiveItems = (element) => { var _a; return (((_a = element.children) === null || _a === void 0 ? void 0 : _a.length) > 0 ? Array.from(element.children) : []).filter(element => ['MG-MENU-ITEM', 'MG-BUTTON'].includes(element.nodeName)); };
60
63
  /**
61
64
  * Update displayed items in container from a given available space
62
65
  *
@@ -66,7 +69,7 @@ export class OverflowBehavior {
66
69
  this.updateDisplayedItems = (availableWidth) => {
67
70
  this.restoreItems();
68
71
  const acc = { accWidth: 0, previousItem: null };
69
- this.children.forEach((child) => {
72
+ [...this._baseChildren, this._moreElement].forEach((child) => {
70
73
  acc.accWidth += child.offsetWidth;
71
74
  const isPreviousItemHidden = acc.previousItem !== null && acc.previousItem.getAttribute('hidden') !== null;
72
75
  // if previous item is hidden AND is NOT more element we hidde current
@@ -90,7 +93,7 @@ export class OverflowBehavior {
90
93
  if (item.previousElementSibling === null || this.isMoreElement(item))
91
94
  return false;
92
95
  else if (!this.isMoreElement(item.nextElementSibling))
93
- return cumulateWidth + this.moreElement.offsetWidth > availableWidth;
96
+ return cumulateWidth + this._moreElement.offsetWidth > availableWidth;
94
97
  else
95
98
  return cumulateWidth > availableWidth;
96
99
  };
@@ -100,7 +103,7 @@ export class OverflowBehavior {
100
103
  * @param {Element} element element to match with 'MORE' element
101
104
  * @returns {boolean} truthy if element is the 'MORE' element
102
105
  */
103
- this.isMoreElement = (element) => element.getAttribute(OverflowBehaviorElements.MORE) !== null;
106
+ this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
104
107
  /**
105
108
  * Toggle display item element
106
109
  *
@@ -111,10 +114,10 @@ export class OverflowBehavior {
111
114
  this.toggleItem = (item, isHidden) => {
112
115
  const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
113
116
  if (this.isMoreElement(item))
114
- this.toggleElement(this.moreElement, isHidden);
117
+ this.toggleElement(this._moreElement, isHidden);
115
118
  else if (mgActionMenuindex >= 0) {
116
119
  this.toggleElement(item, isHidden);
117
- this.toggleElement(this.moreElement.querySelector(`[${OverflowBehaviorElements.PROXY_INDEX}="${mgActionMenuindex}"]`), !isHidden);
120
+ this.toggleElement(this._proxyChildren[mgActionMenuindex], !isHidden);
118
121
  }
119
122
  };
120
123
  /**
@@ -136,16 +139,17 @@ export class OverflowBehavior {
136
139
  * @returns {void}
137
140
  */
138
141
  this.restoreItems = () => {
139
- this.children.forEach(item => item.removeAttribute('hidden'));
142
+ [...this._baseChildren, this._moreElement].forEach(item => item.removeAttribute('hidden'));
140
143
  };
141
- if (this.resizeObserver === undefined) {
144
+ if (this._resizeObserver === undefined) {
142
145
  // add resize observer
143
- this.resizeObserver = new ResizeObserver(entries => {
146
+ this._resizeObserver = new ResizeObserver(entries => {
144
147
  entries.forEach(entry => {
145
148
  this.run(entry.contentRect.width);
146
149
  });
147
150
  });
148
- this.resizeObserver.observe(this.element);
151
+ this._resizeObserver.observe(this.element);
149
152
  }
153
+ this.run();
150
154
  }
151
155
  }
@@ -66,12 +66,10 @@ export class ClassList {
66
66
  /**
67
67
  * Check if all items are string
68
68
  *
69
- * @param {string[]} items items to check
69
+ * @param {unknown} items items to check
70
70
  * @returns {boolean} all items are string
71
71
  */
72
- export const allItemsAreString = (items) => {
73
- return items && items.every(item => typeof item === 'string');
74
- };
72
+ export const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
75
73
  /**
76
74
  * Check if element is a heading
77
75
  *
@@ -1,3 +1,4 @@
1
+ import { MockCustomEvent } from '@stencil/core/mock-doc';
1
2
  /**
2
3
  * Clone Deep function
3
4
  *
@@ -40,6 +41,30 @@ export const setupResizeObserverMock = ({ disconnect, observe }) => {
40
41
  });
41
42
  return MockResizeObserver;
42
43
  };
44
+ /**
45
+ * Utility function that mocks the `SubmitEvent` API. Recommended to execute inside `beforeEach`.
46
+ *
47
+ * @returns {void}
48
+ * @example
49
+ * ```
50
+ * setupSubmitEventMock();
51
+ * ```
52
+ */
53
+ export const setupSubmitEventMock = () => {
54
+ class SubmitEvent extends MockCustomEvent {
55
+ constructor(type, eventInitDict) {
56
+ super(type, eventInitDict);
57
+ }
58
+ }
59
+ [window, global].forEach(element => {
60
+ Object.defineProperty(element, 'SubmitEvent', {
61
+ writable: true,
62
+ configurable: true,
63
+ value: SubmitEvent,
64
+ });
65
+ });
66
+ return SubmitEvent;
67
+ };
43
68
  /**
44
69
  * force popover id when component use randomed identifier
45
70
  *
@@ -66,12 +66,10 @@ class ClassList {
66
66
  /**
67
67
  * Check if all items are string
68
68
  *
69
- * @param {string[]} items items to check
69
+ * @param {unknown} items items to check
70
70
  * @returns {boolean} all items are string
71
71
  */
72
- const allItemsAreString = (items) => {
73
- return items && items.every(item => typeof item === 'string');
74
- };
72
+ const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
75
73
  /**
76
74
  * Check if element is a heading
77
75
  *
@@ -19,6 +19,7 @@ export { MgInputText as MgInputText } from '../types/components/molecules/inputs
19
19
  export { MgInputTextarea as MgInputTextarea } from '../types/components/molecules/inputs/mg-input-textarea/mg-input-textarea';
20
20
  export { MgInputTitle as MgInputTitle } from '../types/components/atoms/mg-input-title/mg-input-title';
21
21
  export { MgInputToggle as MgInputToggle } from '../types/components/molecules/inputs/mg-input-toggle/mg-input-toggle';
22
+ export { MgItemMore as MgItemMore } from '../types/components/molecules/mg-item-more/mg-item-more';
22
23
  export { MgMenu as MgMenu } from '../types/components/molecules/menu/mg-menu/mg-menu';
23
24
  export { MgMenuItem as MgMenuItem } from '../types/components/molecules/menu/mg-menu-item/mg-menu-item';
24
25
  export { MgMessage as MgMessage } from '../types/components/molecules/mg-message/mg-message';
@@ -19,6 +19,7 @@ export { MgInputText, defineCustomElement as defineCustomElementMgInputText } fr
19
19
  export { MgInputTextarea, defineCustomElement as defineCustomElementMgInputTextarea } from './mg-input-textarea.js';
20
20
  export { MgInputTitle, defineCustomElement as defineCustomElementMgInputTitle } from './mg-input-title.js';
21
21
  export { MgInputToggle, defineCustomElement as defineCustomElementMgInputToggle } from './mg-input-toggle.js';
22
+ export { MgItemMore, defineCustomElement as defineCustomElementMgItemMore } from './mg-item-more.js';
22
23
  export { MgMenu, defineCustomElement as defineCustomElementMgMenu } from './mg-menu.js';
23
24
  export { MgMenuItem, defineCustomElement as defineCustomElementMgMenuItem } from './mg-menu-item.js';
24
25
  export { MgMessage, defineCustomElement as defineCustomElementMgMessage } from './mg-message.js';
@@ -1,6 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { i as initLocales } from './index2.js';
3
- import { D as Direction, S as Status, d as defineCustomElement$3 } from './mg-menu-item2.js';
3
+ import { S as Status, d as defineCustomElement$3 } from './mg-menu-item2.js';
4
+ import { D as Direction } from './mg-menu.conf.js';
4
5
  import { c as createID } from './components.utils.js';
5
6
  import { d as defineCustomElement$8 } from './mg-badge2.js';
6
7
  import { d as defineCustomElement$7 } from './mg-button2.js';
@@ -1,4 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { C as ClassList } from './components.utils.js';
3
3
  import { d as defineCustomElement$1 } from './mg-icon2.js';
4
4
 
@@ -14,6 +14,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
14
14
  super();
15
15
  this.__registerHost();
16
16
  this.__attachShadow();
17
+ this.disabledChange = createEvent(this, "disabled-change", 7);
17
18
  /************
18
19
  * Internal *
19
20
  ************/
@@ -112,6 +113,8 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
112
113
  else {
113
114
  this.classList.delete(this.classDisabled);
114
115
  }
116
+ // emit value update
117
+ this.disabledChange.emit(isDisabled);
115
118
  }
116
119
  loadingHandler(newValue) {
117
120
  // we add loading style if it newvalue is true else we remove it
@@ -149,7 +149,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
149
149
  // submit buttons should trigger form submition;
150
150
  if (['submit', null].includes(mgButton.getAttribute('type'))) {
151
151
  mgButton.addEventListener('click', () => {
152
- this.form.dispatchEvent(new CustomEvent('submit', { bubbles: true }));
152
+ this.form.dispatchEvent(new SubmitEvent('submit', { bubbles: true }));
153
153
  });
154
154
  }
155
155
  });
@@ -33,6 +33,7 @@ const icons = {
33
33
  'bell': () => (h("path", { fill: "currentColor", d: "M8 15.33a1.7 1.7 0 0 0 1.52-1.83h-3A1.7 1.7 0 0 0 8 15.33ZM13.13 11c-.46-.59-1.32-1.48-1.32-4.42a4.4 4.4 0 0 0-3.05-4.4v-.6A.85.85 0 0 0 8 .67a.85.85 0 0 0-.76.91v.6a4.4 4.4 0 0 0-3 4.44c0 2.94-.86 3.83-1.32 4.42a1 1 0 0 0-.2.63.85.85 0 0 0 .76.91h9.14a.85.85 0 0 0 .76-.91 1.05 1.05 0 0 0-.25-.67Z" })),
34
34
  'briefcase': () => (h("path", { fill: "currentColor", d: "M14 4.5h-3v-1c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H2c-.55 0-1 .45-1 1v7c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-7c0-.55-.45-1-1-1Zm-8-1h4v1H6v-1Z" })),
35
35
  'briefcase-outline': () => (h("path", { fill: "currentColor", d: "M14 4.5h-3v-1c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H2c-.55 0-1 .45-1 1v7c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-7c0-.55-.45-1-1-1Zm-8-1h4v1H6v-1Zm8 9H2v-7h12v7Z" })),
36
+ 'building-outline': () => (h("path", { fill: "currentColor", d: "M4 2h8v12H9v-1a1 1 0 1 0-2 0v1H4V2Zm4 13h4a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h4ZM7 4H5v2h2V4Zm2 0h2v2H9V4Zm2 4H9v2h2V8ZM5 8h2v2H5V8Z" })),
36
37
  'calculator': () => (h("path", { fill: "currentColor", d: "M12.83.67H3.17a.5.5 0 0 0-.5.5v13.66a.5.5 0 0 0 .5.5h9.66a.5.5 0 0 0 .5-.5V1.17a.5.5 0 0 0-.5-.5ZM5.58 13.39a.29.29 0 0 1-.28.3H4.1a.29.29 0 0 1-.3-.28v-1.2a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm0-3.28a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V8.93a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm3.29 3.28a.29.29 0 0 1-.3.3H7.38a.29.29 0 0 1-.3-.3v-1.18a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm0-3.28a.32.32 0 0 1-.3.3H7.38a.32.32 0 0 1-.3-.3V8.93a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm3.33 3.28a.29.29 0 0 1-.28.3h-1.25a.29.29 0 0 1-.3-.28V8.93a.29.29 0 0 1 .28-.3h1.25a.29.29 0 0 1 .3.28v4.48Zm0-7.15a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V2.61a.29.29 0 0 1 .28-.3h7.82a.29.29 0 0 1 .3.28v3.65Z" })),
37
38
  'calendar': () => (h("path", { fill: "currentColor", d: "M14 3.5c0-.55-.45-1-1-1h-1v-1h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v.98s0 .02.02.02H2v9c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-9h-.02s.02 0 .02-.02V3.5Zm-11 10v-8h10v8H3Z" })),
38
39
  'calendar-outline': () => (h("path", { fill: "currentColor", d: "M13 2.5h-1v-1h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-10c0-.55-.45-1-1-1Zm-10 11v-8h10v8H3Zm0-9v-1h10v1H3Z" })),
@@ -148,6 +149,7 @@ const icons = {
148
149
  'pen': () => (h("path", { fill: "currentColor", d: "M1.67,11.69v2.64h2.64l7.78-7.78-2.64-2.64L1.67,11.69ZM14.13,4.51c.27-.28,.27-.72,0-1h0l-1.65-1.64c-.28-.27-.72-.27-1,0h0l-1.28,1.29,2.64,2.64,1.29-1.29Z" })),
149
150
  'pen-circle': () => (h("path", { fill: "currentColor", d: "M8 .44C3.82.44.44 3.82.44 8S3.83 15.56 8 15.56s7.56-3.39 7.56-7.56C15.56 3.82 12.18.44 8 .44M5.47 12.19H3.62v-1.85l5.46-5.45 1.85 1.86-5.45 5.45Zm6.88-6.89-.9.9-1.86-1.85.9-.9c.19-.19.51-.19.7 0l1.16 1.15c.19.19.19.51 0 .7" })),
150
151
  'pen-fancy': () => (h("path", { fill: "currentColor", d: "M3.63,8.65c-.24,.07-.43,.26-.5,.5l-1.46,4.37,.11,.12,2.3-2.3c0-.06,0-.13,0-.19,0-.44,.35-.8,.79-.81,.44,0,.8,.35,.81,.79,0,.44-.35,.8-.79,.81,0,0-.01,0-.02,0h-.19l-2.3,2.3,.12,.11,4.37-1.46c.24-.07,.43-.26,.5-.5l.82-2.08-2.49-2.48-2.07,.82ZM10.8,2.35L6.27,7.28l2.42,2.42,4.94-4.52c2.1-1.86-.99-4.92-2.83-2.83Z" })),
152
+ 'pen-fancy-files-outline': () => (h("path", { fill: "currentColor", d: "M12 2H6v10h6V8.946l.023-.058.085-.078.892-.813V12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v.112a2.298 2.298 0 0 0-.974.66L12 2.8V2Zm1 4.643-1 .913-.566.515-1.528-1.524L12 4.275l.767-.832c.075-.085.153-.156.233-.215 1.167-.857 2.796.9 1.555 1.997L13 6.643ZM4 3H3v11.5a.5.5 0 0 0 .5.5H11v-1H4V3Zm4.238 4.41a.466.466 0 0 0-.316.315L7 10.477l.07.076 1.452-1.449v-.12a.51.51 0 0 1 .5-.51.51.51 0 0 1 .511.498.51.51 0 0 1-.499.51h-.133L7.45 10.931l.075.069 2.76-.92a.466.466 0 0 0 .317-.314l.518-1.31-1.573-1.562-1.308.516Z" })),
151
153
  'pen-fancy-outline': () => (h("path", { fill: "currentColor", d: "M12.24 1.67c-.49 0-1 .21-1.44.7L6.27 7.3l2.42 2.42 4.94-4.52c1.6-1.42.19-3.53-1.39-3.53ZM8.72 8.34 7.66 7.28l3.9-4.24c.22-.24.44-.36.69-.36.41 0 .87.34 1.03.78.14.37.04.7-.32 1.02L8.73 8.36ZM5.7 7.86l-2.08.82c-.24.08-.42.26-.5.5l-1.46 4.37.12.12.56.56.12.12 4.37-1.46c.24-.08.42-.26.5-.5l.81-2.08L5.7 7.87Zm-2.57 4.46L4 9.72c.03-.08.09-.15.17-.18l1.29-.51 1.52 1.52-.5 1.29c-.03.08-.1.15-.19.18l-2.6.87.95-.95c.06.02.12.04.19.04.44 0 .79-.35.79-.79s-.35-.79-.79-.79-.79.35-.79.79c0 .07.02.13.04.19l-.95.95Z" })),
152
154
  'phone': () => (h("path", { fill: "currentColor", d: "M13.97 10.62 11.2 9.43a.6.6 0 0 0-.69.17l-1.23 1.5A9.137 9.137 0 0 1 4.9 6.72l1.5-1.23c.21-.17.28-.45.17-.69L5.38 2.03a.589.589 0 0 0-.68-.34l-2.57.59a.59.59 0 0 0-.46.58c0 6.34 5.14 11.48 11.48 11.48.28 0 .52-.19.58-.46l.59-2.57a.595.595 0 0 0-.35-.68Z" })),
153
155
  'picture': () => (h("path", { fill: "currentColor", d: "M14.33 12.93V3.07a1.4 1.4 0 0 0-1.4-1.4H3.07a1.4 1.4 0 0 0-1.4 1.4v9.86a1.4 1.4 0 0 0 1.4 1.4h9.86a1.4 1.4 0 0 0 1.4-1.4ZM5.54 9.06l1.76 2.11L9.76 8l3.17 4.22H3.07Z" })),
@@ -166,6 +168,8 @@ const icons = {
166
168
  h("path", { key: "tags-2", fill: "currentColor", d: "M15 7.37 10.15 3a1.12 1.12 0 0 0-.77-.29H8.26l4.5 4.09a1.76 1.76 0 0 1 0 2.65L8.77 13a1.17 1.17 0 0 0 1.55 0L15 8.79a.94.94 0 0 0 0-1.42Z" }),
167
169
  ],
168
170
  'thumb-up': () => (h("path", { fill: "currentColor", d: "M2.11 14.36h1a.45.45 0 0 0 .45-.44V7.17a.45.45 0 0 0-.45-.44h-1a.44.44 0 0 0-.44.44v6.75a.44.44 0 0 0 .44.44Zm12.22-7a1.27 1.27 0 0 0-1.27-1.27H9.71l.61-2.91v-.2a1.07 1.07 0 0 0-.28-.68l-.68-.66-4.17 4.19a1.26 1.26 0 0 0-.37.9v6.36a1.27 1.27 0 0 0 1.27 1.27h5.06a1.24 1.24 0 0 0 1.17-.77l1.92-4.49a1.22 1.22 0 0 0 .09-.46V7.42Z" })),
171
+ 'thumbtack': () => (h("path", { fill: "currentColor", d: "M8.91 2 7.71 5.594 2.364 7.09 5.274 10l-.707.706-1.687 1.687-.264.264-.09.09-.209.498L2 14l.755-.317.498-.21.09-.089.264-.264 1.687-1.687.706-.706 2.91 2.908 1.496-5.347L14 7.09 8.91 2Z" })),
172
+ 'thumbtack-outline': () => (h("path", { fill: "currentColor", "fill-rule": "evenodd", d: "m5.273 10-2.91 2.91L2 14l1.09-.364L6 10.727l2.91 2.91 1.496-5.348L14 7.09 8.91 2 7.71 5.594 2.364 7.09 5.273 10Zm3.241-3.563-4.18 1.17 4.059 4.059 1.17-4.18 2.533-.845-2.737-2.737-.845 2.533Z" })),
169
173
  'trash': () => [
170
174
  h("path", { key: "trash-1", fill: "currentColor", d: "M3.27 14.17c0 .66.54 1.19 1.2 1.2h7l-.05-.02h.08c.64-.02 1.14-.56 1.12-1.2V4.32H3.27v9.85Zm5.97-7.12c0-.33.27-.6.6-.6s.6.27.6.6v5.3c0 .33-.27.6-.6.6s-.6-.27-.6-.6v-5.3Zm-3.5 0c0-.33.27-.59.6-.6.32.02.58.28.6.6v5.3c-.02.32-.28.58-.6.6a.645.645 0 0 1-.6-.6v-5.3Zm7.28-5.39h-2.6V.95a.28.28 0 0 0-.28-.28H5.87a.28.28 0 0 0-.28.28v.72H2.91a.28.28 0 0 0-.28.28V3.1c0 .15.12.28.28.28h10.11c.15 0 .28-.12.28-.28V1.94a.28.28 0 0 0-.28-.28Z" }),
171
175
  h("path", { key: "trash-2", fill: "currentColor", d: "M13,2h-2.9L9.9,1.6 C9.8,1.4,9.6,1.2,9.4,1.2H6.6c-0.2,0-0.4,0.1-0.5,0.3L5.8,2H2.9C2.7,2,2.5,2.2,2.5,2.4c0,0,0,0,0,0v0.8c0,0.2,0.2,0.4,0.4,0.4H13 c0.2,0,0.4-0.2,0.4-0.4V2.4C13.4,2.2,13.2,2,13,2z" }),
@@ -176,6 +180,10 @@ const icons = {
176
180
  'upload': () => (h("path", { fill: "currentColor", d: "M9.58 10.74V6.59a.31.31 0 0 1 .31-.3H12a.3.3 0 0 0 .21-.52l-4-4a.29.29 0 0 0-.42 0l-4 4a.3.3 0 0 0 .21.52h2.11a.31.31 0 0 1 .31.3v4.15a.3.3 0 0 0 .3.3h2.56a.3.3 0 0 0 .3-.3ZM14.33 14v-1a.29.29 0 0 0-.29-.3H2a.29.29 0 0 0-.29.3v1a.29.29 0 0 0 .29.29h12a.29.29 0 0 0 .33-.29Z" })),
177
181
  'user': () => (h("path", { fill: "currentColor", d: "M8 8.79a3.56 3.56 0 1 0-3.56-3.56A3.56 3.56 0 0 0 8 8.79Zm3.17.79H9.8a4.27 4.27 0 0 1-3.6 0H4.83a3.16 3.16 0 0 0-3.16 3.17v.4a1.18 1.18 0 0 0 1.18 1.18h10.3a1.18 1.18 0 0 0 1.18-1.18v-.4a3.16 3.16 0 0 0-3.16-3.17Z" })),
178
182
  'user-circle': () => (h("path", { fill: "currentColor", d: "M8 .62C3.95.61.66 3.9.65 7.95c0 4.05 3.28 7.34 7.33 7.35 4.04 0 7.33-3.26 7.35-7.3.02-4.05-3.25-7.36-7.3-7.38H8Zm0 .75c3.64 0 6.59 2.96 6.58 6.6V8c0 1.35-.41 2.66-1.19 3.76a2.713 2.713 0 0 0-2.66-2.37H9.54c-.98.46-2.1.46-3.08 0H5.28c-1.36 0-2.5 1.02-2.67 2.37A6.483 6.483 0 0 1 1.42 8a6.59 6.59 0 0 1 6.55-6.63H8ZM5 5.63c0-1.68 1.37-3.05 3.05-3.05 1.68 0 3.05 1.37 3.05 3.05 0 1.68-1.37 3.05-3.05 3.05H8c-1.66-.03-3-1.39-3-3.05Z" })),
183
+ 'user-pen-fancy-outline': () => [
184
+ h("path", { fill: "currentColor", d: "M7.5 7a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5Zm0-4C6.67 3 6 3.67 6 4.5S6.67 6 7.5 6 9 5.33 9 4.5 8.33 3 7.5 3ZM11.12 11.46l-.22.54-.3.77s-.04.09-.06.13c-.03.04-.06.07-.1.1-.05.04-.1.07-.16.08L7.52 14l-.07-.07 1.45-1.45h.13c.15 0 .27-.06.36-.16a.56.56 0 0 0 .1-.15c.01-.02.02-.04.03-.07v-.02s.01-.05.01-.08v-.03c0-.28-.23-.5-.51-.5-.28.01-.5.24-.5.51v.14l-.76.75-.14.13-.55.55-.07-.07.16-.48.1-.29.24-.71.42-1.27c.05-.16.17-.28.32-.32l1.31-.52 1.57 1.57ZM14.56 8.22l-2.05 1.87-.7.64-.06.05-.32.29-1.52-1.52.28-.31.06-.06.64-.7 1.88-2.04c1.16-1.31 3.11.61 1.79 1.78Z" }),
185
+ h("path", { fill: "currentColor", d: "M9 8H6c-2.21 0-4 1.79-4 4 0 .55.45 1 1 1h3.11l.33-1H3c0-1.66 1.34-3 3-3h3.05l.12-.13.71-.77C9.6 8.03 9.3 8 9 8Z" }),
186
+ ],
179
187
  'user-group': () => (h("path", { fill: "currentColor", d: "M13.15 4.12c-.81-.01-1.47.65-1.48 1.46 0 .82.65 1.47 1.46 1.48s1.47-.65 1.48-1.46-.65-1.47-1.46-1.48Zm-10.04.01a1.47 1.47 0 0 0-1.58 1.59c.06.71.62 1.28 1.34 1.34.81.07 1.52-.53 1.59-1.34.06-.81-.54-1.52-1.35-1.59Zm7.36.39c-.22-.84-.87-1.51-1.71-1.75-1.36-.41-2.8.36-3.22 1.72-.18.61-.13 1.27.14 1.85.41.9 1.33 1.48 2.32 1.45 1.41.01 2.56-1.14 2.57-2.55 0-.24-.03-.49-.1-.72Zm-.71 4h-.19c-.99.49-2.14.49-3.13 0h-.19c-1.46 0-2.64 1.18-2.64 2.64v2.69c1.23.93 2.74 1.47 4.39 1.47s3.17-.55 4.4-1.48v-2.68c0-1.46-1.18-2.64-2.64-2.64Zm5.52.25a7.282 7.282 0 0 1-1.65 3.91c-.08.1-.16.19-.25.28-.08.09-.17.18-.25.27v-.55h.03v-.72s.01-.07 0-.1v-.66c.01-1.25-.66-2.4-1.76-3 .27-.26.63-.41 1-.41h1.51c.63.01 1.17.41 1.37.98ZM2.86 11.16v1.52h.01v.55l-.28-.31c-.08-.08-.15-.16-.22-.24A7.238 7.238 0 0 1 .74 8.86c.16-.62.72-1.07 1.4-1.07h1.47c.37-.01.73.12 1.01.37-1.1.6-1.77 1.75-1.76 3Z" })),
180
188
  'user-plus': () => (h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
181
189
  'user-question-outline': () => (h("path", { fill: "currentColor", d: "M5.23 11.14c.86-.66 1.01-1.9.35-2.75s-1.9-1.01-2.75-.35a1.96 1.96 0 0 0 0 3.1c-.72.42-1.16 1.2-1.16 2.03v.8c0 .2.17.37.37.37h3.98c.2 0 .37-.17.37-.37v-.8c0-.83-.44-1.61-1.16-2.03ZM2.81 9.59c0-.67.55-1.22 1.22-1.22s1.22.55 1.22 1.22-.55 1.22-1.22 1.22-1.22-.55-1.22-1.22Zm2.83 4H2.41v-.42c0-.89.72-1.62 1.62-1.62s1.62.72 1.62 1.62v.42h-.01Zm7.13-11.93H8c-.86 0-1.56.7-1.56 1.56v7.16c0 .21.17.37.37.37.08 0 .16-.03.22-.07l1.49-1.12h4.25c.86 0 1.56-.7 1.56-1.56V3.22c0-.86-.7-1.56-1.56-1.56Zm.82 6.33c0 .45-.37.82-.82.82H8.4a.41.41 0 0 0-.22.07l-1 .75V3.22c0-.45.37-.82.82-.82h4.77c.45 0 .82.37.82.82v4.77Zm-2.8-.42c0 .23-.18.41-.41.41s-.41-.18-.41-.41.18-.41.41-.41c.23 0 .41.18.41.41Zm-.41-4.34c-.83 0-1.5.67-1.5 1.5 0 .23.18.41.41.41s.41-.18.41-.41c0-.38.31-.68.69-.68.38 0 .68.31.68.69 0 .38-.31.68-.68.68-.23 0-.41.18-.41.41v.44c0 .23.18.41.41.41s.41-.18.41-.41v-.09c.8-.23 1.26-1.06 1.04-1.85-.18-.65-.77-1.09-1.44-1.09Z" })),
@@ -11,10 +11,11 @@ const mgInputCheckboxCss = ":host{display:block}.mg-input{display:flex;align-ite
11
11
  /**
12
12
  * type CheckboxItem validation function
13
13
  *
14
- * @param {CheckboxItem} item Checkbox item
15
- * @returns {boolean} match item expectations
14
+ * @param {unknown} items Checkbox item
15
+ * @returns {boolean} match item type
16
16
  */
17
- const isCheckboxItem = (item) => typeof item === 'object' && typeof item.title === 'string' && (item.value === null || typeof item.value === 'boolean') && item.value !== undefined;
17
+ const isCheckboxItems = (items) => Array.isArray(items) &&
18
+ items.every(item => typeof item === 'object' && typeof item.title === 'string' && (item.value === null || typeof item.value === 'boolean') && item.value !== undefined);
18
19
  const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
19
20
  constructor() {
20
21
  super();
@@ -97,7 +98,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
97
98
  this.checkboxItems = [];
98
99
  }
99
100
  validateValue(newValue) {
100
- if (newValue && newValue.every(item => isCheckboxItem(item))) {
101
+ if (isCheckboxItems(newValue)) {
101
102
  this.checkboxItems = newValue.map((item, index) => ({
102
103
  id: `${this.identifier}_${index.toString()}`,
103
104
  title: item.title,
@@ -11,10 +11,24 @@ const mgInputSelectCss = ":host{display:block}.mg-input{display:flex;align-items
11
11
  /**
12
12
  * Check if item is a well configured option
13
13
  *
14
- * @param {SelectOption} option select option
14
+ * @param {unknown} option select option
15
15
  * @returns {boolean} select option type is valid
16
16
  */
17
17
  const isOption = (option) => typeof option === 'object' && typeof option.title === 'string';
18
+ /**
19
+ * Check if items[] is SelectOption
20
+ *
21
+ * @param {unknown[]} items select option
22
+ * @returns {boolean} select option array type is valid
23
+ */
24
+ const allItemsAreOptions = (items) => Array.isArray(items) && items.every(item => isOption(item));
25
+ /**
26
+ * Check if item is a well configured optgroup
27
+ *
28
+ * @param {unknown} optgroup select option
29
+ * @returns {boolean} select optgroup type is valid
30
+ */
31
+ const isOptGroup = (optgroup) => typeof optgroup === 'object' && typeof optgroup.group === 'string' && allItemsAreOptions(optgroup.options);
18
32
  /**
19
33
  * Group options
20
34
  *
@@ -55,17 +69,50 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
55
69
  this.hasDisplayedError = false;
56
70
  /**
57
71
  * Handle input event
72
+ *
73
+ * @returns {void}
58
74
  */
59
75
  this.handleInput = () => {
60
- this.checkValidity();
61
- if (this.hasDisplayedError) {
76
+ this.updateValue();
77
+ if (this.hasDisplayedError)
62
78
  this.setErrorMessage();
79
+ };
80
+ /**
81
+ * Method to compare item.title with input.value
82
+ *
83
+ * @param {SelectOption} item item to compare with
84
+ * @returns {boolean} truthy if input.value is an item
85
+ */
86
+ this.isInputValue = (item) => { var _a; return item.title === ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value); };
87
+ /**
88
+ * value props setter
89
+ *
90
+ * @param {MgInputSelect['value']} newValue value to update with
91
+ * @returns {void}
92
+ */
93
+ this.setValue = (newValue) => {
94
+ this.checkValidity();
95
+ this.value = newValue;
96
+ };
97
+ /**
98
+ * Update value from input.value
99
+ *
100
+ * @returns {void}
101
+ */
102
+ this.updateValue = () => {
103
+ if (this.input.value === '') {
104
+ this.setValue(null);
105
+ }
106
+ else if (allItemsAreString(this.items) && this.items.includes(this.input.value)) {
107
+ this.setValue(this.input.value);
63
108
  }
64
- if (this.input.value !== '') {
65
- this.value = allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.title === this.input.value).value;
109
+ else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
110
+ this.setValue(this.items.find(this.isInputValue).value);
66
111
  }
67
112
  else {
68
- this.value = null;
113
+ // before set newValue with push to options[] the unknown input.value with a disable satus
114
+ this.options.push({ title: this.input.value, value: this.input.value, disabled: true });
115
+ this.setValue(this.input.value);
69
116
  }
70
117
  };
71
118
  /**
@@ -74,12 +121,18 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
74
121
  this.handleBlur = () => {
75
122
  this.displayError();
76
123
  };
124
+ /**
125
+ * Input value is disabled
126
+ *
127
+ * @returns {boolean} truthy if input value is disabled
128
+ */
129
+ this.isDisabledValue = () => { var _a; return allItemsAreOptions(this.options) && ((_a = this.options.find(this.isInputValue)) === null || _a === void 0 ? void 0 : _a.disabled) === true; };
77
130
  /**
78
131
  * Check if input is valid
79
132
  */
80
133
  this.checkValidity = () => {
81
134
  var _a;
82
- this.valid = this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined ? this.input.checkValidity() : true);
135
+ this.valid = !this.isDisabledValue() && (this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined ? this.input.checkValidity() : true));
83
136
  this.invalid = !this.valid;
84
137
  // We need to send valid event even if it is the same value
85
138
  this.inputValid.emit(this.valid);
@@ -94,6 +147,13 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
94
147
  this.errorMessage = this.messages.errors.required;
95
148
  }
96
149
  };
150
+ /**
151
+ * Render option
152
+ *
153
+ * @param {SelectOption} option to render
154
+ * @returns {HTMLElement} render option
155
+ */
156
+ this.renderOption = (option) => (h("option", { key: option.title, value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title));
97
157
  this.value = undefined;
98
158
  this.items = undefined;
99
159
  this.identifier = undefined;
@@ -118,9 +178,13 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
118
178
  this.valueExist = undefined;
119
179
  this.readonlyValue = undefined;
120
180
  }
121
- handleValue(newValue) {
122
- if (newValue !== null) {
123
- this.readonlyValue = allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.value === newValue).title;
181
+ validateValue(newValue) {
182
+ var _a, _b;
183
+ if (allItemsAreString(this.items) && typeof newValue === 'string') {
184
+ this.readonlyValue = Boolean((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.input.value : newValue;
185
+ }
186
+ else if (allItemsAreOptions(this.items)) {
187
+ this.readonlyValue = (_b = this.items.find(item => item.value === newValue)) === null || _b === void 0 ? void 0 : _b.title;
124
188
  }
125
189
  else {
126
190
  this.readonlyValue = null;
@@ -134,14 +198,15 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
134
198
  }
135
199
  // String array
136
200
  else if (allItemsAreString(newValue)) {
137
- this.valueExist = newValue.includes(this.value);
138
- this.options = newValue.map((item) => ({ title: item, value: item }));
201
+ if (typeof this.value === 'string')
202
+ this.valueExist = newValue.includes(this.value);
203
+ this.options = newValue.map(item => ({ title: item, value: item }));
139
204
  }
140
205
  // Object array
141
- else if (newValue.every(item => isOption(item))) {
206
+ else if (allItemsAreOptions(newValue)) {
142
207
  this.valueExist = newValue.map(item => item.value).includes(this.value);
143
208
  // Grouped object options
144
- if (newValue.some(item => item.group !== undefined)) {
209
+ if (newValue.some(item => Boolean(item.group))) {
145
210
  this.options = newValue.reduce(groupOptions, []);
146
211
  }
147
212
  // Standart object options
@@ -186,6 +251,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
186
251
  this.messages = initLocales(this.element).messages;
187
252
  // Validate
188
253
  this.validateItems(this.items);
254
+ this.validateValue(this.value);
189
255
  // Set default placeholder
190
256
  if (this.placeholder === undefined || this.placeholder === '') {
191
257
  this.placeholder = this.messages.input.select.placeholder;
@@ -203,15 +269,15 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
203
269
  * @returns {HTMLElement} HTML Element
204
270
  */
205
271
  render() {
206
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("select", { class: "mg-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
272
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: undefined, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("select", { class: "mg-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
207
273
  if (el !== null)
208
274
  this.input = el;
209
275
  } }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
210
- h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { key: optgroup.title, value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
276
+ h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => isOptGroup(option) ? h("optgroup", { label: option.group }, option.options.map(this.renderOption)) : isOption(option) && this.renderOption(option)))));
211
277
  }
212
278
  get element() { return this; }
213
279
  static get watchers() { return {
214
- "value": ["handleValue"],
280
+ "value": ["validateValue"],
215
281
  "items": ["validateItems"],
216
282
  "required": ["handleValidityChange"],
217
283
  "readonly": ["handleValidityChange"],
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MgItemMore extends Components.MgItemMore, HTMLElement {}
4
+ export const MgItemMore: {
5
+ prototype: MgItemMore;
6
+ new (): MgItemMore;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;