@mgdis/mg-components 6.10.0 → 6.11.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-CfIlskRh.js → index-B_WwxtkQ.js} +4 -4
- package/dist/cjs/{index-CfIlskRh.js.map → index-B_WwxtkQ.js.map} +1 -1
- package/dist/cjs/{index.es-BCLy9yYb.js → index.es-C-3Gv8Eu.js} +85 -81
- package/dist/cjs/index.es-C-3Gv8Eu.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_37.cjs.entry.js +1915 -1909
- package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +6 -6
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-input-combobox.cjs.entry.js +75 -72
- package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -1
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +12 -12
- package/dist/cjs/mg-loader.cjs.entry.js +4 -4
- package/dist/cjs/mg-progress.cjs.entry.js +10 -10
- package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +43 -63
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +67 -45
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +25 -30
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +5 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +47 -97
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/components/index.es.js +71 -68
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +6 -6
- package/dist/components/mg-alert.js +5 -5
- package/dist/components/mg-badge2.js +6 -6
- package/dist/components/mg-button2.js +7 -7
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-character-left2.js +4 -4
- package/dist/components/mg-details.js +8 -4
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-form.js +7 -7
- package/dist/components/mg-icon2.js +6 -6
- package/dist/components/mg-illustrated-message.js +5 -5
- package/dist/components/mg-input-checkbox.js +9 -9
- package/dist/components/mg-input-combobox.js +74 -71
- package/dist/components/mg-input-combobox.js.map +1 -1
- package/dist/components/mg-input-date.js +17 -17
- package/dist/components/mg-input-numeric.js +13 -13
- package/dist/components/mg-input-password.js +3 -3
- package/dist/components/mg-input-radio.js +7 -7
- package/dist/components/mg-input-rich-text-editor.js +11 -11
- package/dist/components/mg-input-select2.js +32 -37
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +9 -9
- package/dist/components/mg-input-textarea.js +7 -7
- package/dist/components/mg-input-title2.js +4 -4
- package/dist/components/mg-input-toggle.js +6 -6
- package/dist/components/mg-input2.js +8 -8
- package/dist/components/mg-item-more2.js +7 -7
- package/dist/components/mg-loader2.js +3 -3
- package/dist/components/mg-menu-item2.js +11 -11
- package/dist/components/mg-message2.js +4 -4
- package/dist/components/mg-modal.js +8 -8
- package/dist/components/mg-pagination2.js +6 -6
- package/dist/components/mg-panel.js +9 -9
- package/dist/components/mg-popover-content2.js +4 -4
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-popover2.js +48 -96
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-progress.js +10 -10
- package/dist/components/mg-skip-links.js +2 -2
- package/dist/components/mg-table.js +6 -6
- package/dist/components/mg-tabs.js +12 -12
- package/dist/components/mg-tag.js +4 -4
- package/dist/components/mg-tooltip-content2.js +1 -1
- package/dist/components/mg-tooltip-content2.js.map +1 -1
- package/dist/components/mg-tooltip2.js +47 -66
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/components/popper.js +1793 -0
- package/dist/components/popper.js.map +1 -0
- package/dist/esm/{index-DmsGewMC.js → index-DHpyFawS.js} +4 -4
- package/dist/esm/{index-DmsGewMC.js.map → index-DHpyFawS.js.map} +1 -1
- package/dist/esm/{index.es-rLV3KFPd.js → index.es-lyrZ9KRh.js} +73 -70
- package/dist/esm/index.es-lyrZ9KRh.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_37.entry.js +1915 -1909
- package/dist/esm/mg-action-more_37.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +6 -6
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-input-combobox.entry.js +75 -72
- package/dist/esm/mg-input-combobox.entry.js.map +1 -1
- package/dist/esm/mg-input-rich-text-editor.entry.js +12 -12
- package/dist/esm/mg-loader.entry.js +4 -4
- package/dist/esm/mg-progress.entry.js +10 -10
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -1
- package/dist/mg-components/{p-ad66e7b3.entry.js → p-596c0e08.entry.js} +2 -2
- package/dist/mg-components/p-8a3bd8ad.entry.js +2 -0
- package/dist/mg-components/p-8a3bd8ad.entry.js.map +1 -0
- package/dist/mg-components/p-98a74b62.entry.js +2 -0
- package/dist/mg-components/{p-cdbe689e.entry.js.map → p-98a74b62.entry.js.map} +1 -1
- package/dist/mg-components/{p-DK9teKTo.js → p-C-vIqOyI.js} +2 -2
- package/dist/mg-components/{p-DK9teKTo.js.map → p-C-vIqOyI.js.map} +1 -1
- package/dist/mg-components/{p-73099ed7.entry.js → p-d4ed3aad.entry.js} +2 -2
- package/dist/mg-components/p-e822bd96.entry.js +2 -0
- package/dist/mg-components/{p-88f77de2.entry.js.map → p-e822bd96.entry.js.map} +1 -1
- package/dist/mg-components/p-fc7b96e6.entry.js +2 -0
- package/dist/mg-components/p-fc7b96e6.entry.js.map +1 -0
- package/dist/mg-components/p-lyrZ9KRh.js +2 -0
- package/dist/mg-components/p-lyrZ9KRh.js.map +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -6
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +6 -8
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -9
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +8 -22
- package/dist/types/components.d.ts +11 -8
- package/ide/intellij/web-types.json +6 -2
- package/ide/vscode/html-custom-data.json +1 -1
- package/package.json +12 -12
- package/dist/cjs/index.es-BCLy9yYb.js.map +0 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js.map +0 -1
- package/dist/collection/utils/floating-ui.utils.js +0 -74
- package/dist/collection/utils/floating-ui.utils.js.map +0 -1
- package/dist/components/floating-ui.utils.js +0 -1721
- package/dist/components/floating-ui.utils.js.map +0 -1
- package/dist/esm/index.es-rLV3KFPd.js.map +0 -1
- package/dist/mg-components/p-0f761c6c.entry.js +0 -2
- package/dist/mg-components/p-0f761c6c.entry.js.map +0 -1
- package/dist/mg-components/p-88f77de2.entry.js +0 -2
- package/dist/mg-components/p-cdbe689e.entry.js +0 -2
- package/dist/mg-components/p-d3a868f0.entry.js +0 -2
- package/dist/mg-components/p-d3a868f0.entry.js.map +0 -1
- package/dist/mg-components/p-rLV3KFPd.js +0 -2
- package/dist/mg-components/p-rLV3KFPd.js.map +0 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -6
- package/dist/types/utils/floating-ui.utils.d.ts +0 -28
- /package/dist/mg-components/{p-ad66e7b3.entry.js.map → p-596c0e08.entry.js.map} +0 -0
- /package/dist/mg-components/{p-73099ed7.entry.js.map → p-d4ed3aad.entry.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
3
|
-
import { i as isFloatingUIPlacement, s as sides, a as alignments, b as autoUpdate, c as computePosition, o as offset, f as flip, d as shift, e as arrow, g as getTransformation, n as numberToPx, l as limitShift } from './floating-ui.utils.js';
|
|
2
|
+
import { D as Dt, B as Bt, Y as Yt, K as Kt } from './index.es.js';
|
|
4
3
|
import { d as defineCustomElement$4 } from './mg-button2.js';
|
|
5
4
|
import { d as defineCustomElement$3 } from './mg-card2.js';
|
|
6
5
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
7
6
|
import { d as defineCustomElement$1 } from './mg-popover-content2.js';
|
|
7
|
+
import { c as createPopper } from './popper.js';
|
|
8
8
|
|
|
9
9
|
const mgPopoverCss = "/*!\n * @prop --mg-c-popover-color-background: Defines the background color of the popover. Default value: `--mg-b-color-light`.\n * @prop --mg-c-popover-color-text: Defines the font color of the popover. Default value: `--mg-b-color-font-dark`.\n * @prop --mg-c-popover-title-font-size: Defines the font size of the popover title. Default value: `--mg-b-font-size-h5`.\n * @prop --mg-c-popover-padding-vertical: Defines the vertical padding of the popover. Default value: `unset`, fallback to `--mg-b-size-16`.\n * @prop --mg-c-popover-padding-horizontal: Defines the horizontal padding of the popover. Default value: `unset`, fallback to `--mg-b-size-16`.\n * @prop --mg-c-popover-max-width: Defines the max-width of the popover. Default value: `--mg-b-size-floating-element-max-width`.\n * @prop --mg-c-popover-min-width: Defines the min-width of the popover. Default value: `unset`.\n */:host{--mg-c-card-spacing:var(--mg-c-popover-padding-vertical, var(--mg-b-size-16)) var(--mg-c-popover-padding-horizontal, var(--mg-b-size-16));--mg-c-card-border:none;--mg-c-card-border-radius:var(--mg-b-size-radius);--mg-c-card-color-background:var(--mg-c-popover-color-background);position:relative;display:contents}:host::slotted(*){display:inline-block}";
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
19
19
|
* Sets an `id` attribute.
|
|
20
20
|
* Needed by the input for accessibility `aria-decribedby`.
|
|
21
21
|
*/
|
|
22
|
-
this.identifier =
|
|
22
|
+
this.identifier = Dt('mg-popover');
|
|
23
23
|
/**
|
|
24
24
|
* Popover placement
|
|
25
25
|
*/
|
|
@@ -57,12 +57,13 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
57
57
|
this.mgPopover.dataset.show = '';
|
|
58
58
|
// Update aria-expanded
|
|
59
59
|
this.interactiveElement.setAttribute('aria-expanded', 'true');
|
|
60
|
+
// Enable the event listeners
|
|
61
|
+
this.setPopperListeners(true);
|
|
60
62
|
// hide when click outside
|
|
61
63
|
// setTimeout is used to prevent event to trigger after creation
|
|
62
64
|
setTimeout(() => {
|
|
63
65
|
this.manageClickOutsideListeners('addEventListener');
|
|
64
66
|
});
|
|
65
|
-
this.updatePopover();
|
|
66
67
|
};
|
|
67
68
|
/**
|
|
68
69
|
* Hide popover
|
|
@@ -72,9 +73,18 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
72
73
|
this.mgPopover.removeAttribute('data-show');
|
|
73
74
|
// Update aria-expanded
|
|
74
75
|
this.interactiveElement.setAttribute('aria-expanded', 'false');
|
|
76
|
+
// Disable the event listeners
|
|
77
|
+
this.setPopperListeners(false);
|
|
75
78
|
// Remove event listener
|
|
76
79
|
this.manageClickOutsideListeners('removeEventListener');
|
|
77
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Set popper listeners
|
|
83
|
+
* @param newValue - if true enable popper listners
|
|
84
|
+
*/
|
|
85
|
+
this.setPopperListeners = (newValue) => {
|
|
86
|
+
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: newValue }] })));
|
|
87
|
+
};
|
|
78
88
|
/**
|
|
79
89
|
* Manage all clickOustside listeners
|
|
80
90
|
* @param action - top process on elements listeners
|
|
@@ -112,7 +122,7 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
112
122
|
this.mgPopoverContent.addEventListener('hide-content', this.handleHideContent);
|
|
113
123
|
const arrow = document.createElement('div');
|
|
114
124
|
arrow.setAttribute('slot', 'arrow');
|
|
115
|
-
arrow.dataset.
|
|
125
|
+
arrow.dataset.popperArrow = '';
|
|
116
126
|
this.mgPopoverContent.appendChild(arrow);
|
|
117
127
|
// insert elements in DOM
|
|
118
128
|
['[slot="title"]', '[slot="content"]:not(mg-popover-content)'].forEach(slotType => {
|
|
@@ -126,82 +136,14 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
126
136
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
127
137
|
}
|
|
128
138
|
};
|
|
129
|
-
/**
|
|
130
|
-
* Get alternative placements ordered by proximity to initial placement
|
|
131
|
-
* First check fallbackPlacement attribute, then generate alternatives:
|
|
132
|
-
* 1. Same side with different alignments (start, center, end)
|
|
133
|
-
* 2. Other sides in order
|
|
134
|
-
* @param placement - initial placement
|
|
135
|
-
* @returns array of alternative placements
|
|
136
|
-
*/
|
|
137
|
-
this.getClosestPlacements = (placement) => {
|
|
138
|
-
// First check if fallbackPlacement attribute is defined
|
|
139
|
-
const fallbackPlacements = (this.element.dataset.fallbackPlacement || '')
|
|
140
|
-
.split(',')
|
|
141
|
-
.map(t => t.trim())
|
|
142
|
-
.filter(isFloatingUIPlacement);
|
|
143
|
-
if (fallbackPlacements.length > 0)
|
|
144
|
-
return Array.from(new Set([...fallbackPlacements, ...sides]).values()).filter(isFloatingUIPlacement);
|
|
145
|
-
// Extract side from placement (e.g. "top" from "top-start")
|
|
146
|
-
const [side] = placement.split('-');
|
|
147
|
-
// Generate placements for same side with different alignments
|
|
148
|
-
const currentSidePlacements = alignments.map(alignment => (alignment !== null ? `${side}-${alignment}` : side));
|
|
149
|
-
// Return unique placements: current side variants first, then other sides
|
|
150
|
-
return Array.from(new Set([...currentSidePlacements, ...sides.filter(otherSide => otherSide !== side)])).filter(isFloatingUIPlacement);
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* Update popover position
|
|
154
|
-
* @returns autoUpdate function
|
|
155
|
-
*/
|
|
156
|
-
this.updatePopover = () => autoUpdate(this.interactiveElement, this.mgPopover, async () => {
|
|
157
|
-
const { x, y, placement, middlewareData } = await computePosition(this.interactiveElement, this.mgPopover, {
|
|
158
|
-
placement: this.placement,
|
|
159
|
-
strategy: 'fixed',
|
|
160
|
-
middleware: [
|
|
161
|
-
offset(0),
|
|
162
|
-
flip({
|
|
163
|
-
fallbackPlacements: this.getClosestPlacements(this.placement),
|
|
164
|
-
}),
|
|
165
|
-
shift({
|
|
166
|
-
limiter: limitShift(),
|
|
167
|
-
}),
|
|
168
|
-
arrow({
|
|
169
|
-
element: this.arrowElement,
|
|
170
|
-
}),
|
|
171
|
-
],
|
|
172
|
-
});
|
|
173
|
-
Object.assign(this.mgPopover.style, {
|
|
174
|
-
transform: getTransformation(x, y),
|
|
175
|
-
});
|
|
176
|
-
// Arrow positioning
|
|
177
|
-
if (this.arrowElement !== null) {
|
|
178
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
179
|
-
const staticSide = {
|
|
180
|
-
top: 'bottom',
|
|
181
|
-
right: 'left',
|
|
182
|
-
bottom: 'top',
|
|
183
|
-
left: 'right',
|
|
184
|
-
}[placement.split('-')[0]];
|
|
185
|
-
Object.assign(this.arrowElement.style, {
|
|
186
|
-
left: numberToPx(arrowX),
|
|
187
|
-
top: numberToPx(arrowY),
|
|
188
|
-
[staticSide]: '1px',
|
|
189
|
-
});
|
|
190
|
-
this.mgPopover.setAttribute('data-placement', placement);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
139
|
}
|
|
194
140
|
validateIdentifier(newValue) {
|
|
195
|
-
if (!
|
|
196
|
-
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${
|
|
141
|
+
if (!Bt(newValue)) {
|
|
142
|
+
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${Yt(newValue)}.`);
|
|
197
143
|
}
|
|
198
144
|
// use renderPopoverContent to update popover-content id
|
|
199
145
|
this.renderPopoverContent();
|
|
200
146
|
}
|
|
201
|
-
watchPlacement(newValue) {
|
|
202
|
-
if (!isFloatingUIPlacement(newValue))
|
|
203
|
-
this.placement = 'bottom';
|
|
204
|
-
}
|
|
205
147
|
validateArrowHide(newValue) {
|
|
206
148
|
if (newValue)
|
|
207
149
|
this.mgPopoverContent.dataset.arrowHide = '';
|
|
@@ -227,20 +169,19 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
227
169
|
* update popper position after props change on component did update hook to benefit from render ended
|
|
228
170
|
*/
|
|
229
171
|
componentDidUpdate() {
|
|
230
|
-
this.
|
|
172
|
+
this.popper.update();
|
|
231
173
|
}
|
|
232
174
|
/**
|
|
233
175
|
* Check if component props are well configured on init
|
|
234
176
|
*/
|
|
235
177
|
componentWillLoad() {
|
|
236
178
|
// Get windows to attach events
|
|
237
|
-
this.windows =
|
|
179
|
+
this.windows = Kt(window);
|
|
238
180
|
// render mg-popover-content slot
|
|
239
181
|
this.renderPopoverContent();
|
|
240
182
|
this.validateCloseButton(this.closeButton);
|
|
241
183
|
this.validateIdentifier(this.identifier);
|
|
242
184
|
this.validateArrowHide(this.arrowHide);
|
|
243
|
-
this.watchPlacement(this.placement);
|
|
244
185
|
}
|
|
245
186
|
/**
|
|
246
187
|
* Check if component props are well configured on init
|
|
@@ -248,17 +189,38 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
248
189
|
componentDidLoad() {
|
|
249
190
|
// Get popover content
|
|
250
191
|
this.mgPopover = this.element.querySelector(`#${this.identifier}`);
|
|
251
|
-
//
|
|
252
|
-
this.arrowElement = this.mgPopover.querySelector('[data-floating-arrow]');
|
|
253
|
-
// Get interactive element (first element without slot attribute)
|
|
192
|
+
//Get interactive element (first element without slot attribute)
|
|
254
193
|
this.interactiveElement = this.element.querySelector(':not([slot])');
|
|
255
194
|
// Add aria attributes
|
|
256
195
|
this.interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
257
196
|
this.interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
258
|
-
|
|
259
|
-
|
|
197
|
+
const fallbackPlacements = [];
|
|
198
|
+
if (this.element.dataset.fallbackPlacement !== undefined) {
|
|
199
|
+
fallbackPlacements.push(this.element.dataset.fallbackPlacement);
|
|
200
|
+
}
|
|
201
|
+
// Create popperjs popover
|
|
202
|
+
this.popper = createPopper(this.interactiveElement, this.mgPopover, {
|
|
203
|
+
placement: this.placement,
|
|
204
|
+
strategy: 'fixed',
|
|
205
|
+
modifiers: [
|
|
206
|
+
{
|
|
207
|
+
name: 'offset',
|
|
208
|
+
options: {
|
|
209
|
+
offset: [0, 0],
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'flip',
|
|
214
|
+
options: {
|
|
215
|
+
fallbackPlacements: [...fallbackPlacements, 'auto'],
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
});
|
|
220
|
+
// add resize observer
|
|
221
|
+
[this.interactiveElement, this.element.querySelector('mg-popover-content')].forEach(element => {
|
|
260
222
|
new ResizeObserver(() => {
|
|
261
|
-
this.
|
|
223
|
+
this.popper.update();
|
|
262
224
|
}).observe(element);
|
|
263
225
|
});
|
|
264
226
|
// Add events to toggle display
|
|
@@ -282,25 +244,16 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
282
244
|
});
|
|
283
245
|
this.handleDisplay(this.display);
|
|
284
246
|
}
|
|
285
|
-
/**
|
|
286
|
-
* Cleanup when component is disconnected
|
|
287
|
-
*/
|
|
288
|
-
disconnectedCallback() {
|
|
289
|
-
var _a;
|
|
290
|
-
// Cleanup Floating UI instance
|
|
291
|
-
(_a = this.updatePopover) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
292
|
-
}
|
|
293
247
|
/**
|
|
294
248
|
* Render
|
|
295
249
|
* @returns HTML Element
|
|
296
250
|
*/
|
|
297
251
|
render() {
|
|
298
|
-
return (h(Host, { key: '
|
|
252
|
+
return (h(Host, { key: '59f4be0c4d8f066a2f5c6197f237b4bb802fa4fa' }, h("slot", { key: 'bcaaa47052d360711722b9f617b93a4f0f148ca8' }), h("slot", { key: '598390c0e09b27edc2f2a77e29ee2a501a6ecdf8', name: "content" })));
|
|
299
253
|
}
|
|
300
254
|
get element() { return this; }
|
|
301
255
|
static get watchers() { return {
|
|
302
256
|
"identifier": ["validateIdentifier"],
|
|
303
|
-
"placement": ["watchPlacement"],
|
|
304
257
|
"arrowHide": ["validateArrowHide"],
|
|
305
258
|
"closeButton": ["validateCloseButton"],
|
|
306
259
|
"display": ["handleDisplay"]
|
|
@@ -308,14 +261,13 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class MgPopover extends HTMLE
|
|
|
308
261
|
static get style() { return mgPopoverCss; }
|
|
309
262
|
}, [1, "mg-popover", {
|
|
310
263
|
"identifier": [1],
|
|
311
|
-
"placement": [
|
|
264
|
+
"placement": [1],
|
|
312
265
|
"arrowHide": [4, "arrow-hide"],
|
|
313
266
|
"closeButton": [4, "close-button"],
|
|
314
267
|
"display": [1028],
|
|
315
268
|
"disabled": [4]
|
|
316
269
|
}, undefined, {
|
|
317
270
|
"identifier": ["validateIdentifier"],
|
|
318
|
-
"placement": ["watchPlacement"],
|
|
319
271
|
"arrowHide": ["validateArrowHide"],
|
|
320
272
|
"closeButton": ["validateCloseButton"],
|
|
321
273
|
"display": ["handleDisplay"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"mg-popover2.js","mappings":";;;;;;;;AAAA,MAAM,YAAY,GAAG,muCAAmuC;;MCe3uC,SAAS,iBAAAA,kBAAA,CAAA,MAAA,SAAA,SAAA,WAAA,CAAA;AALtB,IAAA,WAAA,GAAA;;;;;;AAyBE;;;AAGG;AACK,QAAA,IAAA,CAAA,UAAU,GAAWC,EAAQ,CAAC,YAAY,CAAC;AAUnD;;AAEG;AACsB,QAAA,IAAS,CAAA,SAAA,GAAyB,QAAQ;AAMnE;;AAEG;AACK,QAAA,IAAS,CAAA,SAAA,GAAG,KAAK;AAOzB;;AAEG;AACK,QAAA,IAAW,CAAA,WAAA,GAAG,KAAK;AAM3B;;AAEG;AACsB,QAAA,IAAO,CAAA,OAAA,GAAG,KAAK;AAWxC;;AAEG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAG,KAAK;AAYxB;;;AAGG;AACK,QAAA,IAAA,CAAA,YAAY,GAAG,CAAC,KAA2C,KAAU;AAC3E,YAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA,wBAAA,EAA2B,IAAI,CAAC,UAAU,CAAI,EAAA,CAAA,CAAC,KAAK,IAAI,EAAE;AAC1J,gBAAA,IAAI,CAAC,OAAO,GAAG,KAAK;;AAExB,SAAC;AAED;;AAEG;AACK,QAAA,IAAI,CAAA,IAAA,GAA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-popover&encapsulation=shadow","src/components/molecules/mg-popover/mg-popover.tsx"],"sourcesContent":["/*!\n * @prop --mg-c-popover-color-background: Defines the background color of the popover. Default value: `--mg-b-color-light`.\n * @prop --mg-c-popover-color-text: Defines the font color of the popover. Default value: `--mg-b-color-font-dark`.\n * @prop --mg-c-popover-title-font-size: Defines the font size of the popover title. Default value: `--mg-b-font-size-h5`.\n * @prop --mg-c-popover-padding-vertical: Defines the vertical padding of the popover. Default value: `unset`, fallback to `--mg-b-size-16`.\n * @prop --mg-c-popover-padding-horizontal: Defines the horizontal padding of the popover. Default value: `unset`, fallback to `--mg-b-size-16`.\n * @prop --mg-c-popover-max-width: Defines the max-width of the popover. Default value: `--mg-b-size-floating-element-max-width`.\n * @prop --mg-c-popover-min-width: Defines the min-width of the popover. Default value: `unset`.\n */:host{--mg-c-card-spacing: var(--mg-c-popover-padding-vertical, var(--mg-b-size-16)) var(--mg-c-popover-padding-horizontal, var(--mg-b-size-16));--mg-c-card-border: none;--mg-c-card-border-radius: var(--mg-b-size-radius);--mg-c-card-color-background: var(--mg-c-popover-color-background);position:relative;display:contents}:host::slotted(*){display:inline-block}/*# sourceMappingURL=mg-popover.css.map */\n","import { Component, Element, Host, h, Prop, Watch, EventEmitter, Event } from '@stencil/core';\nimport { createID, getWindows, isValideID, toString } from '@mgdis/stencil-helpers';\nimport { computePosition, autoUpdate, flip, shift, limitShift, offset, arrow, type Placement } from '@floating-ui/dom';\nimport { isFloatingUIPlacement, type PopoverPlacementType, sides, alignments, getTransformation, numberToPx } from './mg-popover.conf';\n\n/**\n * @slot - Element that will display the popover\n * @slot content - popover content\n * @slot title - popover title\n */\n@Component({\n tag: 'mg-popover',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-popover.css',\n shadow: true,\n})\nexport class MgPopover {\n /************\n * Internal *\n ************/\n\n private mgPopover: HTMLElement;\n private mgPopoverContent: HTMLMgPopoverContentElement;\n private windows: Window[];\n private interactiveElement: HTMLElement;\n private arrowElement: HTMLElement;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPopoverElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-popover');\n @Watch('identifier')\n validateIdentifier(newValue: MgPopover['identifier']): void {\n if (!isValideID(newValue)) {\n throw new Error(`<mg-popover> prop \"identifier\" value is invalid. Passed value: ${toString(newValue)}.`);\n }\n // use renderPopoverContent to update popover-content id\n this.renderPopoverContent();\n }\n\n /**\n * Popover placement\n */\n @Prop({ mutable: true }) placement: PopoverPlacementType = 'bottom';\n @Watch('placement')\n watchPlacement(newValue): void {\n if (!isFloatingUIPlacement(newValue)) this.placement = 'bottom';\n }\n\n /**\n * Hide popover arrow\n */\n @Prop() arrowHide = false;\n @Watch('arrowHide')\n validateArrowHide(newValue: MgPopover['arrowHide']): void {\n if (newValue) this.mgPopoverContent.dataset.arrowHide = '';\n else delete this.mgPopoverContent.dataset.arrowHide;\n }\n\n /**\n * Define if popover has a cross button\n */\n @Prop() closeButton = false;\n @Watch('closeButton')\n validateCloseButton(newValue: MgPopover['closeButton']): void {\n this.mgPopoverContent.closeButton = newValue;\n }\n\n /**\n * Display popover\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n handleDisplay(newValue: boolean): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n this.displayChange.emit(newValue);\n }\n\n /**\n * Disable popover\n */\n @Prop() disabled = false;\n\n /**\n * Emited event when display value change\n */\n @Event({ eventName: 'display-change' }) displayChange: EventEmitter<HTMLMgPopoverElement['display']>;\n\n /**\n * Emmited event when popover is closed\n */\n @Event({ eventName: 'component-close' }) componentClose: EventEmitter<void>;\n\n /**\n * Check if clicked outside of component\n * @param event - mouse event\n */\n private clickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n if (!this.disabled && event.target.closest('mg-popover') !== this.element && event.target.closest(`[data-mg-popover-guard=\"${this.identifier}\"]`) === null) {\n this.display = false;\n }\n };\n\n /**\n * Show popover\n */\n private show = (): void => {\n // Make the popover visible\n this.mgPopover.dataset.show = '';\n // Update aria-expanded\n this.interactiveElement.setAttribute('aria-expanded', 'true');\n // hide when click outside\n // setTimeout is used to prevent event to trigger after creation\n setTimeout(() => {\n this.manageClickOutsideListeners('addEventListener');\n });\n this.updatePopover();\n };\n\n /**\n * Hide popover\n */\n private hide = (): void => {\n // Hide the popover\n this.mgPopover.removeAttribute('data-show');\n // Update aria-expanded\n this.interactiveElement.setAttribute('aria-expanded', 'false');\n // Remove event listener\n this.manageClickOutsideListeners('removeEventListener');\n };\n\n /**\n * Manage all clickOustside listeners\n * @param action - top process on elements listeners\n */\n private manageClickOutsideListeners = (action: 'removeEventListener' | 'addEventListener'): void => {\n // clickOutside listeners need to bind windows\n // AND as shawdowDom content is not include on windows listeners `event.target` we need to include popover guard content DOM if it's a web-component\n // by doing this we can get and parse all needeed document DOM elements in clickOutside callback event.details.\n // This result in the givern junction :\n // Windows > document > [data-mg-popover-guard] + [data-mg-popover-guard] > shadowRoot = Windows > document > [data-mg-popover-guard] > shadowRoot\n const guardChildren = Array.from(document.querySelector(`[data-mg-popover-guard=\"${this.identifier}\"]`)?.shadowRoot?.children || new Set());\n [...guardChildren, ...this.windows].forEach((element: Window | HTMLElement) => {\n if (element !== null) {\n element[action]('click', this.clickOutside, false);\n }\n });\n };\n\n /**\n * Handle content hide event\n */\n private handleHideContent = (): void => {\n this.display = false;\n this.componentClose.emit();\n };\n\n /**\n * Render popover content element\n */\n private renderPopoverContent = (): void => {\n const mgPopoverContent = this.element.querySelector('mg-popover-content');\n if (mgPopoverContent === null) {\n this.mgPopoverContent = document.createElement('mg-popover-content');\n this.mgPopoverContent.setAttribute('slot', 'content');\n this.mgPopoverContent.setAttribute('id', this.identifier);\n this.mgPopoverContent.addEventListener('hide-content', this.handleHideContent);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.floatingArrow = '';\n this.mgPopoverContent.appendChild(arrow);\n\n // insert elements in DOM\n ['[slot=\"title\"]', '[slot=\"content\"]:not(mg-popover-content)'].forEach(slotType => {\n Array.from(this.element.querySelectorAll(slotType)).forEach(slot => {\n this.mgPopoverContent.appendChild(slot);\n });\n });\n this.element.appendChild(this.mgPopoverContent);\n } else {\n mgPopoverContent.setAttribute('id', this.identifier);\n }\n };\n\n /**\n * Get alternative placements ordered by proximity to initial placement\n * First check fallbackPlacement attribute, then generate alternatives:\n * 1. Same side with different alignments (start, center, end)\n * 2. Other sides in order\n * @param placement - initial placement\n * @returns array of alternative placements\n */\n private getClosestPlacements = (placement: PopoverPlacementType): Placement[] => {\n // First check if fallbackPlacement attribute is defined\n const fallbackPlacements = (this.element.dataset.fallbackPlacement || '')\n .split(',')\n .map(t => t.trim())\n .filter(isFloatingUIPlacement);\n if (fallbackPlacements.length > 0) return Array.from(new Set([...fallbackPlacements, ...sides]).values()).filter(isFloatingUIPlacement);\n\n // Extract side from placement (e.g. \"top\" from \"top-start\")\n const [side] = placement.split('-');\n\n // Generate placements for same side with different alignments\n const currentSidePlacements = alignments.map(alignment => (alignment !== null ? `${side}-${alignment}` : side));\n\n // Return unique placements: current side variants first, then other sides\n return Array.from(new Set([...currentSidePlacements, ...sides.filter(otherSide => otherSide !== side)])).filter(isFloatingUIPlacement);\n };\n\n /**\n * Update popover position\n * @returns autoUpdate function\n */\n private updatePopover = () =>\n autoUpdate(this.interactiveElement, this.mgPopover, async () => {\n const { x, y, placement, middlewareData } = await computePosition(this.interactiveElement, this.mgPopover, {\n placement: this.placement as Placement,\n strategy: 'fixed',\n middleware: [\n offset(0),\n flip({\n fallbackPlacements: this.getClosestPlacements(this.placement),\n }),\n shift({\n limiter: limitShift(),\n }),\n arrow({\n element: this.arrowElement,\n }),\n ],\n });\n\n Object.assign(this.mgPopover.style, {\n transform: getTransformation(x, y),\n });\n\n // Arrow positioning\n if (this.arrowElement !== null) {\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]];\n\n Object.assign(this.arrowElement.style, {\n left: numberToPx(arrowX),\n top: numberToPx(arrowY),\n [staticSide]: '1px',\n });\n\n this.mgPopover.setAttribute('data-placement', placement);\n }\n });\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.updatePopover();\n }\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n // render mg-popover-content slot\n this.renderPopoverContent();\n this.validateCloseButton(this.closeButton);\n this.validateIdentifier(this.identifier);\n this.validateArrowHide(this.arrowHide);\n this.watchPlacement(this.placement);\n }\n\n /**\n * Check if component props are well configured on init\n */\n componentDidLoad(): void {\n // Get popover content\n this.mgPopover = this.element.querySelector(`#${this.identifier}`);\n\n // Get arrow element\n this.arrowElement = this.mgPopover.querySelector('[data-floating-arrow]');\n\n // Get interactive element (first element without slot attribute)\n this.interactiveElement = this.element.querySelector(':not([slot])');\n\n // Add aria attributes\n this.interactiveElement.setAttribute('aria-controls', this.identifier);\n this.interactiveElement.setAttribute('aria-expanded', `${this.display}`);\n\n // Add resize observer\n [this.interactiveElement, this.mgPopoverContent].forEach(element => {\n new ResizeObserver(() => {\n this.updatePopover();\n }).observe(element);\n });\n\n // Add events to toggle display\n this.interactiveElement.addEventListener('click', () => {\n if (!this.disabled) this.display = !this.display;\n });\n\n this.element.addEventListener('click', (event: MouseEvent & { target: HTMLElement }): void => {\n const target = event.target.closest('[popovertargetaction]');\n if (this.display === true && target !== null && target.getAttribute('popovertargetaction') === 'hide') {\n this.display = false;\n }\n });\n\n // Add events to hide popover\n this.element.addEventListener('keydown', e => {\n if (!this.disabled && e.code === 'Escape') {\n this.display = false;\n this.componentClose.emit();\n this.interactiveElement.focus();\n }\n });\n\n this.handleDisplay(this.display);\n }\n\n /**\n * Cleanup when component is disconnected\n */\n disconnectedCallback(): void {\n // Cleanup Floating UI instance\n this.updatePopover?.();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"mg-popover2.js","mappings":";;;;;;;;AAAA,MAAM,YAAY,GAAG,muCAAmuC;;MCc3uC,SAAS,iBAAAA,kBAAA,CAAA,MAAA,SAAA,SAAA,WAAA,CAAA;AALtB,IAAA,WAAA,GAAA;;;;;;AAyBE;;;AAGG;AACK,QAAA,IAAA,CAAA,UAAU,GAAWC,EAAQ,CAAC,YAAY,CAAC;AAUnD;;AAEG;AACK,QAAA,IAAS,CAAA,SAAA,GAAc,QAAQ;AAEvC;;AAEG;AACK,QAAA,IAAS,CAAA,SAAA,GAAG,KAAK;AAOzB;;AAEG;AACK,QAAA,IAAW,CAAA,WAAA,GAAG,KAAK;AAM3B;;AAEG;AACsB,QAAA,IAAO,CAAA,OAAA,GAAG,KAAK;AAWxC;;AAEG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAG,KAAK;AAYxB;;;AAGG;AACK,QAAA,IAAA,CAAA,YAAY,GAAG,CAAC,KAA2C,KAAU;AAC3E,YAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA,wBAAA,EAA2B,IAAI,CAAC,UAAU,CAAI,EAAA,CAAA,CAAC,KAAK,IAAI,EAAE;AAC1J,gBAAA,IAAI,CAAC,OAAO,GAAG,KAAK;;AAExB,SAAC;AAED;;AAEG;AACK,QAAA,IAAI,CAAA,IAAA,GAAG,MAAW;;YAExB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE;;YAEhC,IAAI,CAAC,kBAAkB,CAA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K,QAAQ,EAAE;AACzC,gBAAA,IAAI,CAAC,OAAO,GAAG,KAAK;AACpB,gBAAA,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE;AAC1B,gBAAA,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE;;AAEnC,SAAC,CAAC;AAEF,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC;;AAGlC;;;AAGG;IACH,MAAM,GAAA;AACJ,QAAA,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,EACb,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,SAAS,EAAQ,CAAA,CACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","createID","isValideID","toString","getWindows"],"sources":["../styles/dist/components/mg-popover.css?tag=mg-popover&encapsulation=shadow","src/components/molecules/mg-popover/mg-popover.tsx"],"sourcesContent":["/*!\n * @prop --mg-c-popover-color-background: Defines the background color of the popover. Default value: `--mg-b-color-light`.\n * @prop --mg-c-popover-color-text: Defines the font color of the popover. Default value: `--mg-b-color-font-dark`.\n * @prop --mg-c-popover-title-font-size: Defines the font size of the popover title. Default value: `--mg-b-font-size-h5`.\n * @prop --mg-c-popover-padding-vertical: Defines the vertical padding of the popover. Default value: `unset`, fallback to `--mg-b-size-16`.\n * @prop --mg-c-popover-padding-horizontal: Defines the horizontal padding of the popover. Default value: `unset`, fallback to `--mg-b-size-16`.\n * @prop --mg-c-popover-max-width: Defines the max-width of the popover. Default value: `--mg-b-size-floating-element-max-width`.\n * @prop --mg-c-popover-min-width: Defines the min-width of the popover. Default value: `unset`.\n */:host{--mg-c-card-spacing: var(--mg-c-popover-padding-vertical, var(--mg-b-size-16)) var(--mg-c-popover-padding-horizontal, var(--mg-b-size-16));--mg-c-card-border: none;--mg-c-card-border-radius: var(--mg-b-size-radius);--mg-c-card-color-background: var(--mg-c-popover-color-background);position:relative;display:contents}:host::slotted(*){display:inline-block}/*# sourceMappingURL=mg-popover.css.map */\n","import { Component, Element, Host, h, Prop, Watch, EventEmitter, Event } from '@stencil/core';\nimport { createID, getWindows, isValideID, toString } from '@mgdis/stencil-helpers';\nimport { Instance as PopperInstance, createPopper, Placement } from '@popperjs/core';\n\n/**\n * @slot - Element that will display the popover\n * @slot content - popover content\n * @slot title - popover title\n */\n@Component({\n tag: 'mg-popover',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-popover.css',\n shadow: true,\n})\nexport class MgPopover {\n /************\n * Internal *\n ************/\n\n private popper: PopperInstance;\n private mgPopover: HTMLElement;\n private mgPopoverContent: HTMLMgPopoverContentElement;\n private windows: Window[];\n private interactiveElement: HTMLElement;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPopoverElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-popover');\n @Watch('identifier')\n validateIdentifier(newValue: MgPopover['identifier']): void {\n if (!isValideID(newValue)) {\n throw new Error(`<mg-popover> prop \"identifier\" value is invalid. Passed value: ${toString(newValue)}.`);\n }\n // use renderPopoverContent to update popover-content id\n this.renderPopoverContent();\n }\n\n /**\n * Popover placement\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Hide popover arrow\n */\n @Prop() arrowHide = false;\n @Watch('arrowHide')\n validateArrowHide(newValue: MgPopover['arrowHide']): void {\n if (newValue) this.mgPopoverContent.dataset.arrowHide = '';\n else delete this.mgPopoverContent.dataset.arrowHide;\n }\n\n /**\n * Define if popover has a cross button\n */\n @Prop() closeButton = false;\n @Watch('closeButton')\n validateCloseButton(newValue: MgPopover['closeButton']): void {\n this.mgPopoverContent.closeButton = newValue;\n }\n\n /**\n * Display popover\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n handleDisplay(newValue: boolean): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n this.displayChange.emit(newValue);\n }\n\n /**\n * Disable popover\n */\n @Prop() disabled = false;\n\n /**\n * Emited event when display value change\n */\n @Event({ eventName: 'display-change' }) displayChange: EventEmitter<HTMLMgPopoverElement['display']>;\n\n /**\n * Emmited event when popover is closed\n */\n @Event({ eventName: 'component-close' }) componentClose: EventEmitter<void>;\n\n /**\n * Check if clicked outside of component\n * @param event - mouse event\n */\n private clickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n if (!this.disabled && event.target.closest('mg-popover') !== this.element && event.target.closest(`[data-mg-popover-guard=\"${this.identifier}\"]`) === null) {\n this.display = false;\n }\n };\n\n /**\n * Show popover\n */\n private show = (): void => {\n // Make the popover visible\n this.mgPopover.dataset.show = '';\n // Update aria-expanded\n this.interactiveElement.setAttribute('aria-expanded', 'true');\n // Enable the event listeners\n this.setPopperListeners(true);\n // hide when click outside\n // setTimeout is used to prevent event to trigger after creation\n setTimeout(() => {\n this.manageClickOutsideListeners('addEventListener');\n });\n };\n\n /**\n * Hide popover\n */\n private hide = (): void => {\n // Hide the popover\n this.mgPopover.removeAttribute('data-show');\n // Update aria-expanded\n this.interactiveElement.setAttribute('aria-expanded', 'false');\n // Disable the event listeners\n this.setPopperListeners(false);\n // Remove event listener\n this.manageClickOutsideListeners('removeEventListener');\n };\n\n /**\n * Set popper listeners\n * @param newValue - if true enable popper listners\n */\n private setPopperListeners = (newValue: boolean): void => {\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: newValue }],\n }));\n };\n\n /**\n * Manage all clickOustside listeners\n * @param action - top process on elements listeners\n */\n private manageClickOutsideListeners = (action: 'removeEventListener' | 'addEventListener'): void => {\n // clickOutside listeners need to bind windows\n // AND as shawdowDom content is not include on windows listeners `event.target` we need to include popover guard content DOM if it's a web-component\n // by doing this we can get and parse all needeed document DOM elements in clickOutside callback event.details.\n // This result in the givern junction :\n // Windows > document > [data-mg-popover-guard] + [data-mg-popover-guard] > shadowRoot = Windows > document > [data-mg-popover-guard] > shadowRoot\n const guardChildren = Array.from(document.querySelector(`[data-mg-popover-guard=\"${this.identifier}\"]`)?.shadowRoot?.children || new Set());\n [...guardChildren, ...this.windows].forEach((element: Window | HTMLElement) => {\n if (element !== null) {\n element[action]('click', this.clickOutside, false);\n }\n });\n };\n\n /**\n * Handle content hide event\n */\n private handleHideContent = (): void => {\n this.display = false;\n this.componentClose.emit();\n };\n\n /**\n * Render popover content element\n */\n private renderPopoverContent = (): void => {\n const mgPopoverContent = this.element.querySelector('mg-popover-content');\n if (mgPopoverContent === null) {\n this.mgPopoverContent = document.createElement('mg-popover-content');\n this.mgPopoverContent.setAttribute('slot', 'content');\n this.mgPopoverContent.setAttribute('id', this.identifier);\n this.mgPopoverContent.addEventListener('hide-content', this.handleHideContent);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.popperArrow = '';\n this.mgPopoverContent.appendChild(arrow);\n\n // insert elements in DOM\n ['[slot=\"title\"]', '[slot=\"content\"]:not(mg-popover-content)'].forEach(slotType => {\n Array.from(this.element.querySelectorAll(slotType)).forEach(slot => {\n this.mgPopoverContent.appendChild(slot);\n });\n });\n this.element.appendChild(this.mgPopoverContent);\n } else {\n mgPopoverContent.setAttribute('id', this.identifier);\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.popper.update();\n }\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n // render mg-popover-content slot\n this.renderPopoverContent();\n this.validateCloseButton(this.closeButton);\n this.validateIdentifier(this.identifier);\n this.validateArrowHide(this.arrowHide);\n }\n\n /**\n * Check if component props are well configured on init\n */\n componentDidLoad(): void {\n // Get popover content\n this.mgPopover = this.element.querySelector(`#${this.identifier}`);\n\n //Get interactive element (first element without slot attribute)\n this.interactiveElement = this.element.querySelector(':not([slot])');\n // Add aria attributes\n this.interactiveElement.setAttribute('aria-controls', this.identifier);\n this.interactiveElement.setAttribute('aria-expanded', `${this.display}`);\n const fallbackPlacements = [];\n if (this.element.dataset.fallbackPlacement !== undefined) {\n fallbackPlacements.push(this.element.dataset.fallbackPlacement);\n }\n\n // Create popperjs popover\n this.popper = createPopper(this.interactiveElement, this.mgPopover, {\n placement: this.placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 0],\n },\n },\n {\n name: 'flip',\n options: {\n fallbackPlacements: [...fallbackPlacements, 'auto'],\n },\n },\n ],\n });\n\n // add resize observer\n [this.interactiveElement, this.element.querySelector('mg-popover-content')].forEach(element => {\n new ResizeObserver(() => {\n this.popper.update();\n }).observe(element);\n });\n\n // Add events to toggle display\n this.interactiveElement.addEventListener('click', () => {\n if (!this.disabled) this.display = !this.display;\n });\n\n this.element.addEventListener('click', (event: MouseEvent & { target: HTMLElement }): void => {\n const target = event.target.closest('[popovertargetaction]');\n if (this.display === true && target !== null && target.getAttribute('popovertargetaction') === 'hide') {\n this.display = false;\n }\n });\n\n // Add events to hide popover\n this.element.addEventListener('keydown', e => {\n if (!this.disabled && e.code === 'Escape') {\n this.display = false;\n this.componentClose.emit();\n this.interactiveElement.focus();\n }\n });\n\n this.handleDisplay(this.display);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { q as qe, Y as Yt, Q as Qt } from './index.es.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* List of all possibles roles
|
|
@@ -35,26 +35,26 @@ const MgProgress$1 = /*@__PURE__*/ proxyCustomElement(class MgProgress extends H
|
|
|
35
35
|
this.max = 100;
|
|
36
36
|
}
|
|
37
37
|
watchLabel(newValue) {
|
|
38
|
-
if (!
|
|
39
|
-
throw new Error(`<mg-progress> prop "label" must be a valid string. Passed value: ${
|
|
38
|
+
if (!qe(newValue)) {
|
|
39
|
+
throw new Error(`<mg-progress> prop "label" must be a valid string. Passed value: ${Yt(newValue)}.`);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
watchAriaRole(newValue) {
|
|
43
43
|
if (newValue && !roles.includes(newValue)) {
|
|
44
|
-
throw new Error(`<mg-progress> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${
|
|
44
|
+
throw new Error(`<mg-progress> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${Yt(newValue)}.`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
watchValue(newValue) {
|
|
48
|
-
if (newValue !== undefined && (!
|
|
49
|
-
throw new Error(`<mg-progress> prop “value” must be a number within the range ${this.min} to ${this.max}. Passed value: ${
|
|
48
|
+
if (newValue !== undefined && (!Qt(newValue) || !(newValue >= this.min && newValue <= this.max)))
|
|
49
|
+
throw new Error(`<mg-progress> prop “value” must be a number within the range ${this.min} to ${this.max}. Passed value: ${Yt(newValue)}.`);
|
|
50
50
|
}
|
|
51
51
|
watchMin(newValue) {
|
|
52
|
-
if (newValue !== 0 && newValue !== undefined && (!
|
|
53
|
-
throw new Error(`<mg-progress> prop “min” must be a number lower than: ${this.max}. Passed value: ${
|
|
52
|
+
if (newValue !== 0 && newValue !== undefined && (!Qt(newValue) || newValue >= this.max))
|
|
53
|
+
throw new Error(`<mg-progress> prop “min” must be a number lower than: ${this.max}. Passed value: ${Yt(newValue)}.`);
|
|
54
54
|
}
|
|
55
55
|
watchMax(newValue) {
|
|
56
|
-
if (newValue !== 100 && newValue !== undefined && (!
|
|
57
|
-
throw new Error(`<mg-progress> prop “max” must be a number greater than: ${this.min}. Passed value: ${
|
|
56
|
+
if (newValue !== 100 && newValue !== undefined && (!Qt(newValue) || newValue <= this.min))
|
|
57
|
+
throw new Error(`<mg-progress> prop “max” must be a number greater than: ${this.min}. Passed value: ${Yt(newValue)}.`);
|
|
58
58
|
}
|
|
59
59
|
/*************
|
|
60
60
|
* Lifecycle *
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { i as initLocales } from './index2.js';
|
|
3
|
-
import {
|
|
3
|
+
import { q as qe } from './index.es.js';
|
|
4
4
|
|
|
5
5
|
const mgSkipLinksCss = ".mg-c-skip-links{position:absolute;display:flex;min-height:var(--mg-b-size-56);align-items:center;background:var(--mg-b-color-light);opacity:0;transform:translateY(-100%)}.mg-c-skip-links:focus-within{position:relative;opacity:1;transform:translateY(0)}.mg-c-skip-links__list{display:flex;flex-wrap:wrap;align-items:center;padding:0 var(--mg-b-size-16);margin:0;gap:var(--mg-b-spacing-actions);list-style:none}.mg-c-skip-links__link{display:inline-block;padding:var(--mg-b-size-8) var(--mg-b-size-16);color:var(--mg-b-color-dark)}.mg-c-skip-links__link:hover{background:hsl(var(--mg-b-color-dark-h), var(--mg-b-color-dark-s), var(--mg-b-color-dark-l), 10%)}";
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@ const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class MgSkipLinks extends
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
validateLinks(links) {
|
|
26
|
-
if (links === undefined || links.length === 0 || links.some(link => !
|
|
26
|
+
if (links === undefined || links.length === 0 || links.some(link => !qe(link.href) || !link.href.startsWith('#') || !qe(link.label))) {
|
|
27
27
|
throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { a as qt, Y as Yt, q as qe, D as Dt } from './index.es.js';
|
|
3
3
|
import { i as initLocales } from './index2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
5
5
|
|
|
@@ -83,11 +83,11 @@ const MgTable$1 = /*@__PURE__*/ proxyCustomElement(class MgTable extends HTMLEle
|
|
|
83
83
|
/**
|
|
84
84
|
* Class collection
|
|
85
85
|
*/
|
|
86
|
-
this.classCollection = new
|
|
86
|
+
this.classCollection = new qt([this.componentClass]);
|
|
87
87
|
}
|
|
88
88
|
watchSize(newValue, oldValue) {
|
|
89
89
|
if (!sizes.includes(newValue)) {
|
|
90
|
-
throw new Error(`<mg-table> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${
|
|
90
|
+
throw new Error(`<mg-table> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Yt(newValue)}.`);
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
93
|
if (oldValue !== undefined) {
|
|
@@ -106,7 +106,7 @@ const MgTable$1 = /*@__PURE__*/ proxyCustomElement(class MgTable extends HTMLEle
|
|
|
106
106
|
}
|
|
107
107
|
watchColumns(newValue) {
|
|
108
108
|
if (newValue !== undefined && !isValidColumnsObject(newValue)) {
|
|
109
|
-
throw new Error(`<mg-table> prop "columns" must be a ColumnsType object. Passed value: ${
|
|
109
|
+
throw new Error(`<mg-table> prop "columns" must be a ColumnsType object. Passed value: ${Yt(newValue)}.`);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
@@ -235,8 +235,8 @@ const MgTable$1 = /*@__PURE__*/ proxyCustomElement(class MgTable extends HTMLEle
|
|
|
235
235
|
// Ensure caption is not visible (otherwhise the table does not have rounded corners)
|
|
236
236
|
captionTable.className = 'mg-u-visually-hidden';
|
|
237
237
|
// Link caption to div
|
|
238
|
-
if (!
|
|
239
|
-
captionTable.setAttribute('id',
|
|
238
|
+
if (!qe(captionTable.id)) {
|
|
239
|
+
captionTable.setAttribute('id', Dt(`${this.componentClass}-caption`));
|
|
240
240
|
}
|
|
241
241
|
divWrapper.setAttribute('aria-labelledby', captionTable.id);
|
|
242
242
|
// Add sortable caption if neeeded
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { D as Dt, a as qt, e as er, B as Bt, Y as Yt, q as qe, G as Gt } from './index.es.js';
|
|
3
3
|
import { K as Keys } from './events.utils.js';
|
|
4
4
|
import { d as defineCustomElement$3 } from './mg-badge2.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
@@ -43,7 +43,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
|
|
|
43
43
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
44
44
|
* If not set, it will be created.
|
|
45
45
|
*/
|
|
46
|
-
this.identifier =
|
|
46
|
+
this.identifier = Dt('mg-tabs');
|
|
47
47
|
/**
|
|
48
48
|
* Define tabs size
|
|
49
49
|
*/
|
|
@@ -55,7 +55,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
|
|
|
55
55
|
/**
|
|
56
56
|
* Component classes
|
|
57
57
|
*/
|
|
58
|
-
this.classCollection = new
|
|
58
|
+
this.classCollection = new qt(['mg-c-tabs']);
|
|
59
59
|
/**
|
|
60
60
|
* Validate that new tab status can be `Status.ACTIVE`
|
|
61
61
|
* @param tab - tab item
|
|
@@ -153,7 +153,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
|
|
|
153
153
|
*/
|
|
154
154
|
this.resetFocus = () => {
|
|
155
155
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
156
|
-
|
|
156
|
+
er(() => {
|
|
157
157
|
this.tabFocus = undefined;
|
|
158
158
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
159
159
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -170,30 +170,30 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
watchIdentifier(newValue) {
|
|
173
|
-
if (!
|
|
174
|
-
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${
|
|
173
|
+
if (!Bt(newValue)) {
|
|
174
|
+
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${Yt(newValue)}.`);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
validateLabel(newValue) {
|
|
178
|
-
if (!
|
|
179
|
-
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${
|
|
178
|
+
if (!qe(newValue)) {
|
|
179
|
+
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${Yt(newValue)}.`);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
validateSize(newValue) {
|
|
183
183
|
if (!sizes.includes(newValue)) {
|
|
184
|
-
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${
|
|
184
|
+
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Yt(newValue)}.`);
|
|
185
185
|
}
|
|
186
186
|
this.classCollection.add(`mg-c-tabs--size-${this.size}`);
|
|
187
187
|
}
|
|
188
188
|
validateItems(newValue) {
|
|
189
189
|
// String array
|
|
190
|
-
if (
|
|
190
|
+
if (Gt(newValue))
|
|
191
191
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
192
192
|
// Object array
|
|
193
193
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
194
194
|
this.tabs = newValue;
|
|
195
195
|
else
|
|
196
|
-
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${
|
|
196
|
+
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${Yt(newValue)}.`);
|
|
197
197
|
}
|
|
198
198
|
validateActiveTab(newValue) {
|
|
199
199
|
// when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
|
|
@@ -218,7 +218,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
|
|
|
218
218
|
this.activeTabChange.emit(newValue);
|
|
219
219
|
}
|
|
220
220
|
else {
|
|
221
|
-
throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${
|
|
221
|
+
throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${Yt(newValue)}.`);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
/*************
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { a as qt, Y as Yt, q as qe } from './index.es.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* List of all possibles variants
|
|
@@ -34,11 +34,11 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement
|
|
|
34
34
|
/**
|
|
35
35
|
* Component classes
|
|
36
36
|
*/
|
|
37
|
-
this.classCollection = new
|
|
37
|
+
this.classCollection = new qt(['mg-c-tag']);
|
|
38
38
|
}
|
|
39
39
|
validateVariant(newValue, oldValue) {
|
|
40
40
|
if (!variants.includes(newValue)) {
|
|
41
|
-
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${
|
|
41
|
+
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${Yt(newValue)}.`);
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
if (oldValue !== undefined) {
|
|
@@ -71,7 +71,7 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement
|
|
|
71
71
|
* @param textContent - html element textContent property
|
|
72
72
|
*/
|
|
73
73
|
validateTextContent(textContent) {
|
|
74
|
-
if (!
|
|
74
|
+
if (!qe(textContent))
|
|
75
75
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
76
76
|
}
|
|
77
77
|
/*************
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const mgTooltipContentCss = ":host{z-index:1000;
|
|
3
|
+
const mgTooltipContentCss = ":host{z-index:1000;display:none;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-popper-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}";
|
|
4
4
|
|
|
5
5
|
const MgTooltipContent = /*@__PURE__*/ proxyCustomElement(class MgTooltipContent extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"mg-tooltip-content2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"file":"mg-tooltip-content2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,2mCAA2mC;;MCU1nC,gBAAgB,iBAAAA,kBAAA,CAAA,MAAA,gBAAA,SAAA,WAAA,CAAA;;;;;;AAM3B;;AAEe;AAEf;;;AAGG;IACH,MAAM,GAAA;QACJ,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,SAAS,EAAA,EAClB,CAAM,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAC,6BAA6B,EAAQ,CAAA,EAC1E,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,OAAO,EAAQ,CAAA,CACrB;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["../styles/dist/components/mg-tooltip-content.css?tag=mg-tooltip-content&encapsulation=shadow","src/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.tsx"],"sourcesContent":[":host{z-index:1000;display:none;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-popper-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}/*# sourceMappingURL=mg-tooltip-content.css.map */\n","import { Component, h, Host, Prop } from '@stencil/core';\n\n/**\n * @internal\n */\n@Component({\n tag: 'mg-tooltip-content',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-tooltip-content.css',\n shadow: true,\n})\nexport class MgTooltipContent {\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"tooltip\">\n <span innerHTML={this.message} class=\"mg-tooltip-content__message\"></span>\n <slot name=\"arrow\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|