@mgdis/mg-components 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-64cee0c8.js → index-94497267.js} +220 -202
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-badge_23.cjs.entry.js +21 -9
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-modal.cjs.entry.js +9 -3
- package/dist/cjs/mg-popover.cjs.entry.js +3 -3
- package/dist/cjs/{popper-71bf3058.js → popper-11d5f714.js} +60 -49
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +3 -1
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +3 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +3 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +3 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +3 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +3 -5
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +3 -1
- package/dist/components/MgInput.js +3 -1
- package/dist/components/mg-badge2.js +3 -1
- package/dist/components/mg-input-numeric.js +1 -1
- package/dist/components/mg-input-title2.js +3 -1
- package/dist/components/mg-modal.js +8 -2
- package/dist/components/mg-panel.js +3 -1
- package/dist/components/mg-popover.js +1 -1
- package/dist/components/mg-tabs.js +3 -1
- package/dist/components/mg-tooltip2.js +3 -1
- package/dist/components/popper.js +60 -49
- package/dist/esm/{index-120f47fd.js → index-aad0184c.js} +220 -202
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mg-badge_23.entry.js +21 -9
- package/dist/esm/mg-components.js +2 -2
- package/dist/esm/mg-modal.entry.js +9 -3
- package/dist/esm/mg-popover.entry.js +3 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{popper-93ecb064.js → popper-f860750c.js} +60 -49
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-25452f60.entry.js +1 -0
- package/dist/mg-components/p-3899d5d2.js +2 -0
- package/dist/mg-components/p-a20fc541.entry.js +1 -0
- package/dist/mg-components/{p-b380a0df.entry.js → p-e08bc19a.entry.js} +1 -1
- package/dist/mg-components/p-ec26fc38.js +1 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +15 -4
- package/package.json +2 -2
- package/dist/mg-components/p-21991be8.entry.js +0 -1
- package/dist/mg-components/p-36a64f8c.entry.js +0 -1
- package/dist/mg-components/p-4c66f794.js +0 -1
- package/dist/mg-components/p-7bc32a2f.js +0 -2
|
@@ -160,38 +160,57 @@ var max = Math.max;
|
|
|
160
160
|
var min = Math.min;
|
|
161
161
|
var round = Math.round;
|
|
162
162
|
|
|
163
|
-
function
|
|
163
|
+
function getUAString() {
|
|
164
|
+
var uaData = navigator.userAgentData;
|
|
165
|
+
|
|
166
|
+
if (uaData != null && uaData.brands) {
|
|
167
|
+
return uaData.brands.map(function (item) {
|
|
168
|
+
return item.brand + "/" + item.version;
|
|
169
|
+
}).join(' ');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return navigator.userAgent;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function isLayoutViewport() {
|
|
176
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
164
180
|
if (includeScale === void 0) {
|
|
165
181
|
includeScale = false;
|
|
166
182
|
}
|
|
167
183
|
|
|
168
|
-
|
|
184
|
+
if (isFixedStrategy === void 0) {
|
|
185
|
+
isFixedStrategy = false;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
var clientRect = element.getBoundingClientRect();
|
|
169
189
|
var scaleX = 1;
|
|
170
190
|
var scaleY = 1;
|
|
171
191
|
|
|
172
|
-
if (isHTMLElement(element)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// Fallback to 1 in case both values are `0`
|
|
176
|
-
|
|
177
|
-
if (offsetWidth > 0) {
|
|
178
|
-
scaleX = round(rect.width) / offsetWidth || 1;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (offsetHeight > 0) {
|
|
182
|
-
scaleY = round(rect.height) / offsetHeight || 1;
|
|
183
|
-
}
|
|
192
|
+
if (includeScale && isHTMLElement(element)) {
|
|
193
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
194
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
184
195
|
}
|
|
185
196
|
|
|
197
|
+
var _ref = isElement(element) ? getWindow(element) : window,
|
|
198
|
+
visualViewport = _ref.visualViewport;
|
|
199
|
+
|
|
200
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
201
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
202
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
203
|
+
var width = clientRect.width / scaleX;
|
|
204
|
+
var height = clientRect.height / scaleY;
|
|
186
205
|
return {
|
|
187
|
-
width:
|
|
188
|
-
height:
|
|
189
|
-
top:
|
|
190
|
-
right:
|
|
191
|
-
bottom:
|
|
192
|
-
left:
|
|
193
|
-
x:
|
|
194
|
-
y:
|
|
206
|
+
width: width,
|
|
207
|
+
height: height,
|
|
208
|
+
top: y,
|
|
209
|
+
right: x + width,
|
|
210
|
+
bottom: y + height,
|
|
211
|
+
left: x,
|
|
212
|
+
x: x,
|
|
213
|
+
y: y
|
|
195
214
|
};
|
|
196
215
|
}
|
|
197
216
|
|
|
@@ -286,8 +305,8 @@ function getTrueOffsetParent(element) {
|
|
|
286
305
|
|
|
287
306
|
|
|
288
307
|
function getContainingBlock(element) {
|
|
289
|
-
var isFirefox =
|
|
290
|
-
var isIE =
|
|
308
|
+
var isFirefox = /firefox/i.test(getUAString());
|
|
309
|
+
var isIE = /Trident/i.test(getUAString());
|
|
291
310
|
|
|
292
311
|
if (isIE && isHTMLElement(element)) {
|
|
293
312
|
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
|
@@ -708,31 +727,21 @@ function getWindowScrollBarX(element) {
|
|
|
708
727
|
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
709
728
|
}
|
|
710
729
|
|
|
711
|
-
function getViewportRect(element) {
|
|
730
|
+
function getViewportRect(element, strategy) {
|
|
712
731
|
var win = getWindow(element);
|
|
713
732
|
var html = getDocumentElement(element);
|
|
714
733
|
var visualViewport = win.visualViewport;
|
|
715
734
|
var width = html.clientWidth;
|
|
716
735
|
var height = html.clientHeight;
|
|
717
736
|
var x = 0;
|
|
718
|
-
var y = 0;
|
|
719
|
-
// can be obscured underneath it.
|
|
720
|
-
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
|
721
|
-
// if it isn't open, so if this isn't available, the popper will be detected
|
|
722
|
-
// to overflow the bottom of the screen too early.
|
|
737
|
+
var y = 0;
|
|
723
738
|
|
|
724
739
|
if (visualViewport) {
|
|
725
740
|
width = visualViewport.width;
|
|
726
|
-
height = visualViewport.height;
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
// Feature detection fails in mobile emulation mode in Chrome.
|
|
731
|
-
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
|
|
732
|
-
// 0.001
|
|
733
|
-
// Fallback here: "Not Safari" userAgent
|
|
734
|
-
|
|
735
|
-
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
|
741
|
+
height = visualViewport.height;
|
|
742
|
+
var layoutViewport = isLayoutViewport();
|
|
743
|
+
|
|
744
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
736
745
|
x = visualViewport.offsetLeft;
|
|
737
746
|
y = visualViewport.offsetTop;
|
|
738
747
|
}
|
|
@@ -826,8 +835,8 @@ function rectToClientRect(rect) {
|
|
|
826
835
|
});
|
|
827
836
|
}
|
|
828
837
|
|
|
829
|
-
function getInnerBoundingClientRect(element) {
|
|
830
|
-
var rect = getBoundingClientRect(element);
|
|
838
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
839
|
+
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
|
831
840
|
rect.top = rect.top + element.clientTop;
|
|
832
841
|
rect.left = rect.left + element.clientLeft;
|
|
833
842
|
rect.bottom = rect.top + element.clientHeight;
|
|
@@ -839,8 +848,8 @@ function getInnerBoundingClientRect(element) {
|
|
|
839
848
|
return rect;
|
|
840
849
|
}
|
|
841
850
|
|
|
842
|
-
function getClientRectFromMixedType(element, clippingParent) {
|
|
843
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
851
|
+
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
|
852
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
844
853
|
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
845
854
|
// clipping (or hiding) overflowing elements with a position different from
|
|
846
855
|
// `initial`
|
|
@@ -863,18 +872,18 @@ function getClippingParents(element) {
|
|
|
863
872
|
// clipping parents
|
|
864
873
|
|
|
865
874
|
|
|
866
|
-
function getClippingRect(element, boundary, rootBoundary) {
|
|
875
|
+
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
|
867
876
|
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
868
877
|
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
|
869
878
|
var firstClippingParent = clippingParents[0];
|
|
870
879
|
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
|
871
|
-
var rect = getClientRectFromMixedType(element, clippingParent);
|
|
880
|
+
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
|
872
881
|
accRect.top = max(rect.top, accRect.top);
|
|
873
882
|
accRect.right = min(rect.right, accRect.right);
|
|
874
883
|
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
875
884
|
accRect.left = max(rect.left, accRect.left);
|
|
876
885
|
return accRect;
|
|
877
|
-
}, getClientRectFromMixedType(element, firstClippingParent));
|
|
886
|
+
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
|
878
887
|
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
879
888
|
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
880
889
|
clippingRect.x = clippingRect.left;
|
|
@@ -955,6 +964,8 @@ function detectOverflow(state, options) {
|
|
|
955
964
|
var _options = options,
|
|
956
965
|
_options$placement = _options.placement,
|
|
957
966
|
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
|
967
|
+
_options$strategy = _options.strategy,
|
|
968
|
+
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
|
958
969
|
_options$boundary = _options.boundary,
|
|
959
970
|
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
|
960
971
|
_options$rootBoundary = _options.rootBoundary,
|
|
@@ -969,7 +980,7 @@ function detectOverflow(state, options) {
|
|
|
969
980
|
var altContext = elementContext === popper ? reference : popper;
|
|
970
981
|
var popperRect = state.rects.popper;
|
|
971
982
|
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
972
|
-
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
|
983
|
+
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
|
973
984
|
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
974
985
|
var popperOffsets = computeOffsets({
|
|
975
986
|
reference: referenceClientRect,
|
|
@@ -1483,7 +1494,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
1483
1494
|
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1484
1495
|
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
1485
1496
|
var documentElement = getDocumentElement(offsetParent);
|
|
1486
|
-
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
|
1497
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
1487
1498
|
var scroll = {
|
|
1488
1499
|
scrollLeft: 0,
|
|
1489
1500
|
scrollTop: 0
|
|
@@ -24,7 +24,9 @@ export class MgBadge {
|
|
|
24
24
|
}
|
|
25
25
|
validateLabel(newValue) {
|
|
26
26
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
27
|
-
throw new Error
|
|
27
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
28
|
+
// throw new Error('<mg-badge> prop "label" is required.');
|
|
29
|
+
console.error('<mg-badge> prop "label" is required.');
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
validateVariant(newValue, oldValue) {
|
|
@@ -15,7 +15,9 @@ export class MgInputTitle {
|
|
|
15
15
|
}
|
|
16
16
|
validateIdentifier(newValue) {
|
|
17
17
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
18
|
-
throw new Error
|
|
18
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
19
|
+
// throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
20
|
+
console.error('<mg-input-title> prop "identifier" is required.');
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
/*************
|
|
@@ -90,7 +90,9 @@ export class MgTooltip {
|
|
|
90
90
|
}
|
|
91
91
|
validateMessage(newValue) {
|
|
92
92
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
93
|
-
throw new Error
|
|
93
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
94
|
+
// throw new Error('<mg-tooltip> prop "message" is required.');
|
|
95
|
+
console.error('<mg-tooltip> prop "message" is required.');
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
handleDisplay(newValue) {
|
|
@@ -50,7 +50,9 @@ export const MgInput = (props, children, utils) => {
|
|
|
50
50
|
* Check required properties
|
|
51
51
|
*/
|
|
52
52
|
if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
|
|
53
|
-
throw new Error
|
|
53
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
54
|
+
// throw new Error('<mg-input> prop "identifier" is required.');
|
|
55
|
+
console.error('<mg-input> prop "identifier" is required.');
|
|
54
56
|
}
|
|
55
57
|
if (typeof props.label !== 'string' || props.label.trim() === '') {
|
|
56
58
|
throw new Error('<mg-input> prop "label" is required.');
|
|
@@ -180,7 +180,7 @@ export class MgInputNumeric {
|
|
|
180
180
|
// Split number and decimal
|
|
181
181
|
const [integer, decimal = ''] = newValue.replace('-', '').split(/[\.,]/);
|
|
182
182
|
// Regex
|
|
183
|
-
const regex = this.type === 'integer' ?
|
|
183
|
+
const regex = this.type === 'integer' ? /^-?\d+$/ : /^-?\d+[.,]?\d*$/;
|
|
184
184
|
// Filter input
|
|
185
185
|
if (newValue === '' || (newValue.match(regex) && integer.length <= this.integerLength && decimal.length <= (this.type === 'integer' ? 0 : this.decimalLength))) {
|
|
186
186
|
this.storedValue = newValue;
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
margin-top: calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);
|
|
42
42
|
margin-right: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1);
|
|
43
43
|
}
|
|
44
|
-
.mg-
|
|
44
|
+
.mg-modal__content {
|
|
45
45
|
overflow-y: auto;
|
|
46
46
|
}
|
|
47
|
-
.mg-
|
|
47
|
+
.mg-modal__content::slotted(*) {
|
|
48
48
|
font-size: var(--mg-modal-content-font-size);
|
|
49
49
|
}
|
|
50
50
|
.mg-modal.mg-modal--hide {
|
|
@@ -50,17 +50,21 @@ export class MgModal {
|
|
|
50
50
|
}
|
|
51
51
|
validateModalTitle(newValue) {
|
|
52
52
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
53
|
-
throw new Error
|
|
53
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
54
|
+
// throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
55
|
+
console.error('<mg-modal> prop "modalTitle" is required.');
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
validateHide(newValue) {
|
|
57
59
|
if (newValue) {
|
|
58
60
|
this.componentHide.emit();
|
|
59
61
|
this.classList.add(this.classHide);
|
|
62
|
+
document.body.style.overflow = this.bodyOverflow;
|
|
60
63
|
}
|
|
61
64
|
else {
|
|
62
65
|
this.componentShow.emit();
|
|
63
66
|
this.classList.delete(this.classHide);
|
|
67
|
+
document.body.style.overflow = 'hidden';
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
@@ -84,6 +88,8 @@ export class MgModal {
|
|
|
84
88
|
* @returns {void}
|
|
85
89
|
*/
|
|
86
90
|
componentWillLoad() {
|
|
91
|
+
// Store body overflow
|
|
92
|
+
this.bodyOverflow = document.body.style.overflow;
|
|
87
93
|
// Get locales
|
|
88
94
|
this.messages = initLocales(this.element).messages;
|
|
89
95
|
// Validate
|
|
@@ -111,7 +111,9 @@ export class MgPanel {
|
|
|
111
111
|
}
|
|
112
112
|
validatePanelTitle(newValue) {
|
|
113
113
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
114
|
-
throw new Error
|
|
114
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
115
|
+
// throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
116
|
+
console.error('<mg-panel> prop "panelTitle" is required.');
|
|
115
117
|
}
|
|
116
118
|
this.titleChange.emit(newValue);
|
|
117
119
|
}
|
|
@@ -23,18 +23,17 @@ mg-popover::slotted(*) {
|
|
|
23
23
|
margin-top: calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);
|
|
24
24
|
margin-left: 3rem;
|
|
25
25
|
}
|
|
26
|
-
.mg-
|
|
27
|
-
.mg-popover .mg-popover__arrow::before {
|
|
26
|
+
.mg-popover__arrow, .mg-popover__arrow::before {
|
|
28
27
|
position: absolute;
|
|
29
28
|
width: 2rem;
|
|
30
29
|
height: 2rem;
|
|
31
30
|
z-index: -1;
|
|
32
31
|
background: inherit;
|
|
33
32
|
}
|
|
34
|
-
.mg-
|
|
33
|
+
.mg-popover__arrow {
|
|
35
34
|
visibility: hidden;
|
|
36
35
|
}
|
|
37
|
-
.mg-
|
|
36
|
+
.mg-popover__arrow::before {
|
|
38
37
|
visibility: visible;
|
|
39
38
|
content: "";
|
|
40
39
|
transform: rotate(45deg);
|
|
@@ -51,7 +50,6 @@ mg-popover::slotted(*) {
|
|
|
51
50
|
.mg-popover[data-popper-placement^=right] > .mg-popover__arrow {
|
|
52
51
|
left: -6px;
|
|
53
52
|
}
|
|
54
|
-
|
|
55
53
|
.mg-popover__title ::slotted([slot=title]) {
|
|
56
54
|
margin: 0 0 1rem;
|
|
57
55
|
font-size: var(--mg-popover-title-font-size);
|
|
@@ -131,7 +131,9 @@ export class MgTabs {
|
|
|
131
131
|
}
|
|
132
132
|
validateLabel(newValue) {
|
|
133
133
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
134
|
-
throw new Error
|
|
134
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
135
|
+
// throw new Error('<mg-tabs> prop "label" is required.');
|
|
136
|
+
console.error('<mg-tabs> prop "label" is required.');
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
validateSize(newValue) {
|
|
@@ -51,7 +51,9 @@ const MgInput = (props, children, utils) => {
|
|
|
51
51
|
* Check required properties
|
|
52
52
|
*/
|
|
53
53
|
if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
|
|
54
|
-
throw new Error
|
|
54
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
55
|
+
// throw new Error('<mg-input> prop "identifier" is required.');
|
|
56
|
+
console.error('<mg-input> prop "identifier" is required.');
|
|
55
57
|
}
|
|
56
58
|
if (typeof props.label !== 'string' || props.label.trim() === '') {
|
|
57
59
|
throw new Error('<mg-input> prop "label" is required.');
|
|
@@ -34,7 +34,9 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
34
34
|
}
|
|
35
35
|
validateLabel(newValue) {
|
|
36
36
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
37
|
-
throw new Error
|
|
37
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
38
|
+
// throw new Error('<mg-badge> prop "label" is required.');
|
|
39
|
+
console.error('<mg-badge> prop "label" is required.');
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
validateVariant(newValue, oldValue) {
|
|
@@ -202,7 +202,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
202
202
|
// Split number and decimal
|
|
203
203
|
const [integer, decimal = ''] = newValue.replace('-', '').split(/[\.,]/);
|
|
204
204
|
// Regex
|
|
205
|
-
const regex = this.type === 'integer' ?
|
|
205
|
+
const regex = this.type === 'integer' ? /^-?\d+$/ : /^-?\d+[.,]?\d*$/;
|
|
206
206
|
// Filter input
|
|
207
207
|
if (newValue === '' || (newValue.match(regex) && integer.length <= this.integerLength && decimal.length <= (this.type === 'integer' ? 0 : this.decimalLength))) {
|
|
208
208
|
this.storedValue = newValue;
|
|
@@ -20,7 +20,9 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
20
20
|
}
|
|
21
21
|
validateIdentifier(newValue) {
|
|
22
22
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
23
|
-
throw new Error
|
|
23
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
24
|
+
// throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
25
|
+
console.error('<mg-input-title> prop "identifier" is required.');
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
/*************
|
|
@@ -4,7 +4,7 @@ import { i as initLocales } from './index2.js';
|
|
|
4
4
|
import { d as defineCustomElement$3 } from './mg-button2.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
6
6
|
|
|
7
|
-
const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-
|
|
7
|
+
const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
|
|
8
8
|
|
|
9
9
|
const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
10
|
constructor() {
|
|
@@ -60,17 +60,21 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
60
60
|
}
|
|
61
61
|
validateModalTitle(newValue) {
|
|
62
62
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
63
|
-
throw new Error
|
|
63
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
64
|
+
// throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
65
|
+
console.error('<mg-modal> prop "modalTitle" is required.');
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
validateHide(newValue) {
|
|
67
69
|
if (newValue) {
|
|
68
70
|
this.componentHide.emit();
|
|
69
71
|
this.classList.add(this.classHide);
|
|
72
|
+
document.body.style.overflow = this.bodyOverflow;
|
|
70
73
|
}
|
|
71
74
|
else {
|
|
72
75
|
this.componentShow.emit();
|
|
73
76
|
this.classList.delete(this.classHide);
|
|
77
|
+
document.body.style.overflow = 'hidden';
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
@@ -94,6 +98,8 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
94
98
|
* @returns {void}
|
|
95
99
|
*/
|
|
96
100
|
componentWillLoad() {
|
|
101
|
+
// Store body overflow
|
|
102
|
+
this.bodyOverflow = document.body.style.overflow;
|
|
97
103
|
// Get locales
|
|
98
104
|
this.messages = initLocales(this.element).messages;
|
|
99
105
|
// Validate
|
|
@@ -125,7 +125,9 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
125
125
|
}
|
|
126
126
|
validatePanelTitle(newValue) {
|
|
127
127
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
128
|
-
throw new Error
|
|
128
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
129
|
+
// throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
130
|
+
console.error('<mg-panel> prop "panelTitle" is required.');
|
|
129
131
|
}
|
|
130
132
|
this.titleChange.emit(newValue);
|
|
131
133
|
}
|
|
@@ -5,7 +5,7 @@ import { d as defineCustomElement$3 } from './mg-button2.js';
|
|
|
5
5
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
6
6
|
import { c as createPopper } from './popper.js';
|
|
7
7
|
|
|
8
|
-
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show].sc-mg-popover{display:block}.mg-popover.sc-mg-popover mg-button.sc-mg-popover{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-
|
|
8
|
+
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show].sc-mg-popover{display:block}.mg-popover.sc-mg-popover mg-button.sc-mg-popover{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover__arrow.sc-mg-popover,.mg-popover__arrow.sc-mg-popover::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover__arrow.sc-mg-popover{visibility:hidden}.mg-popover__arrow.sc-mg-popover::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{bottom:-6px}.mg-popover[data-popper-placement^=bottom].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{top:-6px}.mg-popover[data-popper-placement^=left].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{right:-6px}.mg-popover[data-popper-placement^=right].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{left:-6px}.mg-popover__title.sc-mg-popover-s>[slot=title],.mg-popover__title .sc-mg-popover-s>[slot=title]{margin:0 0 1rem;font-size:var(--mg-popover-title-font-size);font-weight:600}";
|
|
9
9
|
|
|
10
10
|
const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
@@ -151,7 +151,9 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
151
151
|
}
|
|
152
152
|
validateLabel(newValue) {
|
|
153
153
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
154
|
-
throw new Error
|
|
154
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
155
|
+
// throw new Error('<mg-tabs> prop "label" is required.');
|
|
156
|
+
console.error('<mg-tabs> prop "label" is required.');
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
validateSize(newValue) {
|
|
@@ -104,7 +104,9 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
104
104
|
}
|
|
105
105
|
validateMessage(newValue) {
|
|
106
106
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
107
|
-
throw new Error
|
|
107
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
108
|
+
// throw new Error('<mg-tooltip> prop "message" is required.');
|
|
109
|
+
console.error('<mg-tooltip> prop "message" is required.');
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
handleDisplay(newValue) {
|