@mgdis/mg-components 6.20.0 → 6.21.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.
- package/dist/cjs/{index-Bp6wZzau.js → index-C2viYwrR.js} +1757 -80
- package/dist/cjs/{index-TUElr4Wv.js → index-CCsGMNyq.js} +46 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +684 -273
- package/dist/cjs/mg-alert.cjs.entry.js +17 -9
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-fieldset.cjs.entry.js +24 -7
- package/dist/cjs/mg-input-combobox.cjs.entry.js +48 -18
- package/dist/cjs/mg-input-file.cjs.entry.js +384 -0
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +30 -18
- package/dist/cjs/{mg-input.conf-D7jmj_lh.js → mg-input.conf-BNpeATnq.js} +7 -0
- package/dist/cjs/mg-loader.cjs.entry.js +8 -6
- package/dist/cjs/mg-progress.cjs.entry.js +19 -9
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +877 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +12 -12
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +12 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/locales/en/messages.json +11 -0
- package/dist/collection/locales/fr/messages.json +11 -0
- package/dist/components/events.utils.js +1 -23
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -408
- package/dist/components/index3.js +1 -476
- package/dist/components/mg-action-more.js +1 -254
- package/dist/components/mg-alert.js +1 -224
- package/dist/components/mg-badge.js +1 -6
- package/dist/components/mg-badge2.js +1 -113
- package/dist/components/mg-button.js +1 -6
- package/dist/components/mg-button2.js +1 -275
- package/dist/components/mg-card.js +1 -6
- package/dist/components/mg-card2.js +1 -92
- package/dist/components/mg-character-left.js +1 -6
- package/dist/components/mg-character-left2.js +1 -75
- package/dist/components/mg-details.js +1 -104
- package/dist/components/mg-divider.js +1 -6
- package/dist/components/mg-divider2.js +1 -49
- package/dist/components/mg-fieldset.js +1 -209
- package/dist/components/mg-form.js +1 -302
- package/dist/components/mg-icon.js +1 -6
- package/dist/components/mg-icon2.js +1 -188
- package/dist/components/mg-illustrated-message.js +1 -129
- package/dist/components/mg-input-checkbox-paginated.js +1 -6
- package/dist/components/mg-input-checkbox-paginated2.js +1 -135
- package/dist/components/mg-input-checkbox.js +1 -762
- package/dist/components/mg-input-combobox.js +1 -940
- package/dist/components/mg-input-date.js +1 -463
- package/dist/components/mg-input-file.d.ts +11 -0
- package/dist/components/mg-input-file.js +1 -0
- package/dist/components/mg-input-numeric.js +1 -592
- package/dist/components/mg-input-password.js +1 -360
- package/dist/components/mg-input-radio.js +1 -392
- package/dist/components/mg-input-rich-text-editor.js +1 -16797
- package/dist/components/mg-input-select.js +1 -6
- package/dist/components/mg-input-select2.js +1 -481
- package/dist/components/mg-input-text.js +1 -6
- package/dist/components/mg-input-text2.js +1 -514
- package/dist/components/mg-input-textarea.js +1 -412
- package/dist/components/mg-input-title.js +1 -6
- package/dist/components/mg-input-title2.js +1 -81
- package/dist/components/mg-input-toggle.js +1 -371
- package/dist/components/mg-input.conf.js +1 -0
- package/dist/components/mg-input.js +1 -6
- package/dist/components/mg-input2.js +1 -459
- package/dist/components/mg-item-more.js +1 -6
- package/dist/components/mg-item-more2.js +1 -505
- package/dist/components/mg-loader.js +1 -6
- package/dist/components/mg-loader2.js +1 -74
- package/dist/components/mg-menu-item.js +1 -6
- package/dist/components/mg-menu-item2.js +1 -485
- package/dist/components/mg-menu.js +1 -6
- package/dist/components/mg-message.js +1 -6
- package/dist/components/mg-message2.js +1 -146
- package/dist/components/mg-modal.js +1 -184
- package/dist/components/mg-pagination.js +1 -234
- package/dist/components/mg-panel.js +1 -350
- package/dist/components/mg-popover-content.js +1 -6
- package/dist/components/mg-popover-content2.js +1 -96
- package/dist/components/mg-popover.js +1 -6
- package/dist/components/mg-popover2.js +1 -312
- package/dist/components/mg-progress.js +1 -123
- package/dist/components/mg-skip-links.js +1 -78
- package/dist/components/mg-table.js +1 -319
- package/dist/components/mg-tabs.js +1 -6
- package/dist/components/mg-tabs2.js +1 -315
- package/dist/components/mg-tag.js +1 -133
- package/dist/components/mg-tooltip-content.js +1 -6
- package/dist/components/mg-tooltip-content2.js +1 -42
- package/dist/components/mg-tooltip.js +1 -6
- package/dist/components/mg-tooltip2.js +1 -421
- package/dist/components/popper.js +1 -1790
- package/dist/esm/{index-CNX6lq0x.js → index-D-uaxCxH.js} +46 -1
- package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1757 -80
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +684 -273
- package/dist/esm/mg-alert.entry.js +17 -9
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-fieldset.entry.js +24 -7
- package/dist/esm/mg-input-combobox.entry.js +48 -18
- package/dist/esm/mg-input-file.entry.js +382 -0
- package/dist/esm/mg-input-rich-text-editor.entry.js +30 -18
- package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
- package/dist/esm/mg-loader.entry.js +8 -6
- package/dist/esm/mg-progress.entry.js +19 -9
- package/dist/mg-components/locales/en/messages.json +11 -0
- package/dist/mg-components/locales/fr/messages.json +11 -0
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-d5a276eb.entry.js → p-08fa327b.entry.js} +1 -1
- package/dist/mg-components/p-4175dcbe.entry.js +1 -0
- package/dist/mg-components/{p-7132bca1.entry.js → p-6b57f249.entry.js} +1 -1
- package/dist/mg-components/p-6b655830.entry.js +1 -0
- package/dist/mg-components/p-988c282e.entry.js +1 -0
- package/dist/mg-components/p-C9rmNQIL.js +1 -0
- package/dist/mg-components/p-D-uaxCxH.js +1 -0
- package/dist/mg-components/p-DFwaH2hS.js +2 -0
- package/dist/mg-components/p-a79b1f19.entry.js +1 -0
- package/dist/mg-components/{p-916dfb6d.entry.js → p-c3d116b9.entry.js} +1 -1
- package/dist/mg-components/p-dd1934f4.entry.js +1 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
- package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -4
- package/dist/types/components.d.ts +211 -10
- package/dist/types/stencil-public-runtime.d.ts +76 -12
- package/ide/intellij/web-types.json +356 -12
- package/ide/vscode/html-custom-data.json +338 -76
- package/package.json +19 -19
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
- package/dist/mg-components/p-016bd291.entry.js +0 -1
- package/dist/mg-components/p-186a6139.entry.js +0 -1
- package/dist/mg-components/p-BluNKQ3L.js +0 -2
- package/dist/mg-components/p-CNX6lq0x.js +0 -1
- package/dist/mg-components/p-DDnrE1hD.js +0 -1
- package/dist/mg-components/p-cd061b38.entry.js +0 -1
- package/dist/mg-components/p-d2c72f09.entry.js +0 -1
- package/ide/vscode/custom.css-data.json +0 -425
|
@@ -1,505 +1 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { t as toString } from './index2.js';
|
|
3
|
-
import { d as defineCustomElement$4, a as directions, s as sizes } from './mg-menu-item2.js';
|
|
4
|
-
import { i as initLocales } from './index3.js';
|
|
5
|
-
import { d as defineCustomElement$8 } from './mg-badge2.js';
|
|
6
|
-
import { d as defineCustomElement$7 } from './mg-button2.js';
|
|
7
|
-
import { d as defineCustomElement$6 } from './mg-card2.js';
|
|
8
|
-
import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
9
|
-
import { d as defineCustomElement$3 } from './mg-popover2.js';
|
|
10
|
-
import { d as defineCustomElement$2 } from './mg-popover-content2.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
class OverflowBehavior {
|
|
16
|
-
constructor(parentElement, itemMoreElement, itemMoreContainerElement) {
|
|
17
|
-
this.parentElement = parentElement;
|
|
18
|
-
this.itemMoreElement = itemMoreElement;
|
|
19
|
-
this.itemMoreContainerElement = itemMoreContainerElement;
|
|
20
|
-
/**********
|
|
21
|
-
* Public *
|
|
22
|
-
**********/
|
|
23
|
-
/**
|
|
24
|
-
* Disconnect ResizeObserver
|
|
25
|
-
*/
|
|
26
|
-
this.disconnect = () => {
|
|
27
|
-
this._resizeObserver.disconnect();
|
|
28
|
-
};
|
|
29
|
-
/************
|
|
30
|
-
* Internal *
|
|
31
|
-
************/
|
|
32
|
-
/**
|
|
33
|
-
* Utility method to know if element is HTMLMgItemMoreElement
|
|
34
|
-
* @param element - element to match with 'MORE' element
|
|
35
|
-
* @returns truthy if element is the 'MORE' element
|
|
36
|
-
*/
|
|
37
|
-
this.isMoreElement = (element) => element === this.itemMoreElement;
|
|
38
|
-
/**
|
|
39
|
-
* Utility method to know if item overflow partialy or totaly in the container
|
|
40
|
-
* @param cumulateWidth - previous sibling elements cumulate width + item width
|
|
41
|
-
* @param item - item HTML element
|
|
42
|
-
* @returns truthy if element is overflow
|
|
43
|
-
*/
|
|
44
|
-
this.isOverflowElement = (cumulateWidth, item) => {
|
|
45
|
-
const displayMgItemMore = this.itemMoreContainerElement.children.length > 0;
|
|
46
|
-
if (!this.isMoreElement(item)) {
|
|
47
|
-
if (item.nextElementSibling.nodeName !== 'MG-ITEM-MORE' && !displayMgItemMore)
|
|
48
|
-
return cumulateWidth + this.itemMoreElement.offsetWidth > this._availableWidth;
|
|
49
|
-
else
|
|
50
|
-
return cumulateWidth > this._availableWidth;
|
|
51
|
-
}
|
|
52
|
-
else
|
|
53
|
-
return !displayMgItemMore;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Toogle item from isHidden condition
|
|
57
|
-
* @param item - item to update
|
|
58
|
-
* @param isHidden - item is hidden
|
|
59
|
-
*/
|
|
60
|
-
this.toggleItem = (item, isHidden) => {
|
|
61
|
-
if (this.isMoreElement(item) && isHidden)
|
|
62
|
-
item.setAttribute('hidden', '');
|
|
63
|
-
else if (this.isMoreElement(item) && !isHidden)
|
|
64
|
-
item.removeAttribute('hidden');
|
|
65
|
-
else if (!this.isMoreElement(item) && isHidden)
|
|
66
|
-
this.itemMoreContainerElement.appendChild(item);
|
|
67
|
-
else if (!this.isMoreElement(item) && item.parentElement !== this.parentElement)
|
|
68
|
-
this.parentElement.insertBefore(item, this.itemMoreElement);
|
|
69
|
-
};
|
|
70
|
-
if (this.parentElement === null || this.itemMoreElement === null || this.itemMoreContainerElement === null) {
|
|
71
|
-
throw new Error('OverflowBehavior - all constructor params are required');
|
|
72
|
-
}
|
|
73
|
-
const items = Array.from(this.parentElement.children);
|
|
74
|
-
this._resizeObserver = new ResizeObserver(entries => {
|
|
75
|
-
this._availableWidth = entries
|
|
76
|
-
.map(entry => entry.contentRect.width)
|
|
77
|
-
.sort((a, b) => a - b)
|
|
78
|
-
.shift();
|
|
79
|
-
// reset items
|
|
80
|
-
items.forEach(item => this.toggleItem(item, false));
|
|
81
|
-
let accWidth = 0;
|
|
82
|
-
items.forEach((item, index) => {
|
|
83
|
-
accWidth += item.offsetWidth;
|
|
84
|
-
if (index > 0)
|
|
85
|
-
this.toggleItem(item, this.isOverflowElement(accWidth, item));
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
this._resizeObserver.observe(this.parentElement);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const mgMenuCss = ".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-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:inline-flex;width:100%;min-width:0;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}";
|
|
93
|
-
|
|
94
|
-
const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement {
|
|
95
|
-
constructor(registerHost) {
|
|
96
|
-
super();
|
|
97
|
-
if (registerHost !== false) {
|
|
98
|
-
this.__registerHost();
|
|
99
|
-
}
|
|
100
|
-
this.__attachShadow();
|
|
101
|
-
/************
|
|
102
|
-
* Internal *
|
|
103
|
-
************/
|
|
104
|
-
this.name = 'mg-menu';
|
|
105
|
-
/**
|
|
106
|
-
* Component display direction.
|
|
107
|
-
*/
|
|
108
|
-
this.direction = 'horizontal';
|
|
109
|
-
/**
|
|
110
|
-
* Define mg-menu size
|
|
111
|
-
*/
|
|
112
|
-
this.size = 'medium';
|
|
113
|
-
/*************
|
|
114
|
-
* Methods *
|
|
115
|
-
*************/
|
|
116
|
-
/**
|
|
117
|
-
* Test if menu is a child menu
|
|
118
|
-
* @returns truthy if menu is a child menu
|
|
119
|
-
*/
|
|
120
|
-
this.isChildMenu = () => this.element.closest('mg-menu-item') !== null;
|
|
121
|
-
/**
|
|
122
|
-
* Get menu children items
|
|
123
|
-
* @returns menu children mg-menu-item
|
|
124
|
-
*/
|
|
125
|
-
this.getMenuItems = (menu = this.element) => {
|
|
126
|
-
var _a, _b;
|
|
127
|
-
const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
128
|
-
const itemMoreMenuItem = (_b = (_a = menu.querySelector('mg-item-more')) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item');
|
|
129
|
-
if (itemMoreMenuItem !== null && itemMoreMenuItem !== undefined) {
|
|
130
|
-
menuItems.push(itemMoreMenuItem);
|
|
131
|
-
}
|
|
132
|
-
return menuItems;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Update menu items
|
|
136
|
-
*/
|
|
137
|
-
this.updateMenuItems = () => {
|
|
138
|
-
this.getMenuItems().forEach(item => {
|
|
139
|
-
item.dataset.styleDirection = this.direction;
|
|
140
|
-
});
|
|
141
|
-
// render mg-item-more to manage OverflowBehavior
|
|
142
|
-
this.renderMgItemMore();
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* render mg-item-more
|
|
146
|
-
*/
|
|
147
|
-
this.renderMgItemMore = () => {
|
|
148
|
-
var _a;
|
|
149
|
-
if (this.direction === directions.VERTICAL || (this.direction === directions.HORIZONTAL && this.isChildMenu()) || this.element.children.length <= 1) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
// Insert mg-item-more outside the mg-menu shadowdom
|
|
153
|
-
let itemMoreElement = this.element.querySelector('mg-item-more');
|
|
154
|
-
if (itemMoreElement === null) {
|
|
155
|
-
itemMoreElement = document.createElement('mg-item-more');
|
|
156
|
-
this.element.appendChild(itemMoreElement);
|
|
157
|
-
}
|
|
158
|
-
// update mg-item-more props
|
|
159
|
-
for (const propertie in this.itemmore) {
|
|
160
|
-
itemMoreElement[propertie] = this.itemmore[propertie];
|
|
161
|
-
}
|
|
162
|
-
if (((_a = this.itemmore) === null || _a === void 0 ? void 0 : _a.size) === undefined)
|
|
163
|
-
itemMoreElement.size = this.size;
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
validateLabel(newValue) {
|
|
167
|
-
if (newValue === undefined && !this.element.hasAttribute('aria-label')) {
|
|
168
|
-
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${toString(newValue)}.`);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
validateDirection(newValue) {
|
|
172
|
-
if (![directions.VERTICAL, directions.HORIZONTAL].includes(newValue)) {
|
|
173
|
-
throw new Error(`<${this.name}> prop "direction" must be one of: ${directions.HORIZONTAL}, ${directions.VERTICAL}. Passed value: ${toString(newValue)}.`);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
this.updateMenuItems();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
validateItemMore(newValue) {
|
|
180
|
-
if (newValue !== undefined && this.direction !== directions.HORIZONTAL) {
|
|
181
|
-
throw new Error(`<${this.name}> prop "itemmore" must be paired with direction ${directions.HORIZONTAL}.`);
|
|
182
|
-
}
|
|
183
|
-
else if (newValue !== undefined) {
|
|
184
|
-
this.renderMgItemMore();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
validateSize(newValue) {
|
|
188
|
-
if (!sizes.includes(newValue)) {
|
|
189
|
-
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Define mg-menu-item listener when they are loaded
|
|
194
|
-
* @param event - mg-item-loaded "item-loaded" custom event
|
|
195
|
-
*/
|
|
196
|
-
updateItemListener(event) {
|
|
197
|
-
// `<mg-action-more>` element doesn't need `data-has-focus` attribute
|
|
198
|
-
if (event.target.nodeName === 'MG-ACTION-MORE') {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
const itemToWatch = event.target.nodeName === 'MG-ITEM-MORE' ? event.target.shadowRoot.querySelector('mg-menu-item') : event.target;
|
|
202
|
-
['click', 'focus'].forEach(trigger => {
|
|
203
|
-
itemToWatch.addEventListener(trigger, () => {
|
|
204
|
-
const focusedItem = event.target.closest('mg-menu').querySelector('[data-has-focus]');
|
|
205
|
-
// exit process if new focused item in the current menu children
|
|
206
|
-
if (focusedItem === itemToWatch)
|
|
207
|
-
return;
|
|
208
|
-
// reset expanded on previous active menu item
|
|
209
|
-
if (focusedItem !== null)
|
|
210
|
-
focusedItem.removeAttribute('data-has-focus');
|
|
211
|
-
// update focusedMenuItem with new value
|
|
212
|
-
itemToWatch.setAttribute('data-has-focus', 'true');
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
/*************
|
|
217
|
-
* Lifecycle *
|
|
218
|
-
*************/
|
|
219
|
-
/**
|
|
220
|
-
* Validate props
|
|
221
|
-
*/
|
|
222
|
-
componentWillLoad() {
|
|
223
|
-
this.validateDirection(this.direction);
|
|
224
|
-
this.validateLabel(this.label);
|
|
225
|
-
this.validateItemMore(this.itemmore);
|
|
226
|
-
this.validateSize(this.size);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Check if component slots configuration
|
|
230
|
-
*/
|
|
231
|
-
componentDidLoad() {
|
|
232
|
-
// set menu-items
|
|
233
|
-
this.updateMenuItems();
|
|
234
|
-
// add listener to close main menu when focus leave it
|
|
235
|
-
if (!this.isChildMenu() && this.direction === directions.HORIZONTAL) {
|
|
236
|
-
document.addEventListener('focusin', (event) => {
|
|
237
|
-
const isElementChild = (element) => {
|
|
238
|
-
if (element === this.element)
|
|
239
|
-
return true;
|
|
240
|
-
else if (element.parentElement === null)
|
|
241
|
-
return false;
|
|
242
|
-
else
|
|
243
|
-
return isElementChild(element.parentElement);
|
|
244
|
-
};
|
|
245
|
-
if (event.target.closest('mg-menu') === null || !isElementChild(event.target)) {
|
|
246
|
-
const focusedItem = this.element.querySelector('[data-has-focus]');
|
|
247
|
-
// reset expanded on previous active menu item
|
|
248
|
-
if (focusedItem !== null)
|
|
249
|
-
focusedItem.removeAttribute('data-has-focus');
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
// add mutation observer to improve global reactivity
|
|
254
|
-
new MutationObserver(this.updateMenuItems).observe(this.element, { childList: true });
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Render
|
|
258
|
-
* @returns HTML Element
|
|
259
|
-
*/
|
|
260
|
-
render() {
|
|
261
|
-
return (h(Host, { key: '753833b01b86d6983f5d063f5598e2187b147a6e', role: "list", "aria-label": this.label }, h("slot", { key: '56702e49f5a97feddeb66e6271bd898061aa0d48' })));
|
|
262
|
-
}
|
|
263
|
-
get element() { return this; }
|
|
264
|
-
static get watchers() { return {
|
|
265
|
-
"label": ["validateLabel"],
|
|
266
|
-
"direction": ["validateDirection"],
|
|
267
|
-
"itemmore": ["validateItemMore"],
|
|
268
|
-
"size": ["validateSize"]
|
|
269
|
-
}; }
|
|
270
|
-
static get style() { return mgMenuCss; }
|
|
271
|
-
}, [257, "mg-menu", {
|
|
272
|
-
"label": [1],
|
|
273
|
-
"direction": [513],
|
|
274
|
-
"itemmore": [16],
|
|
275
|
-
"size": [1]
|
|
276
|
-
}, [[0, "item-loaded", "updateItemListener"]], {
|
|
277
|
-
"label": ["validateLabel"],
|
|
278
|
-
"direction": ["validateDirection"],
|
|
279
|
-
"itemmore": ["validateItemMore"],
|
|
280
|
-
"size": ["validateSize"]
|
|
281
|
-
}]);
|
|
282
|
-
function defineCustomElement$1() {
|
|
283
|
-
if (typeof customElements === "undefined") {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
const components = ["mg-menu", "mg-badge", "mg-button", "mg-card", "mg-icon", "mg-item-more", "mg-menu", "mg-menu-item", "mg-popover", "mg-popover-content"];
|
|
287
|
-
components.forEach(tagName => { switch (tagName) {
|
|
288
|
-
case "mg-menu":
|
|
289
|
-
if (!customElements.get(tagName)) {
|
|
290
|
-
customElements.define(tagName, MgMenu);
|
|
291
|
-
}
|
|
292
|
-
break;
|
|
293
|
-
case "mg-badge":
|
|
294
|
-
if (!customElements.get(tagName)) {
|
|
295
|
-
defineCustomElement$8();
|
|
296
|
-
}
|
|
297
|
-
break;
|
|
298
|
-
case "mg-button":
|
|
299
|
-
if (!customElements.get(tagName)) {
|
|
300
|
-
defineCustomElement$7();
|
|
301
|
-
}
|
|
302
|
-
break;
|
|
303
|
-
case "mg-card":
|
|
304
|
-
if (!customElements.get(tagName)) {
|
|
305
|
-
defineCustomElement$6();
|
|
306
|
-
}
|
|
307
|
-
break;
|
|
308
|
-
case "mg-icon":
|
|
309
|
-
if (!customElements.get(tagName)) {
|
|
310
|
-
defineCustomElement$5();
|
|
311
|
-
}
|
|
312
|
-
break;
|
|
313
|
-
case "mg-item-more":
|
|
314
|
-
if (!customElements.get(tagName)) {
|
|
315
|
-
defineCustomElement();
|
|
316
|
-
}
|
|
317
|
-
break;
|
|
318
|
-
case "mg-menu":
|
|
319
|
-
if (!customElements.get(tagName)) {
|
|
320
|
-
defineCustomElement$1();
|
|
321
|
-
}
|
|
322
|
-
break;
|
|
323
|
-
case "mg-menu-item":
|
|
324
|
-
if (!customElements.get(tagName)) {
|
|
325
|
-
defineCustomElement$4();
|
|
326
|
-
}
|
|
327
|
-
break;
|
|
328
|
-
case "mg-popover":
|
|
329
|
-
if (!customElements.get(tagName)) {
|
|
330
|
-
defineCustomElement$3();
|
|
331
|
-
}
|
|
332
|
-
break;
|
|
333
|
-
case "mg-popover-content":
|
|
334
|
-
if (!customElements.get(tagName)) {
|
|
335
|
-
defineCustomElement$2();
|
|
336
|
-
}
|
|
337
|
-
break;
|
|
338
|
-
} });
|
|
339
|
-
}
|
|
340
|
-
defineCustomElement$1();
|
|
341
|
-
|
|
342
|
-
const mgItemMoreCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host:not([hidden]){display:flex}";
|
|
343
|
-
|
|
344
|
-
const MgItemMore = /*@__PURE__*/ proxyCustomElement(class MgItemMore extends HTMLElement {
|
|
345
|
-
constructor(registerHost) {
|
|
346
|
-
super();
|
|
347
|
-
if (registerHost !== false) {
|
|
348
|
-
this.__registerHost();
|
|
349
|
-
}
|
|
350
|
-
this.__attachShadow();
|
|
351
|
-
/************
|
|
352
|
-
* Internal *
|
|
353
|
-
************/
|
|
354
|
-
this.name = 'mg-item-more';
|
|
355
|
-
/**
|
|
356
|
-
* Define icon
|
|
357
|
-
*/
|
|
358
|
-
this.icon = { icon: 'ellipsis-vertical' };
|
|
359
|
-
/**
|
|
360
|
-
* Define slot label element
|
|
361
|
-
*/
|
|
362
|
-
this.slotlabel = { display: false };
|
|
363
|
-
}
|
|
364
|
-
validateIcon(newValue) {
|
|
365
|
-
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
|
|
366
|
-
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${toString(newValue)}.`);
|
|
367
|
-
}
|
|
368
|
-
validateSlotLabel(newValue) {
|
|
369
|
-
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
|
|
370
|
-
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${toString(newValue)}.`);
|
|
371
|
-
else if (typeof newValue.label !== 'string')
|
|
372
|
-
this.slotlabel.label = this.messages.menuLabel;
|
|
373
|
-
}
|
|
374
|
-
validateSize(newValue) {
|
|
375
|
-
if (newValue && !sizes.includes(newValue))
|
|
376
|
-
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${toString(newValue)}.`);
|
|
377
|
-
}
|
|
378
|
-
/*************
|
|
379
|
-
* Lifecycle *
|
|
380
|
-
*************/
|
|
381
|
-
/**
|
|
382
|
-
* Set variables and validate props
|
|
383
|
-
*/
|
|
384
|
-
componentWillLoad() {
|
|
385
|
-
// init variables
|
|
386
|
-
this.messages = initLocales(this.element).messages.itemMore;
|
|
387
|
-
// validate props
|
|
388
|
-
this.validateIcon(this.icon);
|
|
389
|
-
this.validateSlotLabel(this.slotlabel);
|
|
390
|
-
this.validateSize(this.size);
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Ensure parent DOM is fully rendered with timeout method before parse elements
|
|
394
|
-
* @returns timeout
|
|
395
|
-
*/
|
|
396
|
-
componentDidLoad() {
|
|
397
|
-
// ensure parent menu is fully rendered
|
|
398
|
-
return setTimeout(() => {
|
|
399
|
-
this.parentMenu = this.element.closest('mg-menu');
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Set OverflowBehavior when parentMenu state is upate AND defined
|
|
404
|
-
*/
|
|
405
|
-
componentDidUpdate() {
|
|
406
|
-
if (this.parentMenu && this.overflowBehavior === undefined) {
|
|
407
|
-
this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.element, this.itemMoreContainer);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Disconnect overflow ResizeObserver
|
|
412
|
-
*/
|
|
413
|
-
disconnectedCallback() {
|
|
414
|
-
var _a;
|
|
415
|
-
(_a = this.overflowBehavior) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Render
|
|
419
|
-
* @returns HTML Element
|
|
420
|
-
*/
|
|
421
|
-
render() {
|
|
422
|
-
const menuItemIdentifier = 'mg-item-more';
|
|
423
|
-
return (h(Host, { key: '18219f5c906bb2c42dca842de120d41338a31872', role: "listitem", "data-mg-popover-guard": `${menuItemIdentifier}-popover` }, this.parentMenu && (h("mg-menu-item", { key: '2efd90d30cc2f51c9f5bff8512c765876730ca25', "data-overflow-more": true, "data-size": this.parentMenu.size, "data-style-direction": directions.HORIZONTAL, identifier: menuItemIdentifier }, h("mg-icon", { key: '6d4be9284b63935d298dfe8bf1ba50c70d9b140d', icon: this.icon.icon, size: this.size, slot: "image" }), h("span", { key: '52cd9091b29710fb66d2c421ae64bd31996d3395', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { key: 'ea3152d9de22b209ed016e51e40c658dc6c58cd2', direction: directions.VERTICAL, label: this.messages.menuLabel, size: this.size, ref: ref => {
|
|
424
|
-
if (ref !== null)
|
|
425
|
-
this.itemMoreContainer = ref;
|
|
426
|
-
} })))));
|
|
427
|
-
}
|
|
428
|
-
get element() { return this; }
|
|
429
|
-
static get watchers() { return {
|
|
430
|
-
"icon": ["validateIcon"],
|
|
431
|
-
"slotlabel": ["validateSlotLabel"],
|
|
432
|
-
"size": ["validateSize"]
|
|
433
|
-
}; }
|
|
434
|
-
static get style() { return mgItemMoreCss; }
|
|
435
|
-
}, [257, "mg-item-more", {
|
|
436
|
-
"icon": [16],
|
|
437
|
-
"slotlabel": [16],
|
|
438
|
-
"size": [1],
|
|
439
|
-
"parentMenu": [32]
|
|
440
|
-
}, undefined, {
|
|
441
|
-
"icon": ["validateIcon"],
|
|
442
|
-
"slotlabel": ["validateSlotLabel"],
|
|
443
|
-
"size": ["validateSize"]
|
|
444
|
-
}]);
|
|
445
|
-
function defineCustomElement() {
|
|
446
|
-
if (typeof customElements === "undefined") {
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
const components = ["mg-item-more", "mg-badge", "mg-button", "mg-card", "mg-icon", "mg-item-more", "mg-menu", "mg-menu-item", "mg-popover", "mg-popover-content"];
|
|
450
|
-
components.forEach(tagName => { switch (tagName) {
|
|
451
|
-
case "mg-item-more":
|
|
452
|
-
if (!customElements.get(tagName)) {
|
|
453
|
-
customElements.define(tagName, MgItemMore);
|
|
454
|
-
}
|
|
455
|
-
break;
|
|
456
|
-
case "mg-badge":
|
|
457
|
-
if (!customElements.get(tagName)) {
|
|
458
|
-
defineCustomElement$8();
|
|
459
|
-
}
|
|
460
|
-
break;
|
|
461
|
-
case "mg-button":
|
|
462
|
-
if (!customElements.get(tagName)) {
|
|
463
|
-
defineCustomElement$7();
|
|
464
|
-
}
|
|
465
|
-
break;
|
|
466
|
-
case "mg-card":
|
|
467
|
-
if (!customElements.get(tagName)) {
|
|
468
|
-
defineCustomElement$6();
|
|
469
|
-
}
|
|
470
|
-
break;
|
|
471
|
-
case "mg-icon":
|
|
472
|
-
if (!customElements.get(tagName)) {
|
|
473
|
-
defineCustomElement$5();
|
|
474
|
-
}
|
|
475
|
-
break;
|
|
476
|
-
case "mg-item-more":
|
|
477
|
-
if (!customElements.get(tagName)) {
|
|
478
|
-
defineCustomElement();
|
|
479
|
-
}
|
|
480
|
-
break;
|
|
481
|
-
case "mg-menu":
|
|
482
|
-
if (!customElements.get(tagName)) {
|
|
483
|
-
defineCustomElement$1();
|
|
484
|
-
}
|
|
485
|
-
break;
|
|
486
|
-
case "mg-menu-item":
|
|
487
|
-
if (!customElements.get(tagName)) {
|
|
488
|
-
defineCustomElement$4();
|
|
489
|
-
}
|
|
490
|
-
break;
|
|
491
|
-
case "mg-popover":
|
|
492
|
-
if (!customElements.get(tagName)) {
|
|
493
|
-
defineCustomElement$3();
|
|
494
|
-
}
|
|
495
|
-
break;
|
|
496
|
-
case "mg-popover-content":
|
|
497
|
-
if (!customElements.get(tagName)) {
|
|
498
|
-
defineCustomElement$2();
|
|
499
|
-
}
|
|
500
|
-
break;
|
|
501
|
-
} });
|
|
502
|
-
}
|
|
503
|
-
defineCustomElement();
|
|
504
|
-
|
|
505
|
-
export { MgItemMore as M, MgMenu as a, defineCustomElement$1 as b, defineCustomElement as d };
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as i,h as s,Host as o}from"@stencil/core/internal/client";import{t as m}from"./index2.js";import{d as r,a,s as n}from"./mg-menu-item2.js";import{i as l}from"./index3.js";import{d as c}from"./mg-badge2.js";import{d}from"./mg-button2.js";import{d as h}from"./mg-card2.js";import{d as u}from"./mg-icon2.js";import{d as p}from"./mg-popover2.js";import{d as g}from"./mg-popover-content2.js";class b{constructor(t,e,i){if(this.parentElement=t,this.itemMoreElement=e,this.itemMoreContainerElement=i,this.disconnect=()=>{this._resizeObserver.disconnect()},this.isMoreElement=t=>t===this.itemMoreElement,this.isOverflowElement=(t,e)=>{const i=this.itemMoreContainerElement.children.length>0;return this.isMoreElement(e)?!i:"MG-ITEM-MORE"===e.nextElementSibling.nodeName||i?t>this._availableWidth:t+this.itemMoreElement.offsetWidth>this._availableWidth},this.toggleItem=(t,e)=>{this.isMoreElement(t)&&e?t.setAttribute("hidden",""):this.isMoreElement(t)&&!e?t.removeAttribute("hidden"):!this.isMoreElement(t)&&e?this.itemMoreContainerElement.appendChild(t):this.isMoreElement(t)||t.parentElement===this.parentElement||this.parentElement.insertBefore(t,this.itemMoreElement)},null===this.parentElement||null===this.itemMoreElement||null===this.itemMoreContainerElement)throw new Error("OverflowBehavior - all constructor params are required");const s=Array.from(this.parentElement.children);this._resizeObserver=new ResizeObserver((t=>{this._availableWidth=t.map((t=>t.contentRect.width)).sort(((t,e)=>t-e)).shift(),s.forEach((t=>this.toggleItem(t,!1)));let e=0;s.forEach(((t,i)=>{e+=t.offsetWidth,i>0&&this.toggleItem(t,this.isOverflowElement(e,t))}))})),this._resizeObserver.observe(this.parentElement)}}const f=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.name="mg-menu",this.direction="horizontal",this.size="medium",this.isChildMenu=()=>null!==this.element.closest("mg-menu-item"),this.getMenuItems=(t=this.element)=>{var e,i;const s=Array.from(t.children).filter((t=>"MG-MENU-ITEM"===t.nodeName)),o=null===(i=null===(e=t.querySelector("mg-item-more"))||void 0===e?void 0:e.shadowRoot)||void 0===i?void 0:i.querySelector("mg-menu-item");return null!=o&&s.push(o),s},this.updateMenuItems=()=>{this.getMenuItems().forEach((t=>{t.dataset.styleDirection=this.direction})),this.renderMgItemMore()},this.renderMgItemMore=()=>{var t;if(this.direction===a.VERTICAL||this.direction===a.HORIZONTAL&&this.isChildMenu()||this.element.children.length<=1)return;let e=this.element.querySelector("mg-item-more");null===e&&(e=document.createElement("mg-item-more"),this.element.appendChild(e));for(const t in this.itemmore)e[t]=this.itemmore[t];void 0===(null===(t=this.itemmore)||void 0===t?void 0:t.size)&&(e.size=this.size)}}validateLabel(t){if(void 0===t&&!this.element.hasAttribute("aria-label"))throw new Error(`<${this.name}> prop "label" is required. Passed value: ${m(t)}.`)}validateDirection(t){if(![a.VERTICAL,a.HORIZONTAL].includes(t))throw new Error(`<${this.name}> prop "direction" must be one of: ${a.HORIZONTAL}, ${a.VERTICAL}. Passed value: ${m(t)}.`);this.updateMenuItems()}validateItemMore(t){if(void 0!==t&&this.direction!==a.HORIZONTAL)throw new Error(`<${this.name}> prop "itemmore" must be paired with direction ${a.HORIZONTAL}.`);void 0!==t&&this.renderMgItemMore()}validateSize(t){if(!n.includes(t))throw new Error(`<${this.name}> prop "size" must be one of: ${n.join(", ")}. Passed value: ${m(t)}.`)}updateItemListener(t){if("MG-ACTION-MORE"===t.target.nodeName)return;const e="MG-ITEM-MORE"===t.target.nodeName?t.target.shadowRoot.querySelector("mg-menu-item"):t.target;["click","focus"].forEach((i=>{e.addEventListener(i,(()=>{const i=t.target.closest("mg-menu").querySelector("[data-has-focus]");i!==e&&(null!==i&&i.removeAttribute("data-has-focus"),e.setAttribute("data-has-focus","true"))}))}))}componentWillLoad(){this.validateDirection(this.direction),this.validateLabel(this.label),this.validateItemMore(this.itemmore),this.validateSize(this.size)}componentDidLoad(){this.updateMenuItems(),this.isChildMenu()||this.direction!==a.HORIZONTAL||document.addEventListener("focusin",(t=>{const e=t=>t===this.element||null!==t.parentElement&&e(t.parentElement);if(null===t.target.closest("mg-menu")||!e(t.target)){const t=this.element.querySelector("[data-has-focus]");null!==t&&t.removeAttribute("data-has-focus")}})),new MutationObserver(this.updateMenuItems).observe(this.element,{childList:!0})}render(){return s(o,{key:"753833b01b86d6983f5d063f5598e2187b147a6e",role:"list","aria-label":this.label},s("slot",{key:"56702e49f5a97feddeb66e6271bd898061aa0d48"}))}get element(){return this}static get watchers(){return{label:[{validateLabel:0}],direction:[{validateDirection:0}],itemmore:[{validateItemMore:0}],size:[{validateSize:0}]}}static get style(){return".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host{display:inline-flex;width:100%;min-width:0;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}"}},[257,"mg-menu",{label:[1],direction:[513],itemmore:[16],size:[1]},[[0,"item-loaded","updateItemListener"]],{label:[{validateLabel:0}],direction:[{validateDirection:0}],itemmore:[{validateItemMore:0}],size:[{validateSize:0}]}]);function v(){"undefined"!=typeof customElements&&["mg-menu","mg-badge","mg-button","mg-card","mg-icon","mg-item-more","mg-menu","mg-menu-item","mg-popover","mg-popover-content"].forEach((e=>{switch(e){case"mg-menu":customElements.get(t(e))||customElements.define(t(e),f);break;case"mg-badge":customElements.get(t(e))||c();break;case"mg-button":customElements.get(t(e))||d();break;case"mg-card":customElements.get(t(e))||h();break;case"mg-icon":customElements.get(t(e))||u();break;case"mg-item-more":customElements.get(t(e))||w();break;case"mg-menu":customElements.get(t(e))||v();break;case"mg-menu-item":customElements.get(t(e))||r();break;case"mg-popover":customElements.get(t(e))||p();break;case"mg-popover-content":customElements.get(t(e))||g()}}))}v();const E=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.name="mg-item-more",this.icon={icon:"ellipsis-vertical"},this.slotlabel={display:!1}}validateIcon(t){if("object"!=typeof t||"object"==typeof t&&"string"!=typeof t.icon)throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${m(t)}.`)}validateSlotLabel(t){if("object"!=typeof t||"object"==typeof t&&"boolean"!=typeof t.display)throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${m(t)}.`);"string"!=typeof t.label&&(this.slotlabel.label=this.messages.menuLabel)}validateSize(t){if(t&&!n.includes(t))throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${m(t)}.`)}componentWillLoad(){this.messages=l(this.element).messages.itemMore,this.validateIcon(this.icon),this.validateSlotLabel(this.slotlabel),this.validateSize(this.size)}componentDidLoad(){return setTimeout((()=>{this.parentMenu=this.element.closest("mg-menu")}))}componentDidUpdate(){this.parentMenu&&void 0===this.overflowBehavior&&(this.overflowBehavior=new b(this.parentMenu,this.element,this.itemMoreContainer))}disconnectedCallback(){var t;null===(t=this.overflowBehavior)||void 0===t||t.disconnect()}render(){const t="mg-item-more";return s(o,{key:"18219f5c906bb2c42dca842de120d41338a31872",role:"listitem","data-mg-popover-guard":`${t}-popover`},this.parentMenu&&s("mg-menu-item",{key:"2efd90d30cc2f51c9f5bff8512c765876730ca25","data-overflow-more":!0,"data-size":this.parentMenu.size,"data-style-direction":a.HORIZONTAL,identifier:t},s("mg-icon",{key:"6d4be9284b63935d298dfe8bf1ba50c70d9b140d",icon:this.icon.icon,size:this.size,slot:"image"}),s("span",{key:"52cd9091b29710fb66d2c421ae64bd31996d3395",class:{"mg-u-visually-hidden":!this.slotlabel.display},slot:"label"},this.slotlabel.label),s("mg-menu",{key:"ea3152d9de22b209ed016e51e40c658dc6c58cd2",direction:a.VERTICAL,label:this.messages.menuLabel,size:this.size,ref:t=>{null!==t&&(this.itemMoreContainer=t)}})))}get element(){return this}static get watchers(){return{icon:[{validateIcon:0}],slotlabel:[{validateSlotLabel:0}],size:[{validateSize:0}]}}static get style(){return".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host:not([hidden]){display:flex}"}},[1,"mg-item-more",{icon:[16],slotlabel:[16],size:[1],parentMenu:[32]},void 0,{icon:[{validateIcon:0}],slotlabel:[{validateSlotLabel:0}],size:[{validateSize:0}]}]);function w(){"undefined"!=typeof customElements&&["mg-item-more","mg-badge","mg-button","mg-card","mg-icon","mg-item-more","mg-menu","mg-menu-item","mg-popover","mg-popover-content"].forEach((e=>{switch(e){case"mg-item-more":customElements.get(t(e))||customElements.define(t(e),E);break;case"mg-badge":customElements.get(t(e))||c();break;case"mg-button":customElements.get(t(e))||d();break;case"mg-card":customElements.get(t(e))||h();break;case"mg-icon":customElements.get(t(e))||u();break;case"mg-item-more":customElements.get(t(e))||w();break;case"mg-menu":customElements.get(t(e))||v();break;case"mg-menu-item":customElements.get(t(e))||r();break;case"mg-popover":customElements.get(t(e))||p();break;case"mg-popover-content":customElements.get(t(e))||g()}}))}w();export{E as M,f as a,v as b,w as d}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const MgLoader = MgLoader$1;
|
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
|
5
|
-
|
|
6
|
-
export { MgLoader, defineCustomElement };
|
|
1
|
+
import{M as o,d as r}from"./mg-loader2.js";const s=o,a=r;export{s as MgLoader,a as defineCustomElement}
|
|
@@ -1,74 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { i as initLocales } from './index3.js';
|
|
3
|
-
import { i as isValidString, t as toString } from './index2.js';
|
|
4
|
-
import { d as defineCustomElement$1 } from './mg-icon2.js';
|
|
5
|
-
|
|
6
|
-
const mgLoaderCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host{display:block}.mg-c-loader{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--mg-b-size-4);text-align:center}";
|
|
7
|
-
|
|
8
|
-
const MgLoader = /*@__PURE__*/ proxyCustomElement(class MgLoader extends HTMLElement {
|
|
9
|
-
constructor(registerHost) {
|
|
10
|
-
super();
|
|
11
|
-
if (registerHost !== false) {
|
|
12
|
-
this.__registerHost();
|
|
13
|
-
}
|
|
14
|
-
this.__attachShadow();
|
|
15
|
-
/**
|
|
16
|
-
* Hide message
|
|
17
|
-
*/
|
|
18
|
-
this.messageHide = false;
|
|
19
|
-
}
|
|
20
|
-
watchMessage(newValue) {
|
|
21
|
-
if (newValue && !isValidString(newValue))
|
|
22
|
-
throw new Error(`<mg-loader> prop "message" must be a valid string. Passed value: ${toString(newValue)}.`);
|
|
23
|
-
}
|
|
24
|
-
/*************
|
|
25
|
-
* Lifecycle *
|
|
26
|
-
*************/
|
|
27
|
-
/**
|
|
28
|
-
* Check if component props are well configured on init
|
|
29
|
-
*/
|
|
30
|
-
componentWillLoad() {
|
|
31
|
-
// Get locales
|
|
32
|
-
this.messages = initLocales(this.element).messages;
|
|
33
|
-
// validate props
|
|
34
|
-
this.watchMessage(this.message);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Render
|
|
38
|
-
* @returns HTML Element
|
|
39
|
-
*/
|
|
40
|
-
render() {
|
|
41
|
-
return (h("div", { key: '739b4cbacd8a8da056dbb1445c40fac2cf26766a', class: "mg-c-loader", "aria-live": "polite" }, h("mg-icon", { key: '95d3cbf26fcd6dbf0dad4853bf55aa66385f1aba', icon: "loader", spin: true }), h("span", { key: 'f6322cd3054d8976bd2ec24f86a2d6bb60ca7ae1', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgress)));
|
|
42
|
-
}
|
|
43
|
-
get element() { return this; }
|
|
44
|
-
static get watchers() { return {
|
|
45
|
-
"message": ["watchMessage"]
|
|
46
|
-
}; }
|
|
47
|
-
static get style() { return mgLoaderCss; }
|
|
48
|
-
}, [257, "mg-loader", {
|
|
49
|
-
"message": [1],
|
|
50
|
-
"messageHide": [4, "message-hide"]
|
|
51
|
-
}, undefined, {
|
|
52
|
-
"message": ["watchMessage"]
|
|
53
|
-
}]);
|
|
54
|
-
function defineCustomElement() {
|
|
55
|
-
if (typeof customElements === "undefined") {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const components = ["mg-loader", "mg-icon"];
|
|
59
|
-
components.forEach(tagName => { switch (tagName) {
|
|
60
|
-
case "mg-loader":
|
|
61
|
-
if (!customElements.get(tagName)) {
|
|
62
|
-
customElements.define(tagName, MgLoader);
|
|
63
|
-
}
|
|
64
|
-
break;
|
|
65
|
-
case "mg-icon":
|
|
66
|
-
if (!customElements.get(tagName)) {
|
|
67
|
-
defineCustomElement$1();
|
|
68
|
-
}
|
|
69
|
-
break;
|
|
70
|
-
} });
|
|
71
|
-
}
|
|
72
|
-
defineCustomElement();
|
|
73
|
-
|
|
74
|
-
export { MgLoader as M, defineCustomElement as d };
|
|
1
|
+
import{transformTag as e,proxyCustomElement as t,HTMLElement as i,h as s}from"@stencil/core/internal/client";import{i as a}from"./index3.js";import{i as r,t as n}from"./index2.js";import{d as o}from"./mg-icon2.js";const m=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.messageHide=!1}watchMessage(e){if(e&&!r(e))throw new Error(`<mg-loader> prop "message" must be a valid string. Passed value: ${n(e)}.`)}componentWillLoad(){this.messages=a(this.element).messages,this.watchMessage(this.message)}render(){return s("div",{key:"ad7aa5e4fa0704cf2fa174ae1ed960f72deb79e3",class:"mg-c-loader","aria-live":"polite"},s("mg-icon",{key:"47e6df1e459a74851bf370e460438b7bdc2ed3d0",icon:"loader",spin:!0}),s("span",{key:"44d36e8492401cacb911f21fc707c1de03ae7a5d",class:{"mg-u-visually-hidden":this.messageHide}},this.message||this.messages.loader.inProgress))}get element(){return this}static get watchers(){return{message:[{watchMessage:0}]}}static get style(){return".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host{display:block}.mg-c-loader{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--mg-b-size-4);text-align:center}"}},[1,"mg-loader",{message:[1],messageHide:[4,"message-hide"]},void 0,{message:[{watchMessage:0}]}]);function c(){"undefined"!=typeof customElements&&["mg-loader","mg-icon"].forEach((t=>{switch(t){case"mg-loader":customElements.get(e(t))||customElements.define(e(t),m);break;case"mg-icon":customElements.get(e(t))||o()}}))}c();export{m as M,c as d}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const MgMenuItem = MgMenuItem$1;
|
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
|
5
|
-
|
|
6
|
-
export { MgMenuItem, defineCustomElement };
|
|
1
|
+
import{M as m,d as o}from"./mg-menu-item2.js";const s=m,t=o;export{s as MgMenuItem,t as defineCustomElement}
|