@mgdis/mg-components 4.1.0 → 4.2.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-88560a66.js → index-64cee0c8.js} +248 -81
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{mg-badge_24.cjs.entry.js → mg-badge_23.cjs.entry.js} +206 -2180
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-modal.cjs.entry.js +8 -1
- package/dist/cjs/mg-popover.cjs.entry.js +171 -0
- package/dist/cjs/popper-71bf3058.js +1790 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +116 -99
- package/dist/collection/components/atoms/mg-button/mg-button.js +221 -220
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +72 -69
- package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +1 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +102 -92
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +83 -67
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +64 -55
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +3 -6
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +120 -106
- package/dist/collection/components/molecules/inputs/MgInput.js +8 -17
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +323 -318
- package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +3 -2
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +356 -361
- package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +1 -2
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +462 -456
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +347 -340
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +348 -343
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +406 -401
- package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +12 -15
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +476 -473
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +461 -456
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +2 -8
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +299 -298
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +1 -3
- package/dist/collection/components/molecules/mg-details/mg-details.js +95 -93
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +13 -27
- package/dist/collection/components/molecules/mg-form/mg-form.js +175 -166
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -6
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +37 -37
- package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +1 -3
- package/dist/collection/components/molecules/mg-message/mg-message.js +154 -153
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +11 -15
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +147 -134
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +5 -6
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +112 -117
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -8
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +192 -189
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +1 -4
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +129 -127
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +1 -5
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +1 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +150 -135
- package/dist/collection/fonts/OpenSans-Bold.ttf +0 -0
- package/dist/collection/locales/en/messages.json +50 -0
- package/dist/collection/locales/fr/messages.json +50 -0
- package/dist/collection/stories/grids.stories.js +1 -44
- package/dist/collection/stories/helpers.stories.js +1 -19
- package/dist/collection/stories/icons.stories.js +1 -4
- package/dist/collection/stories/typography.stories.js +1 -12
- package/dist/collection/variables.css +3 -2
- package/dist/collection/variables.scss +3 -2
- package/dist/components/MgInput.js +6 -3
- package/dist/components/mg-badge2.js +7 -0
- package/dist/components/mg-button2.js +2 -7
- package/dist/components/mg-input-checkbox.js +1 -6
- package/dist/components/mg-input-date.js +10 -27
- package/dist/components/mg-input-numeric.js +1 -6
- package/dist/components/mg-input-password.js +1 -6
- package/dist/components/mg-input-radio.js +1 -6
- package/dist/components/mg-input-select2.js +1 -6
- package/dist/components/mg-input-text2.js +3 -8
- package/dist/components/mg-input-textarea.js +2 -7
- package/dist/components/mg-input-title2.js +9 -0
- package/dist/components/mg-input-toggle.js +2 -7
- package/dist/components/mg-modal.js +7 -0
- package/dist/components/mg-pagination.js +3 -3
- package/dist/components/mg-panel.js +8 -4
- package/dist/components/mg-tabs.js +8 -1
- package/dist/components/mg-tooltip2.js +7 -0
- package/dist/esm/{index-bca81100.js → index-120f47fd.js} +248 -81
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mg-badge_24.entry.js → mg-badge_23.entry.js} +207 -2180
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-modal.entry.js +8 -1
- package/dist/esm/mg-popover.entry.js +167 -0
- package/dist/esm/popper-93ecb064.js +1788 -0
- package/dist/mg-components/fonts/OpenSans-Bold.ttf +0 -0
- package/dist/mg-components/locales/en/messages.json +50 -0
- package/dist/mg-components/locales/fr/messages.json +50 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-21991be8.entry.js +1 -0
- package/dist/mg-components/p-36a64f8c.entry.js +1 -0
- package/dist/mg-components/p-4c66f794.js +1 -0
- package/dist/mg-components/{p-b14a3443.js → p-7bc32a2f.js} +0 -0
- package/dist/mg-components/p-b380a0df.entry.js +1 -0
- package/dist/mg-components/variables.css +3 -2
- package/dist/mg-components/variables.scss +3 -2
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -1
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +1 -10
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +0 -1
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +1 -0
- package/dist/types/components.d.ts +29 -29
- package/loader/package.json +1 -0
- package/package.json +8 -8
- package/dist/collection/fonts/Poppins-Bold.ttf +0 -0
- package/dist/mg-components/fonts/Poppins-Bold.ttf +0 -0
- package/dist/mg-components/p-a2883dc7.entry.js +0 -1
- package/dist/mg-components/p-cffe0519.entry.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement, c as createEvent, H as Host } from './index-
|
|
2
|
-
import { C as ClassList,
|
|
1
|
+
import { r as registerInstance, h, g as getElement, c as createEvent, H as Host } from './index-120f47fd.js';
|
|
2
|
+
import { C as ClassList, i as initLocales, c as createID, a as isTagName, b as allItemsAreString } from './index-7efedd97.js';
|
|
3
|
+
import { c as createPopper } from './popper-93ecb064.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* List of all possibles variants
|
|
@@ -30,6 +31,11 @@ const MgBadge = class {
|
|
|
30
31
|
throw new Error('<mg-badge> prop "value" must be interger or ponctuation character.');
|
|
31
32
|
}
|
|
32
33
|
}
|
|
34
|
+
validateLabel(newValue) {
|
|
35
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
36
|
+
throw new Error('<mg-badge> prop "label" is required.');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
33
39
|
validateVariant(newValue, oldValue) {
|
|
34
40
|
if (!variants$4.includes(newValue)) {
|
|
35
41
|
throw new Error(`<mg-badge> prop "variant" must be one of : ${variants$4.join(', ')}.`);
|
|
@@ -54,6 +60,7 @@ const MgBadge = class {
|
|
|
54
60
|
*/
|
|
55
61
|
componentWillLoad() {
|
|
56
62
|
this.validateValue(this.value);
|
|
63
|
+
this.validateLabel(this.label);
|
|
57
64
|
this.validateVariant(this.variant);
|
|
58
65
|
this.validateOutline(this.outline);
|
|
59
66
|
}
|
|
@@ -67,6 +74,7 @@ const MgBadge = class {
|
|
|
67
74
|
}
|
|
68
75
|
static get watchers() { return {
|
|
69
76
|
"value": ["validateValue"],
|
|
77
|
+
"label": ["validateLabel"],
|
|
70
78
|
"variant": ["validateVariant"],
|
|
71
79
|
"outline": ["validateOutline"]
|
|
72
80
|
}; }
|
|
@@ -91,11 +99,6 @@ const MgButton = class {
|
|
|
91
99
|
* Define button variant
|
|
92
100
|
*/
|
|
93
101
|
this.variant = variants$3[0]; // Primary
|
|
94
|
-
/**
|
|
95
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
96
|
-
* If not set, it will be created.
|
|
97
|
-
*/
|
|
98
|
-
this.identifier = createID('mg-button');
|
|
99
102
|
/**
|
|
100
103
|
* Define if button is round.
|
|
101
104
|
* Used for icon button.
|
|
@@ -170,7 +173,7 @@ const MgButton = class {
|
|
|
170
173
|
this.validateVariant(this.variant);
|
|
171
174
|
if (this.isIcon) {
|
|
172
175
|
this.classList.add(`mg-button--icon`);
|
|
173
|
-
if (typeof this.label !== 'string' || this.label === '') {
|
|
176
|
+
if (typeof this.label !== 'string' || this.label.trim() === '') {
|
|
174
177
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
175
178
|
}
|
|
176
179
|
}
|
|
@@ -788,11 +791,14 @@ const MgInput = (props, children, utils) => {
|
|
|
788
791
|
/**
|
|
789
792
|
* Check required properties
|
|
790
793
|
*/
|
|
791
|
-
if (typeof props.
|
|
792
|
-
throw new Error('<mg-input> prop "
|
|
794
|
+
if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
|
|
795
|
+
throw new Error('<mg-input> prop "identifier" is required.');
|
|
796
|
+
}
|
|
797
|
+
if (typeof props.label !== 'string' || props.label.trim() === '') {
|
|
798
|
+
throw new Error('<mg-input> prop "label" is required.');
|
|
793
799
|
}
|
|
794
800
|
if (props.labelOnTop && props.labelHide) {
|
|
795
|
-
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide"');
|
|
801
|
+
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
|
|
796
802
|
}
|
|
797
803
|
/**
|
|
798
804
|
* Component classes
|
|
@@ -883,11 +889,6 @@ const MgInputCheckbox = class {
|
|
|
883
889
|
************/
|
|
884
890
|
// HTML selector
|
|
885
891
|
this.inputs = [];
|
|
886
|
-
/**
|
|
887
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
888
|
-
* If not set, it will be created.
|
|
889
|
-
*/
|
|
890
|
-
this.identifier = createID('mg-input-checkbox');
|
|
891
892
|
/**
|
|
892
893
|
* Input name
|
|
893
894
|
* If not set the value equals the identifier
|
|
@@ -1093,11 +1094,6 @@ const MgInputDate = class {
|
|
|
1093
1094
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
1094
1095
|
// hasError (triggered by blur event)
|
|
1095
1096
|
this.hasError = false;
|
|
1096
|
-
/**
|
|
1097
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
1098
|
-
* If not set, it will be created.
|
|
1099
|
-
*/
|
|
1100
|
-
this.identifier = createID('mg-input-date');
|
|
1101
1097
|
/**
|
|
1102
1098
|
* Input name
|
|
1103
1099
|
* If not set the value equals the identifier
|
|
@@ -1214,18 +1210,17 @@ const MgInputDate = class {
|
|
|
1214
1210
|
};
|
|
1215
1211
|
}
|
|
1216
1212
|
validateValue(newValue) {
|
|
1217
|
-
if (newValue !== undefined &&
|
|
1213
|
+
if (newValue !== undefined && (typeof newValue !== 'string' || !dateRegExp.test(newValue))) {
|
|
1218
1214
|
throw new Error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
1219
1215
|
}
|
|
1220
1216
|
else {
|
|
1221
1217
|
this.valueChange.emit(this.value);
|
|
1222
1218
|
}
|
|
1223
1219
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
this.validateDateFormat(newValue);
|
|
1220
|
+
validateMinMax(newValue) {
|
|
1221
|
+
if ((newValue === null || newValue === void 0 ? void 0 : newValue.length) === 0 || ((newValue === null || newValue === void 0 ? void 0 : newValue.length) > 0 && !(typeof newValue === 'string' && dateRegExp.test(newValue)))) {
|
|
1222
|
+
throw new Error("<mg-input-date> props 'min/max' doesn't match pattern: yyyy-mm-dd");
|
|
1223
|
+
}
|
|
1229
1224
|
}
|
|
1230
1225
|
/**
|
|
1231
1226
|
* Public method to display errors
|
|
@@ -1237,17 +1232,6 @@ const MgInputDate = class {
|
|
|
1237
1232
|
this.checkError();
|
|
1238
1233
|
this.hasError = this.invalid;
|
|
1239
1234
|
}
|
|
1240
|
-
/**
|
|
1241
|
-
* Date format validation
|
|
1242
|
-
*
|
|
1243
|
-
* @param {string} date date to validate
|
|
1244
|
-
* @returns {void}
|
|
1245
|
-
*/
|
|
1246
|
-
validateDateFormat(date) {
|
|
1247
|
-
if ((date === null || date === void 0 ? void 0 : date.length) > 0 && !(typeof date === 'string' && dateRegExp.test(date))) {
|
|
1248
|
-
throw new Error("<mg-input-date> props 'min/max' doesn't match pattern: yyyy-mm-dd");
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
1235
|
/*************
|
|
1252
1236
|
* Lifecycle *
|
|
1253
1237
|
*************/
|
|
@@ -1263,8 +1247,8 @@ const MgInputDate = class {
|
|
|
1263
1247
|
this.messages = locales.messages;
|
|
1264
1248
|
// Validate
|
|
1265
1249
|
this.validateValue(this.value);
|
|
1266
|
-
this.
|
|
1267
|
-
this.
|
|
1250
|
+
this.validateMinMax(this.min);
|
|
1251
|
+
this.validateMinMax(this.max);
|
|
1268
1252
|
// Check validity when component is ready
|
|
1269
1253
|
// return a promise to process action only in the FIRST render().
|
|
1270
1254
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
@@ -1283,8 +1267,8 @@ const MgInputDate = class {
|
|
|
1283
1267
|
get element() { return getElement(this); }
|
|
1284
1268
|
static get watchers() { return {
|
|
1285
1269
|
"value": ["validateValue"],
|
|
1286
|
-
"min": ["
|
|
1287
|
-
"max": ["
|
|
1270
|
+
"min": ["validateMinMax"],
|
|
1271
|
+
"max": ["validateMinMax"]
|
|
1288
1272
|
}; }
|
|
1289
1273
|
};
|
|
1290
1274
|
MgInputDate.style = mgInputDateCss;
|
|
@@ -1310,11 +1294,6 @@ const MgInputNumeric = class {
|
|
|
1310
1294
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
1311
1295
|
// hasError (triggered by blur event)
|
|
1312
1296
|
this.hasError = false;
|
|
1313
|
-
/**
|
|
1314
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
1315
|
-
* If not set, it will be created.
|
|
1316
|
-
*/
|
|
1317
|
-
this.identifier = createID('mg-input-numeric');
|
|
1318
1297
|
/**
|
|
1319
1298
|
* Input name
|
|
1320
1299
|
* If not set the value equals the identifier
|
|
@@ -1596,11 +1575,6 @@ const MgInputPassword = class {
|
|
|
1596
1575
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
1597
1576
|
// hasError (triggered by blur event)
|
|
1598
1577
|
this.hasError = false;
|
|
1599
|
-
/**
|
|
1600
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
1601
|
-
* If not set, it will be created.
|
|
1602
|
-
*/
|
|
1603
|
-
this.identifier = createID('mg-input-password');
|
|
1604
1578
|
/**
|
|
1605
1579
|
* Input name
|
|
1606
1580
|
* If not set the value equals the identifier
|
|
@@ -1736,11 +1710,6 @@ const MgInputRadio = class {
|
|
|
1736
1710
|
************/
|
|
1737
1711
|
// HTML selector
|
|
1738
1712
|
this.inputs = [];
|
|
1739
|
-
/**
|
|
1740
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
1741
|
-
* If not set, it will be created.
|
|
1742
|
-
*/
|
|
1743
|
-
this.identifier = createID('mg-input-radio');
|
|
1744
1713
|
/**
|
|
1745
1714
|
* Input name
|
|
1746
1715
|
* If not set the value equals the identifier
|
|
@@ -1938,11 +1907,6 @@ const MgInputSelect = class {
|
|
|
1938
1907
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
1939
1908
|
// hasError (triggered by blur event)
|
|
1940
1909
|
this.hasError = false;
|
|
1941
|
-
/**
|
|
1942
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
1943
|
-
* If not set, it will be created.
|
|
1944
|
-
*/
|
|
1945
|
-
this.identifier = createID('mg-input-select');
|
|
1946
1910
|
/**
|
|
1947
1911
|
* Input name
|
|
1948
1912
|
* If not set the value equals the identifier
|
|
@@ -2103,7 +2067,7 @@ const MgInputSelect = class {
|
|
|
2103
2067
|
};
|
|
2104
2068
|
MgInputSelect.style = mgInputSelectCss;
|
|
2105
2069
|
|
|
2106
|
-
const mgInputTextCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{width:100%}.mg-input.mg-input--width-16 .mg-input__box{width:21rem}.mg-input.mg-input--width-4 .mg-input__box{width:7rem}.mg-input.mg-input--width-2 .mg-input__box{width:5rem}.mg-input mg-character-left{opacity:0.6;font-size:1.1rem}.mg-input.mg-input--has-display-character-left .mg-input__input+.mg-input__help-text,.mg-input.mg-input--has-display-character-left .mg-input__input+.mg-input__error{margin-top:0}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input--has-icon .mg-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-inputs-spacer);color:var(--mg-inputs-color);transform:translateY(-50%)}.mg-input.mg-input--has-icon .mg-input__with-character-left .mg-input__box{padding-left:calc(var(--mg-icon-regular-size) + var(--mg-inputs-spacer) * 2)}.mg-input__with-character-left{position:relative;display:inline-flex
|
|
2070
|
+
const mgInputTextCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{width:100%}.mg-input.mg-input--width-16 .mg-input__box{width:21rem}.mg-input.mg-input--width-4 .mg-input__box{width:7rem}.mg-input.mg-input--width-2 .mg-input__box{width:5rem}.mg-input mg-character-left{opacity:0.6;font-size:1.1rem}.mg-input.mg-input--has-display-character-left .mg-input__input+.mg-input__help-text,.mg-input.mg-input--has-display-character-left .mg-input__input+.mg-input__error{margin-top:0}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input--has-icon .mg-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-inputs-spacer);color:var(--mg-inputs-color);transform:translateY(-50%)}.mg-input.mg-input--has-icon .mg-input__with-character-left .mg-input__box{padding-left:calc(var(--mg-icon-regular-size) + var(--mg-inputs-spacer) * 2)}.mg-input__with-character-left{position:relative;display:inline-flex}.mg-input--width-full .mg-input__with-character-left{width:100%}.mg-input.is-focused .mg-input__with-character-left .mg-input__box{padding-right:calc(var(--mg-character-left-message-length) * 1ch + 0.8rem)}.mg-input__with-character-left mg-character-left{position:absolute;display:none;top:50%;right:1rem;opacity:0.6;transform:translateY(-50%);font-size:1.1rem}.mg-input.is-focused .mg-input__with-character-left mg-character-left{display:block}";
|
|
2107
2071
|
|
|
2108
2072
|
const MgInputText = class {
|
|
2109
2073
|
constructor(hostRef) {
|
|
@@ -2119,11 +2083,6 @@ const MgInputText = class {
|
|
|
2119
2083
|
this.classHasIcon = 'mg-input--has-icon';
|
|
2120
2084
|
// hasError (triggered by blur event)
|
|
2121
2085
|
this.hasError = false;
|
|
2122
|
-
/**
|
|
2123
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
2124
|
-
* If not set, it will be created.
|
|
2125
|
-
*/
|
|
2126
|
-
this.identifier = createID('mg-input-text');
|
|
2127
2086
|
/**
|
|
2128
2087
|
* Input name
|
|
2129
2088
|
* If not set the value equals the identifier
|
|
@@ -2321,7 +2280,7 @@ const MgInputText = class {
|
|
|
2321
2280
|
'--mg-character-left-message-length': (this.displayCharacterLeft
|
|
2322
2281
|
? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
|
|
2323
2282
|
: 0).toString(),
|
|
2324
|
-
} }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { type: this.type, class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }), this.displayCharacterLeft && this.maxlength && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), h("slot", { name: "append-input" })));
|
|
2283
|
+
} }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { type: this.type, class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }), this.displayCharacterLeft && this.maxlength > 0 && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), h("slot", { name: "append-input" })));
|
|
2325
2284
|
}
|
|
2326
2285
|
get element() { return getElement(this); }
|
|
2327
2286
|
static get watchers() { return {
|
|
@@ -2346,11 +2305,6 @@ const MgInputTextarea = class {
|
|
|
2346
2305
|
this.classHasDisplayCharacterLeft = 'mg-input--has-display-character-left';
|
|
2347
2306
|
// hasError (triggered by blur event)
|
|
2348
2307
|
this.hasError = false;
|
|
2349
|
-
/**
|
|
2350
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
2351
|
-
* If not set, it will be created.
|
|
2352
|
-
*/
|
|
2353
|
-
this.identifier = createID('mg-input-textarea');
|
|
2354
2308
|
/**
|
|
2355
2309
|
* Input name
|
|
2356
2310
|
* If not set the value equals the identifier
|
|
@@ -2525,7 +2479,7 @@ const MgInputTextarea = class {
|
|
|
2525
2479
|
'mg-input__box--resizable': this.resizable === 'both',
|
|
2526
2480
|
'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',
|
|
2527
2481
|
'mg-input__box--resizable-vertical': this.resizable === 'vertical',
|
|
2528
|
-
}, value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, rows: this.rows, maxlength: this.maxlength, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }), this.displayCharacterLeft && this.maxlength && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength })))));
|
|
2482
|
+
}, value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, rows: this.rows, maxlength: this.maxlength, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }), this.displayCharacterLeft && this.maxlength > 0 && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength })))));
|
|
2529
2483
|
}
|
|
2530
2484
|
get element() { return getElement(this); }
|
|
2531
2485
|
static get watchers() { return {
|
|
@@ -2552,6 +2506,11 @@ const MgInputTitle = class {
|
|
|
2552
2506
|
this.tagName = this.isLegend ? 'legend' : 'label';
|
|
2553
2507
|
};
|
|
2554
2508
|
}
|
|
2509
|
+
validateIdentifier(newValue) {
|
|
2510
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
2511
|
+
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2555
2514
|
/*************
|
|
2556
2515
|
* Lifecycle *
|
|
2557
2516
|
*************/
|
|
@@ -2561,6 +2520,7 @@ const MgInputTitle = class {
|
|
|
2561
2520
|
* @returns {void}
|
|
2562
2521
|
*/
|
|
2563
2522
|
componentWillLoad() {
|
|
2523
|
+
this.validateIdentifier(this.identifier);
|
|
2564
2524
|
this.getTagName();
|
|
2565
2525
|
}
|
|
2566
2526
|
/**
|
|
@@ -2573,10 +2533,13 @@ const MgInputTitle = class {
|
|
|
2573
2533
|
// \u00A0 represent a
|
|
2574
2534
|
return (h(TagName, { class: "mg-input-title", htmlFor: this.isLegend ? undefined : this.identifier }, h("slot", null), this.required && (h("span", { class: "mg-input-title__required" }, "\u00A0", h("span", { class: "is-asterisk" }, "*")))));
|
|
2575
2535
|
}
|
|
2536
|
+
static get watchers() { return {
|
|
2537
|
+
"identifier": ["validateIdentifier"]
|
|
2538
|
+
}; }
|
|
2576
2539
|
};
|
|
2577
2540
|
MgInputTitle.style = mgInputTitleCss;
|
|
2578
2541
|
|
|
2579
|
-
const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input.mg-input--toggle .mg-input__input-container{flex:auto;min-width:0}.mg-input__button-toggle{display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:flex;justify-content:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:flex}.mg-input.mg-input--toggle-disabled .mg-input__button-toggle{opacity:0.3}";
|
|
2542
|
+
const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input.mg-input--toggle .mg-input__input-container{flex:auto;min-width:0}.mg-input__button-toggle{display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-family:var(--font-family);font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:flex;justify-content:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:flex}.mg-input.mg-input--toggle-disabled .mg-input__button-toggle{opacity:0.3}";
|
|
2580
2543
|
|
|
2581
2544
|
/**
|
|
2582
2545
|
* type Option validation function
|
|
@@ -2599,11 +2562,6 @@ const MgInputToggle = class {
|
|
|
2599
2562
|
this.classIsActive = 'mg-input--toggle-is-active';
|
|
2600
2563
|
this.classOnOff = 'mg-input--toggle-on-off';
|
|
2601
2564
|
this.classIcon = 'mg-input--toggle-icon';
|
|
2602
|
-
/**
|
|
2603
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
2604
|
-
* If not set, it will be created.
|
|
2605
|
-
*/
|
|
2606
|
-
this.identifier = createID('mg-input-toggle');
|
|
2607
2565
|
/**
|
|
2608
2566
|
* Input name
|
|
2609
2567
|
* If not set the value equals the identifier
|
|
@@ -2941,7 +2899,7 @@ var NavigationAction;
|
|
|
2941
2899
|
NavigationAction["PREVIOUS"] = "previous";
|
|
2942
2900
|
})(NavigationAction || (NavigationAction = {}));
|
|
2943
2901
|
|
|
2944
|
-
const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-
|
|
2902
|
+
const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-pagination{display:flex;align-items:center;flex-direction:row}.mg-pagination mg-input-select{margin-right:0.5rem}.mg-pagination mg-button{display:flex}.mg-pagination mg-button:first-of-type{margin-right:1rem}.mg-pagination mg-button:last-of-type{margin-left:1rem}";
|
|
2945
2903
|
|
|
2946
2904
|
/**
|
|
2947
2905
|
* Range generator
|
|
@@ -3052,10 +3010,10 @@ const MgPagination = class {
|
|
|
3052
3010
|
* @returns {HTMLElement} HTML Element
|
|
3053
3011
|
*/
|
|
3054
3012
|
render() {
|
|
3055
|
-
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`,
|
|
3013
|
+
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
3056
3014
|
// eslint-disable-next-line react/jsx-no-bind
|
|
3057
3015
|
onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
3058
|
-
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-
|
|
3016
|
+
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
3059
3017
|
}
|
|
3060
3018
|
get element() { return getElement(this); }
|
|
3061
3019
|
static get watchers() { return {
|
|
@@ -3065,7 +3023,7 @@ const MgPagination = class {
|
|
|
3065
3023
|
};
|
|
3066
3024
|
MgPagination.style = mgPaginationCss;
|
|
3067
3025
|
|
|
3068
|
-
const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__header-right{flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1}.mg-panel__header-left mg-button:not([slot=append-input]){margin:0 0.3rem 0 0}.mg-panel__header-left mg-button:not([slot=append-input])>*:first-of-type{font-family:var(--font-family-heading);font-size:1.4rem;font-weight:
|
|
3026
|
+
const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__header-right{flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1}.mg-panel__header-left mg-button:not([slot=append-input]){margin:0 0.3rem 0 0}.mg-panel__header-left mg-button:not([slot=append-input])>*:first-of-type{font-family:var(--font-family-heading);font-size:1.4rem;font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
|
|
3069
3027
|
|
|
3070
3028
|
const MgPanel = class {
|
|
3071
3029
|
constructor(hostRef) {
|
|
@@ -3178,14 +3136,17 @@ const MgPanel = class {
|
|
|
3178
3136
|
return collapseButton();
|
|
3179
3137
|
};
|
|
3180
3138
|
}
|
|
3181
|
-
|
|
3139
|
+
validatePanelTitle(newValue) {
|
|
3140
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
3141
|
+
throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
3142
|
+
}
|
|
3182
3143
|
this.titleChange.emit(newValue);
|
|
3183
3144
|
}
|
|
3184
3145
|
validatetitlePattern(newValue) {
|
|
3185
3146
|
if (newValue && !this.titleEditable) {
|
|
3186
3147
|
throw new Error('<mg-panel> prop "titleEditable" must be set to `true`.');
|
|
3187
3148
|
}
|
|
3188
|
-
if (newValue && this.titlePatternErrorMessage === undefined) {
|
|
3149
|
+
if (newValue && (this.titlePatternErrorMessage === undefined || this.titlePatternErrorMessage.trim() === '')) {
|
|
3189
3150
|
throw new Error('<mg-panel> prop "titlePattern" must be paired with the prop "titlePatternErrorMessage".');
|
|
3190
3151
|
}
|
|
3191
3152
|
}
|
|
@@ -3205,6 +3166,7 @@ const MgPanel = class {
|
|
|
3205
3166
|
this.messages = initLocales(this.element).messages;
|
|
3206
3167
|
// Validate
|
|
3207
3168
|
this.validatetitlePattern(this.titlePattern);
|
|
3169
|
+
this.validatePanelTitle(this.panelTitle);
|
|
3208
3170
|
}
|
|
3209
3171
|
/**
|
|
3210
3172
|
* Edit DOM after render
|
|
@@ -3227,2111 +3189,167 @@ const MgPanel = class {
|
|
|
3227
3189
|
}
|
|
3228
3190
|
get element() { return getElement(this); }
|
|
3229
3191
|
static get watchers() { return {
|
|
3230
|
-
"panelTitle": ["
|
|
3192
|
+
"panelTitle": ["validatePanelTitle"],
|
|
3231
3193
|
"titlePattern": ["validatetitlePattern"],
|
|
3232
3194
|
"expanded": ["handleExpanded"]
|
|
3233
3195
|
}; }
|
|
3234
3196
|
};
|
|
3235
3197
|
MgPanel.style = mgPanelCss;
|
|
3236
3198
|
|
|
3237
|
-
var
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
var reference = 'reference';
|
|
3249
|
-
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
|
3250
|
-
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
3251
|
-
}, []);
|
|
3252
|
-
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
|
3253
|
-
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
3254
|
-
}, []); // modifiers that need to read the DOM
|
|
3255
|
-
|
|
3256
|
-
var beforeRead = 'beforeRead';
|
|
3257
|
-
var read = 'read';
|
|
3258
|
-
var afterRead = 'afterRead'; // pure-logic modifiers
|
|
3259
|
-
|
|
3260
|
-
var beforeMain = 'beforeMain';
|
|
3261
|
-
var main = 'main';
|
|
3262
|
-
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
|
3263
|
-
|
|
3264
|
-
var beforeWrite = 'beforeWrite';
|
|
3265
|
-
var write = 'write';
|
|
3266
|
-
var afterWrite = 'afterWrite';
|
|
3267
|
-
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
3268
|
-
|
|
3269
|
-
function getNodeName(element) {
|
|
3270
|
-
return element ? (element.nodeName || '').toLowerCase() : null;
|
|
3271
|
-
}
|
|
3272
|
-
|
|
3273
|
-
function getWindow(node) {
|
|
3274
|
-
if (node == null) {
|
|
3275
|
-
return window;
|
|
3276
|
-
}
|
|
3277
|
-
|
|
3278
|
-
if (node.toString() !== '[object Window]') {
|
|
3279
|
-
var ownerDocument = node.ownerDocument;
|
|
3280
|
-
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
3281
|
-
}
|
|
3282
|
-
|
|
3283
|
-
return node;
|
|
3284
|
-
}
|
|
3285
|
-
|
|
3286
|
-
function isElement(node) {
|
|
3287
|
-
var OwnElement = getWindow(node).Element;
|
|
3288
|
-
return node instanceof OwnElement || node instanceof Element;
|
|
3289
|
-
}
|
|
3290
|
-
|
|
3291
|
-
function isHTMLElement(node) {
|
|
3292
|
-
var OwnElement = getWindow(node).HTMLElement;
|
|
3293
|
-
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
3294
|
-
}
|
|
3295
|
-
|
|
3296
|
-
function isShadowRoot(node) {
|
|
3297
|
-
// IE 11 has no ShadowRoot
|
|
3298
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
3299
|
-
return false;
|
|
3300
|
-
}
|
|
3301
|
-
|
|
3302
|
-
var OwnElement = getWindow(node).ShadowRoot;
|
|
3303
|
-
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
// and applies them to the HTMLElements such as popper and arrow
|
|
3307
|
-
|
|
3308
|
-
function applyStyles(_ref) {
|
|
3309
|
-
var state = _ref.state;
|
|
3310
|
-
Object.keys(state.elements).forEach(function (name) {
|
|
3311
|
-
var style = state.styles[name] || {};
|
|
3312
|
-
var attributes = state.attributes[name] || {};
|
|
3313
|
-
var element = state.elements[name]; // arrow is optional + virtual elements
|
|
3314
|
-
|
|
3315
|
-
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
3316
|
-
return;
|
|
3317
|
-
} // Flow doesn't support to extend this property, but it's the most
|
|
3318
|
-
// effective way to apply styles to an HTMLElement
|
|
3319
|
-
// $FlowFixMe[cannot-write]
|
|
3320
|
-
|
|
3199
|
+
var Status;
|
|
3200
|
+
(function (Status) {
|
|
3201
|
+
Status["VISIBLE"] = "visible";
|
|
3202
|
+
Status["HIDDEN"] = "hidden";
|
|
3203
|
+
Status["DISABLED"] = "disabled";
|
|
3204
|
+
Status["ACTIVE"] = "active";
|
|
3205
|
+
})(Status || (Status = {}));
|
|
3206
|
+
/**
|
|
3207
|
+
* List of all possibles sizes
|
|
3208
|
+
*/
|
|
3209
|
+
const sizes = ['regular', 'large'];
|
|
3321
3210
|
|
|
3322
|
-
|
|
3323
|
-
Object.keys(attributes).forEach(function (name) {
|
|
3324
|
-
var value = attributes[name];
|
|
3211
|
+
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button{padding:calc(1rem + 0.3rem) calc(1rem * 1.3) 1rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button{padding:calc(1.8rem + 0.3rem) calc(1.8rem * 1.3) 1.8rem}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:0.5rem;background:none;border:none;border-bottom:0.3rem solid transparent;font-family:var(--font-family);color:hsl(var(--color-dark));line-height:var(--line-height);cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:30%}.mg-tabs__navigation-button:hover:not(:disabled),.mg-tabs__navigation-button:focus:not(:disabled){background-color:hsla(var(--color-info-h), var(--color-info-s), var(--color-info-l), 10%)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--color-info));border-bottom-color:hsl(var(--color-info));font-weight:700}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__content-container:focus-visible{outline:none}";
|
|
3325
3212
|
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3213
|
+
/**
|
|
3214
|
+
* type TabItem validation function
|
|
3215
|
+
*
|
|
3216
|
+
* @param {TabItem} tab tab item
|
|
3217
|
+
* @returns {boolean} tab item type is valid
|
|
3218
|
+
*/
|
|
3219
|
+
const isTabItem = (tab) => typeof tab === 'object' && typeof tab.label === 'string';
|
|
3220
|
+
const MgTabs = class {
|
|
3221
|
+
constructor(hostRef) {
|
|
3222
|
+
registerInstance(this, hostRef);
|
|
3223
|
+
this.activeTabChange = createEvent(this, "active-tab-change", 7);
|
|
3224
|
+
/************
|
|
3225
|
+
* Internal *
|
|
3226
|
+
************/
|
|
3227
|
+
this.tabPanel = 'panel';
|
|
3228
|
+
this.startIndex = 1;
|
|
3229
|
+
this.buttonTabBaseClass = 'mg-tabs__navigation-button';
|
|
3230
|
+
/**
|
|
3231
|
+
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
3232
|
+
* If not set, it will be created.
|
|
3233
|
+
*/
|
|
3234
|
+
this.identifier = createID('mg-tabs');
|
|
3235
|
+
/**
|
|
3236
|
+
* Define tabs size
|
|
3237
|
+
*/
|
|
3238
|
+
this.size = 'regular';
|
|
3239
|
+
/**
|
|
3240
|
+
* Active tab number
|
|
3241
|
+
* default: first is 1
|
|
3242
|
+
*/
|
|
3243
|
+
this.activeTab = 1;
|
|
3244
|
+
/**
|
|
3245
|
+
* Component tabs
|
|
3246
|
+
*/
|
|
3247
|
+
this.tabs = [];
|
|
3248
|
+
/**
|
|
3249
|
+
* Component classes
|
|
3250
|
+
*/
|
|
3251
|
+
this.classList = new ClassList(['mg-tabs']);
|
|
3252
|
+
/**
|
|
3253
|
+
* Method to set active tab
|
|
3254
|
+
*
|
|
3255
|
+
* @param {number} tabKey item tab key to set to ACTIVE status
|
|
3256
|
+
* @returns {void}
|
|
3257
|
+
*/
|
|
3258
|
+
this.setActiveTab = (tabKey) => {
|
|
3259
|
+
// reset active tabs
|
|
3260
|
+
this.tabs.forEach(tab => {
|
|
3261
|
+
if (this.tabHasGivenStatus(tab, Status.ACTIVE))
|
|
3262
|
+
tab.status = Status.VISIBLE;
|
|
3263
|
+
});
|
|
3264
|
+
// set active tab from given tab key
|
|
3265
|
+
this.tabs[tabKey - this.startIndex].status = Status.ACTIVE;
|
|
3266
|
+
// emit change active tab key event
|
|
3267
|
+
this.activeTabChange.emit(tabKey);
|
|
3268
|
+
};
|
|
3269
|
+
/**
|
|
3270
|
+
* Method to know if given tab has the given status
|
|
3271
|
+
*
|
|
3272
|
+
* @param {TabItem} tab item tab key to set to ACTIVE status
|
|
3273
|
+
* @param {Status} status status to valide
|
|
3274
|
+
* @returns {boolean} status comparaison
|
|
3275
|
+
*/
|
|
3276
|
+
this.tabHasGivenStatus = (tab, status) => tab.status === status;
|
|
3277
|
+
/**
|
|
3278
|
+
* Method to get element id from index
|
|
3279
|
+
*
|
|
3280
|
+
* @param {string} element to get id
|
|
3281
|
+
* @param {number} index to generate id
|
|
3282
|
+
* @returns {string} generated element id
|
|
3283
|
+
*/
|
|
3284
|
+
this.getElementId = (element, index) => `${element}-${this.getTabIndex(index)}`;
|
|
3285
|
+
/**
|
|
3286
|
+
* Method to get tab index
|
|
3287
|
+
*
|
|
3288
|
+
* @param {number} index to get
|
|
3289
|
+
* @returns {number} index
|
|
3290
|
+
*/
|
|
3291
|
+
this.getTabIndex = (index) => index + this.startIndex;
|
|
3292
|
+
/**
|
|
3293
|
+
* Handle click events on tabs
|
|
3294
|
+
*
|
|
3295
|
+
* @param {MouseEvent} event mouse event
|
|
3296
|
+
*/
|
|
3297
|
+
this.handleClick = (event) => {
|
|
3298
|
+
const tabId = event.currentTarget.getAttribute('data-index');
|
|
3299
|
+
this.activeTab = Number(tabId);
|
|
3300
|
+
};
|
|
3301
|
+
/**
|
|
3302
|
+
* get navigation button class from given status
|
|
3303
|
+
*
|
|
3304
|
+
* @param {Status} status button tab status
|
|
3305
|
+
* @param {boolean} isSelector set if we need a CSS selector with the dot '.' at the begin. default value = false.
|
|
3306
|
+
* @returns {string} button class/selector variant
|
|
3307
|
+
*/
|
|
3308
|
+
this.getNavigationButtonClass = (status, isSelector = false) => `${isSelector ? '.' : ''}${this.buttonTabBaseClass}--${status}`;
|
|
3309
|
+
/**
|
|
3310
|
+
* Handle keyboard event on tabs
|
|
3311
|
+
*
|
|
3312
|
+
* @param {MouseEvent} event mouse event
|
|
3313
|
+
* @returns {void}
|
|
3314
|
+
*/
|
|
3315
|
+
this.handleKeydown = (event) => {
|
|
3316
|
+
let tabId = Number(event.target.getAttribute('data-index'));
|
|
3317
|
+
const parent = event.target.parentElement;
|
|
3318
|
+
// change selected id from key code
|
|
3319
|
+
if (event.key === 'ArrowRight') {
|
|
3320
|
+
tabId++;
|
|
3330
3321
|
}
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
}
|
|
3334
|
-
|
|
3335
|
-
function effect$2(_ref2) {
|
|
3336
|
-
var state = _ref2.state;
|
|
3337
|
-
var initialStyles = {
|
|
3338
|
-
popper: {
|
|
3339
|
-
position: state.options.strategy,
|
|
3340
|
-
left: '0',
|
|
3341
|
-
top: '0',
|
|
3342
|
-
margin: '0'
|
|
3343
|
-
},
|
|
3344
|
-
arrow: {
|
|
3345
|
-
position: 'absolute'
|
|
3346
|
-
},
|
|
3347
|
-
reference: {}
|
|
3348
|
-
};
|
|
3349
|
-
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
3350
|
-
state.styles = initialStyles;
|
|
3351
|
-
|
|
3352
|
-
if (state.elements.arrow) {
|
|
3353
|
-
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
3354
|
-
}
|
|
3355
|
-
|
|
3356
|
-
return function () {
|
|
3357
|
-
Object.keys(state.elements).forEach(function (name) {
|
|
3358
|
-
var element = state.elements[name];
|
|
3359
|
-
var attributes = state.attributes[name] || {};
|
|
3360
|
-
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
|
|
3361
|
-
|
|
3362
|
-
var style = styleProperties.reduce(function (style, property) {
|
|
3363
|
-
style[property] = '';
|
|
3364
|
-
return style;
|
|
3365
|
-
}, {}); // arrow is optional + virtual elements
|
|
3366
|
-
|
|
3367
|
-
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
3368
|
-
return;
|
|
3322
|
+
else if (event.key === 'ArrowLeft') {
|
|
3323
|
+
tabId--;
|
|
3369
3324
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
}
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
};
|
|
3388
|
-
|
|
3389
|
-
function getBasePlacement(placement) {
|
|
3390
|
-
return placement.split('-')[0];
|
|
3391
|
-
}
|
|
3392
|
-
|
|
3393
|
-
var max = Math.max;
|
|
3394
|
-
var min = Math.min;
|
|
3395
|
-
var round = Math.round;
|
|
3396
|
-
|
|
3397
|
-
function getBoundingClientRect(element, includeScale) {
|
|
3398
|
-
if (includeScale === void 0) {
|
|
3399
|
-
includeScale = false;
|
|
3325
|
+
// get selected tab if NOT hidden, disabled
|
|
3326
|
+
const selectedTab = parent.querySelector(`[data-index="${tabId}"]:not(${[this.getNavigationButtonClass(Status.HIDDEN, true), this.getNavigationButtonClass(Status.DISABLED, true)].join()})`);
|
|
3327
|
+
// apply selected tab if exist
|
|
3328
|
+
if (selectedTab !== null) {
|
|
3329
|
+
selectedTab.focus();
|
|
3330
|
+
this.activeTab = tabId;
|
|
3331
|
+
}
|
|
3332
|
+
};
|
|
3333
|
+
/**
|
|
3334
|
+
* Validate slots setting
|
|
3335
|
+
*/
|
|
3336
|
+
this.validateSlots = () => {
|
|
3337
|
+
const slots = Array.from(this.element.children).filter(slot => { var _a; return (_a = slot.getAttribute('slot')) === null || _a === void 0 ? void 0 : _a.includes('tab_content-'); });
|
|
3338
|
+
if (slots.length !== this.tabs.length) {
|
|
3339
|
+
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
3340
|
+
}
|
|
3341
|
+
};
|
|
3400
3342
|
}
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
var scaleY = 1;
|
|
3405
|
-
|
|
3406
|
-
if (isHTMLElement(element) && includeScale) {
|
|
3407
|
-
var offsetHeight = element.offsetHeight;
|
|
3408
|
-
var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
|
|
3409
|
-
// Fallback to 1 in case both values are `0`
|
|
3410
|
-
|
|
3411
|
-
if (offsetWidth > 0) {
|
|
3412
|
-
scaleX = round(rect.width) / offsetWidth || 1;
|
|
3343
|
+
validateLabel(newValue) {
|
|
3344
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
3345
|
+
throw new Error('<mg-tabs> prop "label" is required.');
|
|
3413
3346
|
}
|
|
3414
|
-
|
|
3415
|
-
if (offsetHeight > 0) {
|
|
3416
|
-
scaleY = round(rect.height) / offsetHeight || 1;
|
|
3417
|
-
}
|
|
3418
|
-
}
|
|
3419
|
-
|
|
3420
|
-
return {
|
|
3421
|
-
width: rect.width / scaleX,
|
|
3422
|
-
height: rect.height / scaleY,
|
|
3423
|
-
top: rect.top / scaleY,
|
|
3424
|
-
right: rect.right / scaleX,
|
|
3425
|
-
bottom: rect.bottom / scaleY,
|
|
3426
|
-
left: rect.left / scaleX,
|
|
3427
|
-
x: rect.left / scaleX,
|
|
3428
|
-
y: rect.top / scaleY
|
|
3429
|
-
};
|
|
3430
|
-
}
|
|
3431
|
-
|
|
3432
|
-
// means it doesn't take into account transforms.
|
|
3433
|
-
|
|
3434
|
-
function getLayoutRect(element) {
|
|
3435
|
-
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
|
3436
|
-
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
|
3437
|
-
|
|
3438
|
-
var width = element.offsetWidth;
|
|
3439
|
-
var height = element.offsetHeight;
|
|
3440
|
-
|
|
3441
|
-
if (Math.abs(clientRect.width - width) <= 1) {
|
|
3442
|
-
width = clientRect.width;
|
|
3443
3347
|
}
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
return {
|
|
3450
|
-
x: element.offsetLeft,
|
|
3451
|
-
y: element.offsetTop,
|
|
3452
|
-
width: width,
|
|
3453
|
-
height: height
|
|
3454
|
-
};
|
|
3455
|
-
}
|
|
3456
|
-
|
|
3457
|
-
function contains(parent, child) {
|
|
3458
|
-
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
|
3459
|
-
|
|
3460
|
-
if (parent.contains(child)) {
|
|
3461
|
-
return true;
|
|
3462
|
-
} // then fallback to custom implementation with Shadow DOM support
|
|
3463
|
-
else if (rootNode && isShadowRoot(rootNode)) {
|
|
3464
|
-
var next = child;
|
|
3465
|
-
|
|
3466
|
-
do {
|
|
3467
|
-
if (next && parent.isSameNode(next)) {
|
|
3468
|
-
return true;
|
|
3469
|
-
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
next = next.parentNode || next.host;
|
|
3473
|
-
} while (next);
|
|
3474
|
-
} // Give up, the result is false
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
return false;
|
|
3478
|
-
}
|
|
3479
|
-
|
|
3480
|
-
function getComputedStyle(element) {
|
|
3481
|
-
return getWindow(element).getComputedStyle(element);
|
|
3482
|
-
}
|
|
3483
|
-
|
|
3484
|
-
function isTableElement(element) {
|
|
3485
|
-
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
|
3486
|
-
}
|
|
3487
|
-
|
|
3488
|
-
function getDocumentElement(element) {
|
|
3489
|
-
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
3490
|
-
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
|
3491
|
-
element.document) || window.document).documentElement;
|
|
3492
|
-
}
|
|
3493
|
-
|
|
3494
|
-
function getParentNode(element) {
|
|
3495
|
-
if (getNodeName(element) === 'html') {
|
|
3496
|
-
return element;
|
|
3497
|
-
}
|
|
3498
|
-
|
|
3499
|
-
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
3500
|
-
// $FlowFixMe[incompatible-return]
|
|
3501
|
-
// $FlowFixMe[prop-missing]
|
|
3502
|
-
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
3503
|
-
element.parentNode || ( // DOM Element detected
|
|
3504
|
-
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
|
3505
|
-
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
3506
|
-
getDocumentElement(element) // fallback
|
|
3507
|
-
|
|
3508
|
-
);
|
|
3509
|
-
}
|
|
3510
|
-
|
|
3511
|
-
function getTrueOffsetParent(element) {
|
|
3512
|
-
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
3513
|
-
getComputedStyle(element).position === 'fixed') {
|
|
3514
|
-
return null;
|
|
3515
|
-
}
|
|
3516
|
-
|
|
3517
|
-
return element.offsetParent;
|
|
3518
|
-
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
|
3519
|
-
// return the containing block
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
function getContainingBlock(element) {
|
|
3523
|
-
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
|
|
3524
|
-
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
|
|
3525
|
-
|
|
3526
|
-
if (isIE && isHTMLElement(element)) {
|
|
3527
|
-
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
|
3528
|
-
var elementCss = getComputedStyle(element);
|
|
3529
|
-
|
|
3530
|
-
if (elementCss.position === 'fixed') {
|
|
3531
|
-
return null;
|
|
3532
|
-
}
|
|
3533
|
-
}
|
|
3534
|
-
|
|
3535
|
-
var currentNode = getParentNode(element);
|
|
3536
|
-
|
|
3537
|
-
if (isShadowRoot(currentNode)) {
|
|
3538
|
-
currentNode = currentNode.host;
|
|
3539
|
-
}
|
|
3540
|
-
|
|
3541
|
-
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
3542
|
-
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
3543
|
-
// create a containing block.
|
|
3544
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
3545
|
-
|
|
3546
|
-
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
|
3547
|
-
return currentNode;
|
|
3548
|
-
} else {
|
|
3549
|
-
currentNode = currentNode.parentNode;
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
|
|
3553
|
-
return null;
|
|
3554
|
-
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
|
3555
|
-
// such as table ancestors and cross browser bugs.
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
function getOffsetParent(element) {
|
|
3559
|
-
var window = getWindow(element);
|
|
3560
|
-
var offsetParent = getTrueOffsetParent(element);
|
|
3561
|
-
|
|
3562
|
-
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
|
3563
|
-
offsetParent = getTrueOffsetParent(offsetParent);
|
|
3564
|
-
}
|
|
3565
|
-
|
|
3566
|
-
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
|
3567
|
-
return window;
|
|
3568
|
-
}
|
|
3569
|
-
|
|
3570
|
-
return offsetParent || getContainingBlock(element) || window;
|
|
3571
|
-
}
|
|
3572
|
-
|
|
3573
|
-
function getMainAxisFromPlacement(placement) {
|
|
3574
|
-
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
|
3575
|
-
}
|
|
3576
|
-
|
|
3577
|
-
function within(min$1, value, max$1) {
|
|
3578
|
-
return max(min$1, min(value, max$1));
|
|
3579
|
-
}
|
|
3580
|
-
function withinMaxClamp(min, value, max) {
|
|
3581
|
-
var v = within(min, value, max);
|
|
3582
|
-
return v > max ? max : v;
|
|
3583
|
-
}
|
|
3584
|
-
|
|
3585
|
-
function getFreshSideObject() {
|
|
3586
|
-
return {
|
|
3587
|
-
top: 0,
|
|
3588
|
-
right: 0,
|
|
3589
|
-
bottom: 0,
|
|
3590
|
-
left: 0
|
|
3591
|
-
};
|
|
3592
|
-
}
|
|
3593
|
-
|
|
3594
|
-
function mergePaddingObject(paddingObject) {
|
|
3595
|
-
return Object.assign({}, getFreshSideObject(), paddingObject);
|
|
3596
|
-
}
|
|
3597
|
-
|
|
3598
|
-
function expandToHashMap(value, keys) {
|
|
3599
|
-
return keys.reduce(function (hashMap, key) {
|
|
3600
|
-
hashMap[key] = value;
|
|
3601
|
-
return hashMap;
|
|
3602
|
-
}, {});
|
|
3603
|
-
}
|
|
3604
|
-
|
|
3605
|
-
var toPaddingObject = function toPaddingObject(padding, state) {
|
|
3606
|
-
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
|
|
3607
|
-
placement: state.placement
|
|
3608
|
-
})) : padding;
|
|
3609
|
-
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
3610
|
-
};
|
|
3611
|
-
|
|
3612
|
-
function arrow(_ref) {
|
|
3613
|
-
var _state$modifiersData$;
|
|
3614
|
-
|
|
3615
|
-
var state = _ref.state,
|
|
3616
|
-
name = _ref.name,
|
|
3617
|
-
options = _ref.options;
|
|
3618
|
-
var arrowElement = state.elements.arrow;
|
|
3619
|
-
var popperOffsets = state.modifiersData.popperOffsets;
|
|
3620
|
-
var basePlacement = getBasePlacement(state.placement);
|
|
3621
|
-
var axis = getMainAxisFromPlacement(basePlacement);
|
|
3622
|
-
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
|
3623
|
-
var len = isVertical ? 'height' : 'width';
|
|
3624
|
-
|
|
3625
|
-
if (!arrowElement || !popperOffsets) {
|
|
3626
|
-
return;
|
|
3627
|
-
}
|
|
3628
|
-
|
|
3629
|
-
var paddingObject = toPaddingObject(options.padding, state);
|
|
3630
|
-
var arrowRect = getLayoutRect(arrowElement);
|
|
3631
|
-
var minProp = axis === 'y' ? top : left;
|
|
3632
|
-
var maxProp = axis === 'y' ? bottom : right;
|
|
3633
|
-
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
|
|
3634
|
-
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
|
|
3635
|
-
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
3636
|
-
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
3637
|
-
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
|
|
3638
|
-
// outside of the popper bounds
|
|
3639
|
-
|
|
3640
|
-
var min = paddingObject[minProp];
|
|
3641
|
-
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
|
|
3642
|
-
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
|
3643
|
-
var offset = within(min, center, max); // Prevents breaking syntax highlighting...
|
|
3644
|
-
|
|
3645
|
-
var axisProp = axis;
|
|
3646
|
-
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
|
|
3647
|
-
}
|
|
3648
|
-
|
|
3649
|
-
function effect$1(_ref2) {
|
|
3650
|
-
var state = _ref2.state,
|
|
3651
|
-
options = _ref2.options;
|
|
3652
|
-
var _options$element = options.element,
|
|
3653
|
-
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
|
|
3654
|
-
|
|
3655
|
-
if (arrowElement == null) {
|
|
3656
|
-
return;
|
|
3657
|
-
} // CSS selector
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
if (typeof arrowElement === 'string') {
|
|
3661
|
-
arrowElement = state.elements.popper.querySelector(arrowElement);
|
|
3662
|
-
|
|
3663
|
-
if (!arrowElement) {
|
|
3664
|
-
return;
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
|
|
3668
|
-
if (!contains(state.elements.popper, arrowElement)) {
|
|
3669
|
-
|
|
3670
|
-
return;
|
|
3671
|
-
}
|
|
3672
|
-
|
|
3673
|
-
state.elements.arrow = arrowElement;
|
|
3674
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
const arrow$1 = {
|
|
3678
|
-
name: 'arrow',
|
|
3679
|
-
enabled: true,
|
|
3680
|
-
phase: 'main',
|
|
3681
|
-
fn: arrow,
|
|
3682
|
-
effect: effect$1,
|
|
3683
|
-
requires: ['popperOffsets'],
|
|
3684
|
-
requiresIfExists: ['preventOverflow']
|
|
3685
|
-
};
|
|
3686
|
-
|
|
3687
|
-
function getVariation(placement) {
|
|
3688
|
-
return placement.split('-')[1];
|
|
3689
|
-
}
|
|
3690
|
-
|
|
3691
|
-
var unsetSides = {
|
|
3692
|
-
top: 'auto',
|
|
3693
|
-
right: 'auto',
|
|
3694
|
-
bottom: 'auto',
|
|
3695
|
-
left: 'auto'
|
|
3696
|
-
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
|
|
3697
|
-
// Zooming can change the DPR, but it seems to report a value that will
|
|
3698
|
-
// cleanly divide the values into the appropriate subpixels.
|
|
3699
|
-
|
|
3700
|
-
function roundOffsetsByDPR(_ref) {
|
|
3701
|
-
var x = _ref.x,
|
|
3702
|
-
y = _ref.y;
|
|
3703
|
-
var win = window;
|
|
3704
|
-
var dpr = win.devicePixelRatio || 1;
|
|
3705
|
-
return {
|
|
3706
|
-
x: round(x * dpr) / dpr || 0,
|
|
3707
|
-
y: round(y * dpr) / dpr || 0
|
|
3708
|
-
};
|
|
3709
|
-
}
|
|
3710
|
-
|
|
3711
|
-
function mapToStyles(_ref2) {
|
|
3712
|
-
var _Object$assign2;
|
|
3713
|
-
|
|
3714
|
-
var popper = _ref2.popper,
|
|
3715
|
-
popperRect = _ref2.popperRect,
|
|
3716
|
-
placement = _ref2.placement,
|
|
3717
|
-
variation = _ref2.variation,
|
|
3718
|
-
offsets = _ref2.offsets,
|
|
3719
|
-
position = _ref2.position,
|
|
3720
|
-
gpuAcceleration = _ref2.gpuAcceleration,
|
|
3721
|
-
adaptive = _ref2.adaptive,
|
|
3722
|
-
roundOffsets = _ref2.roundOffsets,
|
|
3723
|
-
isFixed = _ref2.isFixed;
|
|
3724
|
-
var _offsets$x = offsets.x,
|
|
3725
|
-
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
|
3726
|
-
_offsets$y = offsets.y,
|
|
3727
|
-
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
3728
|
-
|
|
3729
|
-
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
|
3730
|
-
x: x,
|
|
3731
|
-
y: y
|
|
3732
|
-
}) : {
|
|
3733
|
-
x: x,
|
|
3734
|
-
y: y
|
|
3735
|
-
};
|
|
3736
|
-
|
|
3737
|
-
x = _ref3.x;
|
|
3738
|
-
y = _ref3.y;
|
|
3739
|
-
var hasX = offsets.hasOwnProperty('x');
|
|
3740
|
-
var hasY = offsets.hasOwnProperty('y');
|
|
3741
|
-
var sideX = left;
|
|
3742
|
-
var sideY = top;
|
|
3743
|
-
var win = window;
|
|
3744
|
-
|
|
3745
|
-
if (adaptive) {
|
|
3746
|
-
var offsetParent = getOffsetParent(popper);
|
|
3747
|
-
var heightProp = 'clientHeight';
|
|
3748
|
-
var widthProp = 'clientWidth';
|
|
3749
|
-
|
|
3750
|
-
if (offsetParent === getWindow(popper)) {
|
|
3751
|
-
offsetParent = getDocumentElement(popper);
|
|
3752
|
-
|
|
3753
|
-
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
|
|
3754
|
-
heightProp = 'scrollHeight';
|
|
3755
|
-
widthProp = 'scrollWidth';
|
|
3756
|
-
}
|
|
3757
|
-
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
offsetParent = offsetParent;
|
|
3761
|
-
|
|
3762
|
-
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
3763
|
-
sideY = bottom;
|
|
3764
|
-
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
3765
|
-
offsetParent[heightProp];
|
|
3766
|
-
y -= offsetY - popperRect.height;
|
|
3767
|
-
y *= gpuAcceleration ? 1 : -1;
|
|
3768
|
-
}
|
|
3769
|
-
|
|
3770
|
-
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
3771
|
-
sideX = right;
|
|
3772
|
-
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
3773
|
-
offsetParent[widthProp];
|
|
3774
|
-
x -= offsetX - popperRect.width;
|
|
3775
|
-
x *= gpuAcceleration ? 1 : -1;
|
|
3776
|
-
}
|
|
3777
|
-
}
|
|
3778
|
-
|
|
3779
|
-
var commonStyles = Object.assign({
|
|
3780
|
-
position: position
|
|
3781
|
-
}, adaptive && unsetSides);
|
|
3782
|
-
|
|
3783
|
-
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
3784
|
-
x: x,
|
|
3785
|
-
y: y
|
|
3786
|
-
}) : {
|
|
3787
|
-
x: x,
|
|
3788
|
-
y: y
|
|
3789
|
-
};
|
|
3790
|
-
|
|
3791
|
-
x = _ref4.x;
|
|
3792
|
-
y = _ref4.y;
|
|
3793
|
-
|
|
3794
|
-
if (gpuAcceleration) {
|
|
3795
|
-
var _Object$assign;
|
|
3796
|
-
|
|
3797
|
-
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
3798
|
-
}
|
|
3799
|
-
|
|
3800
|
-
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
3801
|
-
}
|
|
3802
|
-
|
|
3803
|
-
function computeStyles(_ref5) {
|
|
3804
|
-
var state = _ref5.state,
|
|
3805
|
-
options = _ref5.options;
|
|
3806
|
-
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
3807
|
-
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
3808
|
-
_options$adaptive = options.adaptive,
|
|
3809
|
-
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
|
|
3810
|
-
_options$roundOffsets = options.roundOffsets,
|
|
3811
|
-
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
|
3812
|
-
|
|
3813
|
-
var commonStyles = {
|
|
3814
|
-
placement: getBasePlacement(state.placement),
|
|
3815
|
-
variation: getVariation(state.placement),
|
|
3816
|
-
popper: state.elements.popper,
|
|
3817
|
-
popperRect: state.rects.popper,
|
|
3818
|
-
gpuAcceleration: gpuAcceleration,
|
|
3819
|
-
isFixed: state.options.strategy === 'fixed'
|
|
3820
|
-
};
|
|
3821
|
-
|
|
3822
|
-
if (state.modifiersData.popperOffsets != null) {
|
|
3823
|
-
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
3824
|
-
offsets: state.modifiersData.popperOffsets,
|
|
3825
|
-
position: state.options.strategy,
|
|
3826
|
-
adaptive: adaptive,
|
|
3827
|
-
roundOffsets: roundOffsets
|
|
3828
|
-
})));
|
|
3829
|
-
}
|
|
3830
|
-
|
|
3831
|
-
if (state.modifiersData.arrow != null) {
|
|
3832
|
-
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
|
3833
|
-
offsets: state.modifiersData.arrow,
|
|
3834
|
-
position: 'absolute',
|
|
3835
|
-
adaptive: false,
|
|
3836
|
-
roundOffsets: roundOffsets
|
|
3837
|
-
})));
|
|
3838
|
-
}
|
|
3839
|
-
|
|
3840
|
-
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
3841
|
-
'data-popper-placement': state.placement
|
|
3842
|
-
});
|
|
3843
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
const computeStyles$1 = {
|
|
3847
|
-
name: 'computeStyles',
|
|
3848
|
-
enabled: true,
|
|
3849
|
-
phase: 'beforeWrite',
|
|
3850
|
-
fn: computeStyles,
|
|
3851
|
-
data: {}
|
|
3852
|
-
};
|
|
3853
|
-
|
|
3854
|
-
var passive = {
|
|
3855
|
-
passive: true
|
|
3856
|
-
};
|
|
3857
|
-
|
|
3858
|
-
function effect(_ref) {
|
|
3859
|
-
var state = _ref.state,
|
|
3860
|
-
instance = _ref.instance,
|
|
3861
|
-
options = _ref.options;
|
|
3862
|
-
var _options$scroll = options.scroll,
|
|
3863
|
-
scroll = _options$scroll === void 0 ? true : _options$scroll,
|
|
3864
|
-
_options$resize = options.resize,
|
|
3865
|
-
resize = _options$resize === void 0 ? true : _options$resize;
|
|
3866
|
-
var window = getWindow(state.elements.popper);
|
|
3867
|
-
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
3868
|
-
|
|
3869
|
-
if (scroll) {
|
|
3870
|
-
scrollParents.forEach(function (scrollParent) {
|
|
3871
|
-
scrollParent.addEventListener('scroll', instance.update, passive);
|
|
3872
|
-
});
|
|
3873
|
-
}
|
|
3874
|
-
|
|
3875
|
-
if (resize) {
|
|
3876
|
-
window.addEventListener('resize', instance.update, passive);
|
|
3877
|
-
}
|
|
3878
|
-
|
|
3879
|
-
return function () {
|
|
3880
|
-
if (scroll) {
|
|
3881
|
-
scrollParents.forEach(function (scrollParent) {
|
|
3882
|
-
scrollParent.removeEventListener('scroll', instance.update, passive);
|
|
3883
|
-
});
|
|
3884
|
-
}
|
|
3885
|
-
|
|
3886
|
-
if (resize) {
|
|
3887
|
-
window.removeEventListener('resize', instance.update, passive);
|
|
3888
|
-
}
|
|
3889
|
-
};
|
|
3890
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
const eventListeners = {
|
|
3894
|
-
name: 'eventListeners',
|
|
3895
|
-
enabled: true,
|
|
3896
|
-
phase: 'write',
|
|
3897
|
-
fn: function fn() {},
|
|
3898
|
-
effect: effect,
|
|
3899
|
-
data: {}
|
|
3900
|
-
};
|
|
3901
|
-
|
|
3902
|
-
var hash$1 = {
|
|
3903
|
-
left: 'right',
|
|
3904
|
-
right: 'left',
|
|
3905
|
-
bottom: 'top',
|
|
3906
|
-
top: 'bottom'
|
|
3907
|
-
};
|
|
3908
|
-
function getOppositePlacement(placement) {
|
|
3909
|
-
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
3910
|
-
return hash$1[matched];
|
|
3911
|
-
});
|
|
3912
|
-
}
|
|
3913
|
-
|
|
3914
|
-
var hash = {
|
|
3915
|
-
start: 'end',
|
|
3916
|
-
end: 'start'
|
|
3917
|
-
};
|
|
3918
|
-
function getOppositeVariationPlacement(placement) {
|
|
3919
|
-
return placement.replace(/start|end/g, function (matched) {
|
|
3920
|
-
return hash[matched];
|
|
3921
|
-
});
|
|
3922
|
-
}
|
|
3923
|
-
|
|
3924
|
-
function getWindowScroll(node) {
|
|
3925
|
-
var win = getWindow(node);
|
|
3926
|
-
var scrollLeft = win.pageXOffset;
|
|
3927
|
-
var scrollTop = win.pageYOffset;
|
|
3928
|
-
return {
|
|
3929
|
-
scrollLeft: scrollLeft,
|
|
3930
|
-
scrollTop: scrollTop
|
|
3931
|
-
};
|
|
3932
|
-
}
|
|
3933
|
-
|
|
3934
|
-
function getWindowScrollBarX(element) {
|
|
3935
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
3936
|
-
// incorrect for RTL.
|
|
3937
|
-
// Popper 1 is broken in this case and never had a bug report so let's assume
|
|
3938
|
-
// it's not an issue. I don't think anyone ever specifies width on <html>
|
|
3939
|
-
// anyway.
|
|
3940
|
-
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
|
3941
|
-
// this (e.g. Edge 2019, IE11, Safari)
|
|
3942
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
3943
|
-
}
|
|
3944
|
-
|
|
3945
|
-
function getViewportRect(element) {
|
|
3946
|
-
var win = getWindow(element);
|
|
3947
|
-
var html = getDocumentElement(element);
|
|
3948
|
-
var visualViewport = win.visualViewport;
|
|
3949
|
-
var width = html.clientWidth;
|
|
3950
|
-
var height = html.clientHeight;
|
|
3951
|
-
var x = 0;
|
|
3952
|
-
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
|
|
3953
|
-
// can be obscured underneath it.
|
|
3954
|
-
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
|
3955
|
-
// if it isn't open, so if this isn't available, the popper will be detected
|
|
3956
|
-
// to overflow the bottom of the screen too early.
|
|
3957
|
-
|
|
3958
|
-
if (visualViewport) {
|
|
3959
|
-
width = visualViewport.width;
|
|
3960
|
-
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
|
|
3961
|
-
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
|
|
3962
|
-
// errors due to floating point numbers, so we need to check precision.
|
|
3963
|
-
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
|
|
3964
|
-
// Feature detection fails in mobile emulation mode in Chrome.
|
|
3965
|
-
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
|
|
3966
|
-
// 0.001
|
|
3967
|
-
// Fallback here: "Not Safari" userAgent
|
|
3968
|
-
|
|
3969
|
-
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
|
3970
|
-
x = visualViewport.offsetLeft;
|
|
3971
|
-
y = visualViewport.offsetTop;
|
|
3972
|
-
}
|
|
3973
|
-
}
|
|
3974
|
-
|
|
3975
|
-
return {
|
|
3976
|
-
width: width,
|
|
3977
|
-
height: height,
|
|
3978
|
-
x: x + getWindowScrollBarX(element),
|
|
3979
|
-
y: y
|
|
3980
|
-
};
|
|
3981
|
-
}
|
|
3982
|
-
|
|
3983
|
-
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
|
3984
|
-
|
|
3985
|
-
function getDocumentRect(element) {
|
|
3986
|
-
var _element$ownerDocumen;
|
|
3987
|
-
|
|
3988
|
-
var html = getDocumentElement(element);
|
|
3989
|
-
var winScroll = getWindowScroll(element);
|
|
3990
|
-
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
3991
|
-
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
3992
|
-
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
3993
|
-
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
3994
|
-
var y = -winScroll.scrollTop;
|
|
3995
|
-
|
|
3996
|
-
if (getComputedStyle(body || html).direction === 'rtl') {
|
|
3997
|
-
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
3998
|
-
}
|
|
3999
|
-
|
|
4000
|
-
return {
|
|
4001
|
-
width: width,
|
|
4002
|
-
height: height,
|
|
4003
|
-
x: x,
|
|
4004
|
-
y: y
|
|
4005
|
-
};
|
|
4006
|
-
}
|
|
4007
|
-
|
|
4008
|
-
function isScrollParent(element) {
|
|
4009
|
-
// Firefox wants us to check `-x` and `-y` variations as well
|
|
4010
|
-
var _getComputedStyle = getComputedStyle(element),
|
|
4011
|
-
overflow = _getComputedStyle.overflow,
|
|
4012
|
-
overflowX = _getComputedStyle.overflowX,
|
|
4013
|
-
overflowY = _getComputedStyle.overflowY;
|
|
4014
|
-
|
|
4015
|
-
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
4016
|
-
}
|
|
4017
|
-
|
|
4018
|
-
function getScrollParent(node) {
|
|
4019
|
-
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
|
4020
|
-
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
4021
|
-
return node.ownerDocument.body;
|
|
4022
|
-
}
|
|
4023
|
-
|
|
4024
|
-
if (isHTMLElement(node) && isScrollParent(node)) {
|
|
4025
|
-
return node;
|
|
4026
|
-
}
|
|
4027
|
-
|
|
4028
|
-
return getScrollParent(getParentNode(node));
|
|
4029
|
-
}
|
|
4030
|
-
|
|
4031
|
-
/*
|
|
4032
|
-
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
|
4033
|
-
until we get to the top window object. This list is what we attach scroll listeners
|
|
4034
|
-
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
|
4035
|
-
reference element's position.
|
|
4036
|
-
*/
|
|
4037
|
-
|
|
4038
|
-
function listScrollParents(element, list) {
|
|
4039
|
-
var _element$ownerDocumen;
|
|
4040
|
-
|
|
4041
|
-
if (list === void 0) {
|
|
4042
|
-
list = [];
|
|
4043
|
-
}
|
|
4044
|
-
|
|
4045
|
-
var scrollParent = getScrollParent(element);
|
|
4046
|
-
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
4047
|
-
var win = getWindow(scrollParent);
|
|
4048
|
-
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
4049
|
-
var updatedList = list.concat(target);
|
|
4050
|
-
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
|
4051
|
-
updatedList.concat(listScrollParents(getParentNode(target)));
|
|
4052
|
-
}
|
|
4053
|
-
|
|
4054
|
-
function rectToClientRect(rect) {
|
|
4055
|
-
return Object.assign({}, rect, {
|
|
4056
|
-
left: rect.x,
|
|
4057
|
-
top: rect.y,
|
|
4058
|
-
right: rect.x + rect.width,
|
|
4059
|
-
bottom: rect.y + rect.height
|
|
4060
|
-
});
|
|
4061
|
-
}
|
|
4062
|
-
|
|
4063
|
-
function getInnerBoundingClientRect(element) {
|
|
4064
|
-
var rect = getBoundingClientRect(element);
|
|
4065
|
-
rect.top = rect.top + element.clientTop;
|
|
4066
|
-
rect.left = rect.left + element.clientLeft;
|
|
4067
|
-
rect.bottom = rect.top + element.clientHeight;
|
|
4068
|
-
rect.right = rect.left + element.clientWidth;
|
|
4069
|
-
rect.width = element.clientWidth;
|
|
4070
|
-
rect.height = element.clientHeight;
|
|
4071
|
-
rect.x = rect.left;
|
|
4072
|
-
rect.y = rect.top;
|
|
4073
|
-
return rect;
|
|
4074
|
-
}
|
|
4075
|
-
|
|
4076
|
-
function getClientRectFromMixedType(element, clippingParent) {
|
|
4077
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
4078
|
-
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
4079
|
-
// clipping (or hiding) overflowing elements with a position different from
|
|
4080
|
-
// `initial`
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
function getClippingParents(element) {
|
|
4084
|
-
var clippingParents = listScrollParents(getParentNode(element));
|
|
4085
|
-
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
|
4086
|
-
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
4087
|
-
|
|
4088
|
-
if (!isElement(clipperElement)) {
|
|
4089
|
-
return [];
|
|
4090
|
-
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
return clippingParents.filter(function (clippingParent) {
|
|
4094
|
-
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
|
4095
|
-
});
|
|
4096
|
-
} // Gets the maximum area that the element is visible in due to any number of
|
|
4097
|
-
// clipping parents
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
function getClippingRect(element, boundary, rootBoundary) {
|
|
4101
|
-
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
4102
|
-
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
|
4103
|
-
var firstClippingParent = clippingParents[0];
|
|
4104
|
-
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
|
4105
|
-
var rect = getClientRectFromMixedType(element, clippingParent);
|
|
4106
|
-
accRect.top = max(rect.top, accRect.top);
|
|
4107
|
-
accRect.right = min(rect.right, accRect.right);
|
|
4108
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
4109
|
-
accRect.left = max(rect.left, accRect.left);
|
|
4110
|
-
return accRect;
|
|
4111
|
-
}, getClientRectFromMixedType(element, firstClippingParent));
|
|
4112
|
-
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
4113
|
-
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
4114
|
-
clippingRect.x = clippingRect.left;
|
|
4115
|
-
clippingRect.y = clippingRect.top;
|
|
4116
|
-
return clippingRect;
|
|
4117
|
-
}
|
|
4118
|
-
|
|
4119
|
-
function computeOffsets(_ref) {
|
|
4120
|
-
var reference = _ref.reference,
|
|
4121
|
-
element = _ref.element,
|
|
4122
|
-
placement = _ref.placement;
|
|
4123
|
-
var basePlacement = placement ? getBasePlacement(placement) : null;
|
|
4124
|
-
var variation = placement ? getVariation(placement) : null;
|
|
4125
|
-
var commonX = reference.x + reference.width / 2 - element.width / 2;
|
|
4126
|
-
var commonY = reference.y + reference.height / 2 - element.height / 2;
|
|
4127
|
-
var offsets;
|
|
4128
|
-
|
|
4129
|
-
switch (basePlacement) {
|
|
4130
|
-
case top:
|
|
4131
|
-
offsets = {
|
|
4132
|
-
x: commonX,
|
|
4133
|
-
y: reference.y - element.height
|
|
4134
|
-
};
|
|
4135
|
-
break;
|
|
4136
|
-
|
|
4137
|
-
case bottom:
|
|
4138
|
-
offsets = {
|
|
4139
|
-
x: commonX,
|
|
4140
|
-
y: reference.y + reference.height
|
|
4141
|
-
};
|
|
4142
|
-
break;
|
|
4143
|
-
|
|
4144
|
-
case right:
|
|
4145
|
-
offsets = {
|
|
4146
|
-
x: reference.x + reference.width,
|
|
4147
|
-
y: commonY
|
|
4148
|
-
};
|
|
4149
|
-
break;
|
|
4150
|
-
|
|
4151
|
-
case left:
|
|
4152
|
-
offsets = {
|
|
4153
|
-
x: reference.x - element.width,
|
|
4154
|
-
y: commonY
|
|
4155
|
-
};
|
|
4156
|
-
break;
|
|
4157
|
-
|
|
4158
|
-
default:
|
|
4159
|
-
offsets = {
|
|
4160
|
-
x: reference.x,
|
|
4161
|
-
y: reference.y
|
|
4162
|
-
};
|
|
4163
|
-
}
|
|
4164
|
-
|
|
4165
|
-
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
|
4166
|
-
|
|
4167
|
-
if (mainAxis != null) {
|
|
4168
|
-
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
4169
|
-
|
|
4170
|
-
switch (variation) {
|
|
4171
|
-
case start:
|
|
4172
|
-
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
|
4173
|
-
break;
|
|
4174
|
-
|
|
4175
|
-
case end:
|
|
4176
|
-
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
|
4177
|
-
break;
|
|
4178
|
-
}
|
|
4179
|
-
}
|
|
4180
|
-
|
|
4181
|
-
return offsets;
|
|
4182
|
-
}
|
|
4183
|
-
|
|
4184
|
-
function detectOverflow(state, options) {
|
|
4185
|
-
if (options === void 0) {
|
|
4186
|
-
options = {};
|
|
4187
|
-
}
|
|
4188
|
-
|
|
4189
|
-
var _options = options,
|
|
4190
|
-
_options$placement = _options.placement,
|
|
4191
|
-
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
|
4192
|
-
_options$boundary = _options.boundary,
|
|
4193
|
-
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
|
4194
|
-
_options$rootBoundary = _options.rootBoundary,
|
|
4195
|
-
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
|
|
4196
|
-
_options$elementConte = _options.elementContext,
|
|
4197
|
-
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
|
|
4198
|
-
_options$altBoundary = _options.altBoundary,
|
|
4199
|
-
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
|
|
4200
|
-
_options$padding = _options.padding,
|
|
4201
|
-
padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
4202
|
-
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
4203
|
-
var altContext = elementContext === popper ? reference : popper;
|
|
4204
|
-
var popperRect = state.rects.popper;
|
|
4205
|
-
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
4206
|
-
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
|
4207
|
-
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
4208
|
-
var popperOffsets = computeOffsets({
|
|
4209
|
-
reference: referenceClientRect,
|
|
4210
|
-
element: popperRect,
|
|
4211
|
-
strategy: 'absolute',
|
|
4212
|
-
placement: placement
|
|
4213
|
-
});
|
|
4214
|
-
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
|
4215
|
-
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
|
4216
|
-
// 0 or negative = within the clipping rect
|
|
4217
|
-
|
|
4218
|
-
var overflowOffsets = {
|
|
4219
|
-
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
4220
|
-
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
4221
|
-
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
4222
|
-
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
4223
|
-
};
|
|
4224
|
-
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
|
|
4225
|
-
|
|
4226
|
-
if (elementContext === popper && offsetData) {
|
|
4227
|
-
var offset = offsetData[placement];
|
|
4228
|
-
Object.keys(overflowOffsets).forEach(function (key) {
|
|
4229
|
-
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
|
4230
|
-
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
|
4231
|
-
overflowOffsets[key] += offset[axis] * multiply;
|
|
4232
|
-
});
|
|
4233
|
-
}
|
|
4234
|
-
|
|
4235
|
-
return overflowOffsets;
|
|
4236
|
-
}
|
|
4237
|
-
|
|
4238
|
-
function computeAutoPlacement(state, options) {
|
|
4239
|
-
if (options === void 0) {
|
|
4240
|
-
options = {};
|
|
4241
|
-
}
|
|
4242
|
-
|
|
4243
|
-
var _options = options,
|
|
4244
|
-
placement = _options.placement,
|
|
4245
|
-
boundary = _options.boundary,
|
|
4246
|
-
rootBoundary = _options.rootBoundary,
|
|
4247
|
-
padding = _options.padding,
|
|
4248
|
-
flipVariations = _options.flipVariations,
|
|
4249
|
-
_options$allowedAutoP = _options.allowedAutoPlacements,
|
|
4250
|
-
allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
|
4251
|
-
var variation = getVariation(placement);
|
|
4252
|
-
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
|
|
4253
|
-
return getVariation(placement) === variation;
|
|
4254
|
-
}) : basePlacements;
|
|
4255
|
-
var allowedPlacements = placements$1.filter(function (placement) {
|
|
4256
|
-
return allowedAutoPlacements.indexOf(placement) >= 0;
|
|
4257
|
-
});
|
|
4258
|
-
|
|
4259
|
-
if (allowedPlacements.length === 0) {
|
|
4260
|
-
allowedPlacements = placements$1;
|
|
4261
|
-
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
var overflows = allowedPlacements.reduce(function (acc, placement) {
|
|
4265
|
-
acc[placement] = detectOverflow(state, {
|
|
4266
|
-
placement: placement,
|
|
4267
|
-
boundary: boundary,
|
|
4268
|
-
rootBoundary: rootBoundary,
|
|
4269
|
-
padding: padding
|
|
4270
|
-
})[getBasePlacement(placement)];
|
|
4271
|
-
return acc;
|
|
4272
|
-
}, {});
|
|
4273
|
-
return Object.keys(overflows).sort(function (a, b) {
|
|
4274
|
-
return overflows[a] - overflows[b];
|
|
4275
|
-
});
|
|
4276
|
-
}
|
|
4277
|
-
|
|
4278
|
-
function getExpandedFallbackPlacements(placement) {
|
|
4279
|
-
if (getBasePlacement(placement) === auto) {
|
|
4280
|
-
return [];
|
|
4281
|
-
}
|
|
4282
|
-
|
|
4283
|
-
var oppositePlacement = getOppositePlacement(placement);
|
|
4284
|
-
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
4285
|
-
}
|
|
4286
|
-
|
|
4287
|
-
function flip(_ref) {
|
|
4288
|
-
var state = _ref.state,
|
|
4289
|
-
options = _ref.options,
|
|
4290
|
-
name = _ref.name;
|
|
4291
|
-
|
|
4292
|
-
if (state.modifiersData[name]._skip) {
|
|
4293
|
-
return;
|
|
4294
|
-
}
|
|
4295
|
-
|
|
4296
|
-
var _options$mainAxis = options.mainAxis,
|
|
4297
|
-
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
4298
|
-
_options$altAxis = options.altAxis,
|
|
4299
|
-
checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
|
|
4300
|
-
specifiedFallbackPlacements = options.fallbackPlacements,
|
|
4301
|
-
padding = options.padding,
|
|
4302
|
-
boundary = options.boundary,
|
|
4303
|
-
rootBoundary = options.rootBoundary,
|
|
4304
|
-
altBoundary = options.altBoundary,
|
|
4305
|
-
_options$flipVariatio = options.flipVariations,
|
|
4306
|
-
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
|
|
4307
|
-
allowedAutoPlacements = options.allowedAutoPlacements;
|
|
4308
|
-
var preferredPlacement = state.options.placement;
|
|
4309
|
-
var basePlacement = getBasePlacement(preferredPlacement);
|
|
4310
|
-
var isBasePlacement = basePlacement === preferredPlacement;
|
|
4311
|
-
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
4312
|
-
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
|
|
4313
|
-
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
|
|
4314
|
-
placement: placement,
|
|
4315
|
-
boundary: boundary,
|
|
4316
|
-
rootBoundary: rootBoundary,
|
|
4317
|
-
padding: padding,
|
|
4318
|
-
flipVariations: flipVariations,
|
|
4319
|
-
allowedAutoPlacements: allowedAutoPlacements
|
|
4320
|
-
}) : placement);
|
|
4321
|
-
}, []);
|
|
4322
|
-
var referenceRect = state.rects.reference;
|
|
4323
|
-
var popperRect = state.rects.popper;
|
|
4324
|
-
var checksMap = new Map();
|
|
4325
|
-
var makeFallbackChecks = true;
|
|
4326
|
-
var firstFittingPlacement = placements[0];
|
|
4327
|
-
|
|
4328
|
-
for (var i = 0; i < placements.length; i++) {
|
|
4329
|
-
var placement = placements[i];
|
|
4330
|
-
|
|
4331
|
-
var _basePlacement = getBasePlacement(placement);
|
|
4332
|
-
|
|
4333
|
-
var isStartVariation = getVariation(placement) === start;
|
|
4334
|
-
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
4335
|
-
var len = isVertical ? 'width' : 'height';
|
|
4336
|
-
var overflow = detectOverflow(state, {
|
|
4337
|
-
placement: placement,
|
|
4338
|
-
boundary: boundary,
|
|
4339
|
-
rootBoundary: rootBoundary,
|
|
4340
|
-
altBoundary: altBoundary,
|
|
4341
|
-
padding: padding
|
|
4342
|
-
});
|
|
4343
|
-
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
4344
|
-
|
|
4345
|
-
if (referenceRect[len] > popperRect[len]) {
|
|
4346
|
-
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
4347
|
-
}
|
|
4348
|
-
|
|
4349
|
-
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
4350
|
-
var checks = [];
|
|
4351
|
-
|
|
4352
|
-
if (checkMainAxis) {
|
|
4353
|
-
checks.push(overflow[_basePlacement] <= 0);
|
|
4354
|
-
}
|
|
4355
|
-
|
|
4356
|
-
if (checkAltAxis) {
|
|
4357
|
-
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
|
4358
|
-
}
|
|
4359
|
-
|
|
4360
|
-
if (checks.every(function (check) {
|
|
4361
|
-
return check;
|
|
4362
|
-
})) {
|
|
4363
|
-
firstFittingPlacement = placement;
|
|
4364
|
-
makeFallbackChecks = false;
|
|
4365
|
-
break;
|
|
4366
|
-
}
|
|
4367
|
-
|
|
4368
|
-
checksMap.set(placement, checks);
|
|
4369
|
-
}
|
|
4370
|
-
|
|
4371
|
-
if (makeFallbackChecks) {
|
|
4372
|
-
// `2` may be desired in some cases – research later
|
|
4373
|
-
var numberOfChecks = flipVariations ? 3 : 1;
|
|
4374
|
-
|
|
4375
|
-
var _loop = function _loop(_i) {
|
|
4376
|
-
var fittingPlacement = placements.find(function (placement) {
|
|
4377
|
-
var checks = checksMap.get(placement);
|
|
4378
|
-
|
|
4379
|
-
if (checks) {
|
|
4380
|
-
return checks.slice(0, _i).every(function (check) {
|
|
4381
|
-
return check;
|
|
4382
|
-
});
|
|
4383
|
-
}
|
|
4384
|
-
});
|
|
4385
|
-
|
|
4386
|
-
if (fittingPlacement) {
|
|
4387
|
-
firstFittingPlacement = fittingPlacement;
|
|
4388
|
-
return "break";
|
|
4389
|
-
}
|
|
4390
|
-
};
|
|
4391
|
-
|
|
4392
|
-
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
4393
|
-
var _ret = _loop(_i);
|
|
4394
|
-
|
|
4395
|
-
if (_ret === "break") break;
|
|
4396
|
-
}
|
|
4397
|
-
}
|
|
4398
|
-
|
|
4399
|
-
if (state.placement !== firstFittingPlacement) {
|
|
4400
|
-
state.modifiersData[name]._skip = true;
|
|
4401
|
-
state.placement = firstFittingPlacement;
|
|
4402
|
-
state.reset = true;
|
|
4403
|
-
}
|
|
4404
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
const flip$1 = {
|
|
4408
|
-
name: 'flip',
|
|
4409
|
-
enabled: true,
|
|
4410
|
-
phase: 'main',
|
|
4411
|
-
fn: flip,
|
|
4412
|
-
requiresIfExists: ['offset'],
|
|
4413
|
-
data: {
|
|
4414
|
-
_skip: false
|
|
4415
|
-
}
|
|
4416
|
-
};
|
|
4417
|
-
|
|
4418
|
-
function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
4419
|
-
if (preventedOffsets === void 0) {
|
|
4420
|
-
preventedOffsets = {
|
|
4421
|
-
x: 0,
|
|
4422
|
-
y: 0
|
|
4423
|
-
};
|
|
4424
|
-
}
|
|
4425
|
-
|
|
4426
|
-
return {
|
|
4427
|
-
top: overflow.top - rect.height - preventedOffsets.y,
|
|
4428
|
-
right: overflow.right - rect.width + preventedOffsets.x,
|
|
4429
|
-
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
|
4430
|
-
left: overflow.left - rect.width - preventedOffsets.x
|
|
4431
|
-
};
|
|
4432
|
-
}
|
|
4433
|
-
|
|
4434
|
-
function isAnySideFullyClipped(overflow) {
|
|
4435
|
-
return [top, right, bottom, left].some(function (side) {
|
|
4436
|
-
return overflow[side] >= 0;
|
|
4437
|
-
});
|
|
4438
|
-
}
|
|
4439
|
-
|
|
4440
|
-
function hide(_ref) {
|
|
4441
|
-
var state = _ref.state,
|
|
4442
|
-
name = _ref.name;
|
|
4443
|
-
var referenceRect = state.rects.reference;
|
|
4444
|
-
var popperRect = state.rects.popper;
|
|
4445
|
-
var preventedOffsets = state.modifiersData.preventOverflow;
|
|
4446
|
-
var referenceOverflow = detectOverflow(state, {
|
|
4447
|
-
elementContext: 'reference'
|
|
4448
|
-
});
|
|
4449
|
-
var popperAltOverflow = detectOverflow(state, {
|
|
4450
|
-
altBoundary: true
|
|
4451
|
-
});
|
|
4452
|
-
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
4453
|
-
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
4454
|
-
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
4455
|
-
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
4456
|
-
state.modifiersData[name] = {
|
|
4457
|
-
referenceClippingOffsets: referenceClippingOffsets,
|
|
4458
|
-
popperEscapeOffsets: popperEscapeOffsets,
|
|
4459
|
-
isReferenceHidden: isReferenceHidden,
|
|
4460
|
-
hasPopperEscaped: hasPopperEscaped
|
|
4461
|
-
};
|
|
4462
|
-
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
4463
|
-
'data-popper-reference-hidden': isReferenceHidden,
|
|
4464
|
-
'data-popper-escaped': hasPopperEscaped
|
|
4465
|
-
});
|
|
4466
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
const hide$1 = {
|
|
4470
|
-
name: 'hide',
|
|
4471
|
-
enabled: true,
|
|
4472
|
-
phase: 'main',
|
|
4473
|
-
requiresIfExists: ['preventOverflow'],
|
|
4474
|
-
fn: hide
|
|
4475
|
-
};
|
|
4476
|
-
|
|
4477
|
-
function distanceAndSkiddingToXY(placement, rects, offset) {
|
|
4478
|
-
var basePlacement = getBasePlacement(placement);
|
|
4479
|
-
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
4480
|
-
|
|
4481
|
-
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
|
4482
|
-
placement: placement
|
|
4483
|
-
})) : offset,
|
|
4484
|
-
skidding = _ref[0],
|
|
4485
|
-
distance = _ref[1];
|
|
4486
|
-
|
|
4487
|
-
skidding = skidding || 0;
|
|
4488
|
-
distance = (distance || 0) * invertDistance;
|
|
4489
|
-
return [left, right].indexOf(basePlacement) >= 0 ? {
|
|
4490
|
-
x: distance,
|
|
4491
|
-
y: skidding
|
|
4492
|
-
} : {
|
|
4493
|
-
x: skidding,
|
|
4494
|
-
y: distance
|
|
4495
|
-
};
|
|
4496
|
-
}
|
|
4497
|
-
|
|
4498
|
-
function offset(_ref2) {
|
|
4499
|
-
var state = _ref2.state,
|
|
4500
|
-
options = _ref2.options,
|
|
4501
|
-
name = _ref2.name;
|
|
4502
|
-
var _options$offset = options.offset,
|
|
4503
|
-
offset = _options$offset === void 0 ? [0, 0] : _options$offset;
|
|
4504
|
-
var data = placements.reduce(function (acc, placement) {
|
|
4505
|
-
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
|
|
4506
|
-
return acc;
|
|
4507
|
-
}, {});
|
|
4508
|
-
var _data$state$placement = data[state.placement],
|
|
4509
|
-
x = _data$state$placement.x,
|
|
4510
|
-
y = _data$state$placement.y;
|
|
4511
|
-
|
|
4512
|
-
if (state.modifiersData.popperOffsets != null) {
|
|
4513
|
-
state.modifiersData.popperOffsets.x += x;
|
|
4514
|
-
state.modifiersData.popperOffsets.y += y;
|
|
4515
|
-
}
|
|
4516
|
-
|
|
4517
|
-
state.modifiersData[name] = data;
|
|
4518
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
const offset$1 = {
|
|
4522
|
-
name: 'offset',
|
|
4523
|
-
enabled: true,
|
|
4524
|
-
phase: 'main',
|
|
4525
|
-
requires: ['popperOffsets'],
|
|
4526
|
-
fn: offset
|
|
4527
|
-
};
|
|
4528
|
-
|
|
4529
|
-
function popperOffsets(_ref) {
|
|
4530
|
-
var state = _ref.state,
|
|
4531
|
-
name = _ref.name;
|
|
4532
|
-
// Offsets are the actual position the popper needs to have to be
|
|
4533
|
-
// properly positioned near its reference element
|
|
4534
|
-
// This is the most basic placement, and will be adjusted by
|
|
4535
|
-
// the modifiers in the next step
|
|
4536
|
-
state.modifiersData[name] = computeOffsets({
|
|
4537
|
-
reference: state.rects.reference,
|
|
4538
|
-
element: state.rects.popper,
|
|
4539
|
-
strategy: 'absolute',
|
|
4540
|
-
placement: state.placement
|
|
4541
|
-
});
|
|
4542
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
const popperOffsets$1 = {
|
|
4546
|
-
name: 'popperOffsets',
|
|
4547
|
-
enabled: true,
|
|
4548
|
-
phase: 'read',
|
|
4549
|
-
fn: popperOffsets,
|
|
4550
|
-
data: {}
|
|
4551
|
-
};
|
|
4552
|
-
|
|
4553
|
-
function getAltAxis(axis) {
|
|
4554
|
-
return axis === 'x' ? 'y' : 'x';
|
|
4555
|
-
}
|
|
4556
|
-
|
|
4557
|
-
function preventOverflow(_ref) {
|
|
4558
|
-
var state = _ref.state,
|
|
4559
|
-
options = _ref.options,
|
|
4560
|
-
name = _ref.name;
|
|
4561
|
-
var _options$mainAxis = options.mainAxis,
|
|
4562
|
-
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
4563
|
-
_options$altAxis = options.altAxis,
|
|
4564
|
-
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
|
|
4565
|
-
boundary = options.boundary,
|
|
4566
|
-
rootBoundary = options.rootBoundary,
|
|
4567
|
-
altBoundary = options.altBoundary,
|
|
4568
|
-
padding = options.padding,
|
|
4569
|
-
_options$tether = options.tether,
|
|
4570
|
-
tether = _options$tether === void 0 ? true : _options$tether,
|
|
4571
|
-
_options$tetherOffset = options.tetherOffset,
|
|
4572
|
-
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
4573
|
-
var overflow = detectOverflow(state, {
|
|
4574
|
-
boundary: boundary,
|
|
4575
|
-
rootBoundary: rootBoundary,
|
|
4576
|
-
padding: padding,
|
|
4577
|
-
altBoundary: altBoundary
|
|
4578
|
-
});
|
|
4579
|
-
var basePlacement = getBasePlacement(state.placement);
|
|
4580
|
-
var variation = getVariation(state.placement);
|
|
4581
|
-
var isBasePlacement = !variation;
|
|
4582
|
-
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
|
4583
|
-
var altAxis = getAltAxis(mainAxis);
|
|
4584
|
-
var popperOffsets = state.modifiersData.popperOffsets;
|
|
4585
|
-
var referenceRect = state.rects.reference;
|
|
4586
|
-
var popperRect = state.rects.popper;
|
|
4587
|
-
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
|
4588
|
-
placement: state.placement
|
|
4589
|
-
})) : tetherOffset;
|
|
4590
|
-
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
|
4591
|
-
mainAxis: tetherOffsetValue,
|
|
4592
|
-
altAxis: tetherOffsetValue
|
|
4593
|
-
} : Object.assign({
|
|
4594
|
-
mainAxis: 0,
|
|
4595
|
-
altAxis: 0
|
|
4596
|
-
}, tetherOffsetValue);
|
|
4597
|
-
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
|
4598
|
-
var data = {
|
|
4599
|
-
x: 0,
|
|
4600
|
-
y: 0
|
|
4601
|
-
};
|
|
4602
|
-
|
|
4603
|
-
if (!popperOffsets) {
|
|
4604
|
-
return;
|
|
4605
|
-
}
|
|
4606
|
-
|
|
4607
|
-
if (checkMainAxis) {
|
|
4608
|
-
var _offsetModifierState$;
|
|
4609
|
-
|
|
4610
|
-
var mainSide = mainAxis === 'y' ? top : left;
|
|
4611
|
-
var altSide = mainAxis === 'y' ? bottom : right;
|
|
4612
|
-
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
4613
|
-
var offset = popperOffsets[mainAxis];
|
|
4614
|
-
var min$1 = offset + overflow[mainSide];
|
|
4615
|
-
var max$1 = offset - overflow[altSide];
|
|
4616
|
-
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
4617
|
-
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
4618
|
-
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
|
4619
|
-
// outside the reference bounds
|
|
4620
|
-
|
|
4621
|
-
var arrowElement = state.elements.arrow;
|
|
4622
|
-
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
|
4623
|
-
width: 0,
|
|
4624
|
-
height: 0
|
|
4625
|
-
};
|
|
4626
|
-
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
|
|
4627
|
-
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
4628
|
-
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
|
|
4629
|
-
// to include its full size in the calculation. If the reference is small
|
|
4630
|
-
// and near the edge of a boundary, the popper can overflow even if the
|
|
4631
|
-
// reference is not overflowing as well (e.g. virtual elements with no
|
|
4632
|
-
// width or height)
|
|
4633
|
-
|
|
4634
|
-
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
4635
|
-
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
4636
|
-
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
4637
|
-
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
4638
|
-
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
4639
|
-
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
4640
|
-
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
|
4641
|
-
var tetherMax = offset + maxOffset - offsetModifierValue;
|
|
4642
|
-
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
|
4643
|
-
popperOffsets[mainAxis] = preventedOffset;
|
|
4644
|
-
data[mainAxis] = preventedOffset - offset;
|
|
4645
|
-
}
|
|
4646
|
-
|
|
4647
|
-
if (checkAltAxis) {
|
|
4648
|
-
var _offsetModifierState$2;
|
|
4649
|
-
|
|
4650
|
-
var _mainSide = mainAxis === 'x' ? top : left;
|
|
4651
|
-
|
|
4652
|
-
var _altSide = mainAxis === 'x' ? bottom : right;
|
|
4653
|
-
|
|
4654
|
-
var _offset = popperOffsets[altAxis];
|
|
4655
|
-
|
|
4656
|
-
var _len = altAxis === 'y' ? 'height' : 'width';
|
|
4657
|
-
|
|
4658
|
-
var _min = _offset + overflow[_mainSide];
|
|
4659
|
-
|
|
4660
|
-
var _max = _offset - overflow[_altSide];
|
|
4661
|
-
|
|
4662
|
-
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
|
4663
|
-
|
|
4664
|
-
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
|
4665
|
-
|
|
4666
|
-
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
|
4667
|
-
|
|
4668
|
-
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
|
4669
|
-
|
|
4670
|
-
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
|
4671
|
-
|
|
4672
|
-
popperOffsets[altAxis] = _preventedOffset;
|
|
4673
|
-
data[altAxis] = _preventedOffset - _offset;
|
|
4674
|
-
}
|
|
4675
|
-
|
|
4676
|
-
state.modifiersData[name] = data;
|
|
4677
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
const preventOverflow$1 = {
|
|
4681
|
-
name: 'preventOverflow',
|
|
4682
|
-
enabled: true,
|
|
4683
|
-
phase: 'main',
|
|
4684
|
-
fn: preventOverflow,
|
|
4685
|
-
requiresIfExists: ['offset']
|
|
4686
|
-
};
|
|
4687
|
-
|
|
4688
|
-
function getHTMLElementScroll(element) {
|
|
4689
|
-
return {
|
|
4690
|
-
scrollLeft: element.scrollLeft,
|
|
4691
|
-
scrollTop: element.scrollTop
|
|
4692
|
-
};
|
|
4693
|
-
}
|
|
4694
|
-
|
|
4695
|
-
function getNodeScroll(node) {
|
|
4696
|
-
if (node === getWindow(node) || !isHTMLElement(node)) {
|
|
4697
|
-
return getWindowScroll(node);
|
|
4698
|
-
} else {
|
|
4699
|
-
return getHTMLElementScroll(node);
|
|
4700
|
-
}
|
|
4701
|
-
}
|
|
4702
|
-
|
|
4703
|
-
function isElementScaled(element) {
|
|
4704
|
-
var rect = element.getBoundingClientRect();
|
|
4705
|
-
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
4706
|
-
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
4707
|
-
return scaleX !== 1 || scaleY !== 1;
|
|
4708
|
-
} // Returns the composite rect of an element relative to its offsetParent.
|
|
4709
|
-
// Composite means it takes into account transforms as well as layout.
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
4713
|
-
if (isFixed === void 0) {
|
|
4714
|
-
isFixed = false;
|
|
4715
|
-
}
|
|
4716
|
-
|
|
4717
|
-
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
4718
|
-
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
4719
|
-
var documentElement = getDocumentElement(offsetParent);
|
|
4720
|
-
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
|
4721
|
-
var scroll = {
|
|
4722
|
-
scrollLeft: 0,
|
|
4723
|
-
scrollTop: 0
|
|
4724
|
-
};
|
|
4725
|
-
var offsets = {
|
|
4726
|
-
x: 0,
|
|
4727
|
-
y: 0
|
|
4728
|
-
};
|
|
4729
|
-
|
|
4730
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
4731
|
-
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
|
4732
|
-
isScrollParent(documentElement)) {
|
|
4733
|
-
scroll = getNodeScroll(offsetParent);
|
|
4734
|
-
}
|
|
4735
|
-
|
|
4736
|
-
if (isHTMLElement(offsetParent)) {
|
|
4737
|
-
offsets = getBoundingClientRect(offsetParent, true);
|
|
4738
|
-
offsets.x += offsetParent.clientLeft;
|
|
4739
|
-
offsets.y += offsetParent.clientTop;
|
|
4740
|
-
} else if (documentElement) {
|
|
4741
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
4742
|
-
}
|
|
4743
|
-
}
|
|
4744
|
-
|
|
4745
|
-
return {
|
|
4746
|
-
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
4747
|
-
y: rect.top + scroll.scrollTop - offsets.y,
|
|
4748
|
-
width: rect.width,
|
|
4749
|
-
height: rect.height
|
|
4750
|
-
};
|
|
4751
|
-
}
|
|
4752
|
-
|
|
4753
|
-
function order(modifiers) {
|
|
4754
|
-
var map = new Map();
|
|
4755
|
-
var visited = new Set();
|
|
4756
|
-
var result = [];
|
|
4757
|
-
modifiers.forEach(function (modifier) {
|
|
4758
|
-
map.set(modifier.name, modifier);
|
|
4759
|
-
}); // On visiting object, check for its dependencies and visit them recursively
|
|
4760
|
-
|
|
4761
|
-
function sort(modifier) {
|
|
4762
|
-
visited.add(modifier.name);
|
|
4763
|
-
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
|
4764
|
-
requires.forEach(function (dep) {
|
|
4765
|
-
if (!visited.has(dep)) {
|
|
4766
|
-
var depModifier = map.get(dep);
|
|
4767
|
-
|
|
4768
|
-
if (depModifier) {
|
|
4769
|
-
sort(depModifier);
|
|
4770
|
-
}
|
|
4771
|
-
}
|
|
4772
|
-
});
|
|
4773
|
-
result.push(modifier);
|
|
4774
|
-
}
|
|
4775
|
-
|
|
4776
|
-
modifiers.forEach(function (modifier) {
|
|
4777
|
-
if (!visited.has(modifier.name)) {
|
|
4778
|
-
// check for visited object
|
|
4779
|
-
sort(modifier);
|
|
4780
|
-
}
|
|
4781
|
-
});
|
|
4782
|
-
return result;
|
|
4783
|
-
}
|
|
4784
|
-
|
|
4785
|
-
function orderModifiers(modifiers) {
|
|
4786
|
-
// order based on dependencies
|
|
4787
|
-
var orderedModifiers = order(modifiers); // order based on phase
|
|
4788
|
-
|
|
4789
|
-
return modifierPhases.reduce(function (acc, phase) {
|
|
4790
|
-
return acc.concat(orderedModifiers.filter(function (modifier) {
|
|
4791
|
-
return modifier.phase === phase;
|
|
4792
|
-
}));
|
|
4793
|
-
}, []);
|
|
4794
|
-
}
|
|
4795
|
-
|
|
4796
|
-
function debounce(fn) {
|
|
4797
|
-
var pending;
|
|
4798
|
-
return function () {
|
|
4799
|
-
if (!pending) {
|
|
4800
|
-
pending = new Promise(function (resolve) {
|
|
4801
|
-
Promise.resolve().then(function () {
|
|
4802
|
-
pending = undefined;
|
|
4803
|
-
resolve(fn());
|
|
4804
|
-
});
|
|
4805
|
-
});
|
|
4806
|
-
}
|
|
4807
|
-
|
|
4808
|
-
return pending;
|
|
4809
|
-
};
|
|
4810
|
-
}
|
|
4811
|
-
|
|
4812
|
-
function mergeByName(modifiers) {
|
|
4813
|
-
var merged = modifiers.reduce(function (merged, current) {
|
|
4814
|
-
var existing = merged[current.name];
|
|
4815
|
-
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
|
4816
|
-
options: Object.assign({}, existing.options, current.options),
|
|
4817
|
-
data: Object.assign({}, existing.data, current.data)
|
|
4818
|
-
}) : current;
|
|
4819
|
-
return merged;
|
|
4820
|
-
}, {}); // IE11 does not support Object.values
|
|
4821
|
-
|
|
4822
|
-
return Object.keys(merged).map(function (key) {
|
|
4823
|
-
return merged[key];
|
|
4824
|
-
});
|
|
4825
|
-
}
|
|
4826
|
-
|
|
4827
|
-
var DEFAULT_OPTIONS = {
|
|
4828
|
-
placement: 'bottom',
|
|
4829
|
-
modifiers: [],
|
|
4830
|
-
strategy: 'absolute'
|
|
4831
|
-
};
|
|
4832
|
-
|
|
4833
|
-
function areValidElements() {
|
|
4834
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4835
|
-
args[_key] = arguments[_key];
|
|
4836
|
-
}
|
|
4837
|
-
|
|
4838
|
-
return !args.some(function (element) {
|
|
4839
|
-
return !(element && typeof element.getBoundingClientRect === 'function');
|
|
4840
|
-
});
|
|
4841
|
-
}
|
|
4842
|
-
|
|
4843
|
-
function popperGenerator(generatorOptions) {
|
|
4844
|
-
if (generatorOptions === void 0) {
|
|
4845
|
-
generatorOptions = {};
|
|
4846
|
-
}
|
|
4847
|
-
|
|
4848
|
-
var _generatorOptions = generatorOptions,
|
|
4849
|
-
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
|
4850
|
-
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
|
4851
|
-
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
|
4852
|
-
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
|
4853
|
-
return function createPopper(reference, popper, options) {
|
|
4854
|
-
if (options === void 0) {
|
|
4855
|
-
options = defaultOptions;
|
|
4856
|
-
}
|
|
4857
|
-
|
|
4858
|
-
var state = {
|
|
4859
|
-
placement: 'bottom',
|
|
4860
|
-
orderedModifiers: [],
|
|
4861
|
-
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
|
4862
|
-
modifiersData: {},
|
|
4863
|
-
elements: {
|
|
4864
|
-
reference: reference,
|
|
4865
|
-
popper: popper
|
|
4866
|
-
},
|
|
4867
|
-
attributes: {},
|
|
4868
|
-
styles: {}
|
|
4869
|
-
};
|
|
4870
|
-
var effectCleanupFns = [];
|
|
4871
|
-
var isDestroyed = false;
|
|
4872
|
-
var instance = {
|
|
4873
|
-
state: state,
|
|
4874
|
-
setOptions: function setOptions(setOptionsAction) {
|
|
4875
|
-
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
|
4876
|
-
cleanupModifierEffects();
|
|
4877
|
-
state.options = Object.assign({}, defaultOptions, state.options, options);
|
|
4878
|
-
state.scrollParents = {
|
|
4879
|
-
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
|
4880
|
-
popper: listScrollParents(popper)
|
|
4881
|
-
}; // Orders the modifiers based on their dependencies and `phase`
|
|
4882
|
-
// properties
|
|
4883
|
-
|
|
4884
|
-
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
|
4885
|
-
|
|
4886
|
-
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
|
4887
|
-
return m.enabled;
|
|
4888
|
-
}); // Validate the provided modifiers so that the consumer will get warned
|
|
4889
|
-
|
|
4890
|
-
runModifierEffects();
|
|
4891
|
-
return instance.update();
|
|
4892
|
-
},
|
|
4893
|
-
// Sync update – it will always be executed, even if not necessary. This
|
|
4894
|
-
// is useful for low frequency updates where sync behavior simplifies the
|
|
4895
|
-
// logic.
|
|
4896
|
-
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
|
4897
|
-
// prefer the async Popper#update method
|
|
4898
|
-
forceUpdate: function forceUpdate() {
|
|
4899
|
-
if (isDestroyed) {
|
|
4900
|
-
return;
|
|
4901
|
-
}
|
|
4902
|
-
|
|
4903
|
-
var _state$elements = state.elements,
|
|
4904
|
-
reference = _state$elements.reference,
|
|
4905
|
-
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
|
4906
|
-
// anymore
|
|
4907
|
-
|
|
4908
|
-
if (!areValidElements(reference, popper)) {
|
|
4909
|
-
|
|
4910
|
-
return;
|
|
4911
|
-
} // Store the reference and popper rects to be read by modifiers
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
state.rects = {
|
|
4915
|
-
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
|
4916
|
-
popper: getLayoutRect(popper)
|
|
4917
|
-
}; // Modifiers have the ability to reset the current update cycle. The
|
|
4918
|
-
// most common use case for this is the `flip` modifier changing the
|
|
4919
|
-
// placement, which then needs to re-run all the modifiers, because the
|
|
4920
|
-
// logic was previously ran for the previous placement and is therefore
|
|
4921
|
-
// stale/incorrect
|
|
4922
|
-
|
|
4923
|
-
state.reset = false;
|
|
4924
|
-
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
|
4925
|
-
// is filled with the initial data specified by the modifier. This means
|
|
4926
|
-
// it doesn't persist and is fresh on each update.
|
|
4927
|
-
// To ensure persistent data, use `${name}#persistent`
|
|
4928
|
-
|
|
4929
|
-
state.orderedModifiers.forEach(function (modifier) {
|
|
4930
|
-
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
4931
|
-
});
|
|
4932
|
-
|
|
4933
|
-
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
|
4934
|
-
|
|
4935
|
-
if (state.reset === true) {
|
|
4936
|
-
state.reset = false;
|
|
4937
|
-
index = -1;
|
|
4938
|
-
continue;
|
|
4939
|
-
}
|
|
4940
|
-
|
|
4941
|
-
var _state$orderedModifie = state.orderedModifiers[index],
|
|
4942
|
-
fn = _state$orderedModifie.fn,
|
|
4943
|
-
_state$orderedModifie2 = _state$orderedModifie.options,
|
|
4944
|
-
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
|
4945
|
-
name = _state$orderedModifie.name;
|
|
4946
|
-
|
|
4947
|
-
if (typeof fn === 'function') {
|
|
4948
|
-
state = fn({
|
|
4949
|
-
state: state,
|
|
4950
|
-
options: _options,
|
|
4951
|
-
name: name,
|
|
4952
|
-
instance: instance
|
|
4953
|
-
}) || state;
|
|
4954
|
-
}
|
|
4955
|
-
}
|
|
4956
|
-
},
|
|
4957
|
-
// Async and optimistically optimized update – it will not be executed if
|
|
4958
|
-
// not necessary (debounced to run at most once-per-tick)
|
|
4959
|
-
update: debounce(function () {
|
|
4960
|
-
return new Promise(function (resolve) {
|
|
4961
|
-
instance.forceUpdate();
|
|
4962
|
-
resolve(state);
|
|
4963
|
-
});
|
|
4964
|
-
}),
|
|
4965
|
-
destroy: function destroy() {
|
|
4966
|
-
cleanupModifierEffects();
|
|
4967
|
-
isDestroyed = true;
|
|
4968
|
-
}
|
|
4969
|
-
};
|
|
4970
|
-
|
|
4971
|
-
if (!areValidElements(reference, popper)) {
|
|
4972
|
-
|
|
4973
|
-
return instance;
|
|
4974
|
-
}
|
|
4975
|
-
|
|
4976
|
-
instance.setOptions(options).then(function (state) {
|
|
4977
|
-
if (!isDestroyed && options.onFirstUpdate) {
|
|
4978
|
-
options.onFirstUpdate(state);
|
|
4979
|
-
}
|
|
4980
|
-
}); // Modifiers have the ability to execute arbitrary code before the first
|
|
4981
|
-
// update cycle runs. They will be executed in the same order as the update
|
|
4982
|
-
// cycle. This is useful when a modifier adds some persistent data that
|
|
4983
|
-
// other modifiers need to use, but the modifier is run after the dependent
|
|
4984
|
-
// one.
|
|
4985
|
-
|
|
4986
|
-
function runModifierEffects() {
|
|
4987
|
-
state.orderedModifiers.forEach(function (_ref3) {
|
|
4988
|
-
var name = _ref3.name,
|
|
4989
|
-
_ref3$options = _ref3.options,
|
|
4990
|
-
options = _ref3$options === void 0 ? {} : _ref3$options,
|
|
4991
|
-
effect = _ref3.effect;
|
|
4992
|
-
|
|
4993
|
-
if (typeof effect === 'function') {
|
|
4994
|
-
var cleanupFn = effect({
|
|
4995
|
-
state: state,
|
|
4996
|
-
name: name,
|
|
4997
|
-
instance: instance,
|
|
4998
|
-
options: options
|
|
4999
|
-
});
|
|
5000
|
-
|
|
5001
|
-
var noopFn = function noopFn() {};
|
|
5002
|
-
|
|
5003
|
-
effectCleanupFns.push(cleanupFn || noopFn);
|
|
5004
|
-
}
|
|
5005
|
-
});
|
|
5006
|
-
}
|
|
5007
|
-
|
|
5008
|
-
function cleanupModifierEffects() {
|
|
5009
|
-
effectCleanupFns.forEach(function (fn) {
|
|
5010
|
-
return fn();
|
|
5011
|
-
});
|
|
5012
|
-
effectCleanupFns = [];
|
|
5013
|
-
}
|
|
5014
|
-
|
|
5015
|
-
return instance;
|
|
5016
|
-
};
|
|
5017
|
-
}
|
|
5018
|
-
|
|
5019
|
-
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
|
5020
|
-
var createPopper = /*#__PURE__*/popperGenerator({
|
|
5021
|
-
defaultModifiers: defaultModifiers
|
|
5022
|
-
}); // eslint-disable-next-line import/no-unused-modules
|
|
5023
|
-
|
|
5024
|
-
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.sc-mg-popover .mg-popover__arrow.sc-mg-popover,.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover{visibility:hidden}.mg-popover.sc-mg-popover .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}";
|
|
5025
|
-
|
|
5026
|
-
const MgPopover = class {
|
|
5027
|
-
constructor(hostRef) {
|
|
5028
|
-
registerInstance(this, hostRef);
|
|
5029
|
-
this.displayChange = createEvent(this, "display-change", 7);
|
|
5030
|
-
this.closeButtonId = '';
|
|
5031
|
-
/**
|
|
5032
|
-
* Sets an `id` attribute.
|
|
5033
|
-
* Needed by the input for accessibility `aria-decribedby`.
|
|
5034
|
-
*/
|
|
5035
|
-
this.identifier = createID('mg-popover');
|
|
5036
|
-
/**
|
|
5037
|
-
* Popover placement
|
|
5038
|
-
*/
|
|
5039
|
-
this.placement = 'bottom';
|
|
5040
|
-
/**
|
|
5041
|
-
* Define if popover has a cross button
|
|
5042
|
-
*/
|
|
5043
|
-
this.closeButton = false;
|
|
5044
|
-
/**
|
|
5045
|
-
* Display popover
|
|
5046
|
-
*/
|
|
5047
|
-
this.display = false;
|
|
5048
|
-
/**
|
|
5049
|
-
* Disable popover
|
|
5050
|
-
*/
|
|
5051
|
-
this.disabled = false;
|
|
5052
|
-
/**
|
|
5053
|
-
* Check if clicked outside of component
|
|
5054
|
-
*
|
|
5055
|
-
* @param {MouseEvent} event mouse event
|
|
5056
|
-
* @returns {void}
|
|
5057
|
-
*/
|
|
5058
|
-
this.clickOutside = (event) => {
|
|
5059
|
-
var _a;
|
|
5060
|
-
if (!this.disabled && ((_a = event.target.closest(`#${this.identifier}`)) === null || _a === void 0 ? void 0 : _a.parentElement.nodeName) !== 'MG-POPOVER') {
|
|
5061
|
-
this.display = false;
|
|
5062
|
-
}
|
|
5063
|
-
};
|
|
5064
|
-
/**
|
|
5065
|
-
* Show popover
|
|
5066
|
-
*
|
|
5067
|
-
* @returns {void}
|
|
5068
|
-
*/
|
|
5069
|
-
this.show = () => {
|
|
5070
|
-
// Make the popover visible
|
|
5071
|
-
this.popover.setAttribute('data-show', '');
|
|
5072
|
-
// Enable the event listeners
|
|
5073
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
5074
|
-
// Update its position
|
|
5075
|
-
this.popper.update();
|
|
5076
|
-
// hide when click outside
|
|
5077
|
-
// setTimeout is used to prevent event to trigger after creation
|
|
5078
|
-
setTimeout(() => {
|
|
5079
|
-
document.addEventListener('click', this.clickOutside, false);
|
|
5080
|
-
}, 0);
|
|
5081
|
-
};
|
|
5082
|
-
/**
|
|
5083
|
-
* Hide popover
|
|
5084
|
-
*
|
|
5085
|
-
* @returns {void}
|
|
5086
|
-
*/
|
|
5087
|
-
this.hide = () => {
|
|
5088
|
-
// Hide the popover
|
|
5089
|
-
this.popover.removeAttribute('data-show');
|
|
5090
|
-
// Disable the event listeners
|
|
5091
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
5092
|
-
// Remove event listener
|
|
5093
|
-
document.removeEventListener('click', this.clickOutside, false);
|
|
5094
|
-
};
|
|
5095
|
-
/**
|
|
5096
|
-
* Handle action for close button
|
|
5097
|
-
*
|
|
5098
|
-
* @returns {void}
|
|
5099
|
-
*/
|
|
5100
|
-
this.handleCloseButton = () => {
|
|
5101
|
-
this.display = false;
|
|
5102
|
-
};
|
|
5103
|
-
}
|
|
5104
|
-
handleDisplay(newValue) {
|
|
5105
|
-
if (newValue) {
|
|
5106
|
-
this.show();
|
|
5107
|
-
}
|
|
5108
|
-
else {
|
|
5109
|
-
this.hide();
|
|
5110
|
-
}
|
|
5111
|
-
this.displayChange.emit(newValue);
|
|
5112
|
-
}
|
|
5113
|
-
/*************
|
|
5114
|
-
* Lifecycle *
|
|
5115
|
-
*************/
|
|
5116
|
-
/**
|
|
5117
|
-
* Check if component props are well configured on init
|
|
5118
|
-
*
|
|
5119
|
-
* @returns {void} timeout
|
|
5120
|
-
*/
|
|
5121
|
-
componentWillLoad() {
|
|
5122
|
-
// Get locales
|
|
5123
|
-
this.messages = initLocales(this.element).messages;
|
|
5124
|
-
}
|
|
5125
|
-
/**
|
|
5126
|
-
* Check if component props are well configured on init
|
|
5127
|
-
*
|
|
5128
|
-
* @returns {void}
|
|
5129
|
-
*/
|
|
5130
|
-
componentDidLoad() {
|
|
5131
|
-
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
5132
|
-
const slotedTitleElement = this.element.querySelector('[slot="title"]');
|
|
5133
|
-
if (slotedTitleElement && !isTagName(slotedTitleElement, headingTags)) {
|
|
5134
|
-
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
5135
|
-
}
|
|
5136
|
-
// Set close button id
|
|
5137
|
-
if (this.closeButton) {
|
|
5138
|
-
this.closeButtonId = `${this.identifier}-close-button`;
|
|
5139
|
-
}
|
|
5140
|
-
// Get popover content
|
|
5141
|
-
this.popover = this.element.querySelector(`#${this.identifier}`);
|
|
5142
|
-
//Get interactive element
|
|
5143
|
-
const interactiveElement = this.element.firstElementChild;
|
|
5144
|
-
// Add aria attributes
|
|
5145
|
-
interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
5146
|
-
interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
5147
|
-
// Create popperjs popover
|
|
5148
|
-
this.popper = createPopper(interactiveElement, this.popover, {
|
|
5149
|
-
placement: this.placement,
|
|
5150
|
-
modifiers: [
|
|
5151
|
-
{
|
|
5152
|
-
name: 'offset',
|
|
5153
|
-
options: {
|
|
5154
|
-
offset: [0, 10],
|
|
5155
|
-
},
|
|
5156
|
-
},
|
|
5157
|
-
],
|
|
5158
|
-
});
|
|
5159
|
-
// Add events to toggle display
|
|
5160
|
-
interactiveElement.addEventListener('click', () => {
|
|
5161
|
-
if (!this.disabled)
|
|
5162
|
-
this.display = !this.display;
|
|
5163
|
-
});
|
|
5164
|
-
// Add events to hide popover
|
|
5165
|
-
this.element.addEventListener('keydown', e => {
|
|
5166
|
-
if (!this.disabled && e.code === 'Escape')
|
|
5167
|
-
this.display = false;
|
|
5168
|
-
});
|
|
5169
|
-
this.handleDisplay(this.display);
|
|
5170
|
-
}
|
|
5171
|
-
/**
|
|
5172
|
-
* Render
|
|
5173
|
-
*
|
|
5174
|
-
* @returns {HTMLElement} HTML Element
|
|
5175
|
-
*/
|
|
5176
|
-
render() {
|
|
5177
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" }), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
5178
|
-
}
|
|
5179
|
-
get element() { return getElement(this); }
|
|
5180
|
-
static get watchers() { return {
|
|
5181
|
-
"display": ["handleDisplay"]
|
|
5182
|
-
}; }
|
|
5183
|
-
};
|
|
5184
|
-
MgPopover.style = mgPopoverCss;
|
|
5185
|
-
|
|
5186
|
-
var Status;
|
|
5187
|
-
(function (Status) {
|
|
5188
|
-
Status["VISIBLE"] = "visible";
|
|
5189
|
-
Status["HIDDEN"] = "hidden";
|
|
5190
|
-
Status["DISABLED"] = "disabled";
|
|
5191
|
-
Status["ACTIVE"] = "active";
|
|
5192
|
-
})(Status || (Status = {}));
|
|
5193
|
-
/**
|
|
5194
|
-
* List of all possibles sizes
|
|
5195
|
-
*/
|
|
5196
|
-
const sizes = ['regular', 'large'];
|
|
5197
|
-
|
|
5198
|
-
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button{padding:calc(1rem + 0.3rem) calc(1rem * 1.3) 1rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button{padding:calc(1.8rem + 0.3rem) calc(1.8rem * 1.3) 1.8rem}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:0.5rem;background:none;border:none;border-bottom:0.3rem solid transparent;color:hsl(var(--color-dark));line-height:var(--line-height);cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:30%}.mg-tabs__navigation-button:hover:not(:disabled),.mg-tabs__navigation-button:focus:not(:disabled){background-color:hsla(var(--color-info-h), var(--color-info-s), var(--color-info-l), 10%)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--color-info));border-bottom-color:hsl(var(--color-info));font-weight:700}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__content-container:focus-visible{outline:none}";
|
|
5199
|
-
|
|
5200
|
-
/**
|
|
5201
|
-
* type TabItem validation function
|
|
5202
|
-
*
|
|
5203
|
-
* @param {TabItem} tab tab item
|
|
5204
|
-
* @returns {boolean} tab item type is valid
|
|
5205
|
-
*/
|
|
5206
|
-
const isTabItem = (tab) => typeof tab === 'object' && typeof tab.label === 'string';
|
|
5207
|
-
const MgTabs = class {
|
|
5208
|
-
constructor(hostRef) {
|
|
5209
|
-
registerInstance(this, hostRef);
|
|
5210
|
-
this.activeTabChange = createEvent(this, "active-tab-change", 7);
|
|
5211
|
-
/************
|
|
5212
|
-
* Internal *
|
|
5213
|
-
************/
|
|
5214
|
-
this.tabPanel = 'panel';
|
|
5215
|
-
this.startIndex = 1;
|
|
5216
|
-
this.buttonTabBaseClass = 'mg-tabs__navigation-button';
|
|
5217
|
-
/**
|
|
5218
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
5219
|
-
* If not set, it will be created.
|
|
5220
|
-
*/
|
|
5221
|
-
this.identifier = createID('mg-tabs');
|
|
5222
|
-
/**
|
|
5223
|
-
* Define tabs size
|
|
5224
|
-
*/
|
|
5225
|
-
this.size = 'regular';
|
|
5226
|
-
/**
|
|
5227
|
-
* Active tab number
|
|
5228
|
-
* default: first is 1
|
|
5229
|
-
*/
|
|
5230
|
-
this.activeTab = 1;
|
|
5231
|
-
/**
|
|
5232
|
-
* Component tabs
|
|
5233
|
-
*/
|
|
5234
|
-
this.tabs = [];
|
|
5235
|
-
/**
|
|
5236
|
-
* Component classes
|
|
5237
|
-
*/
|
|
5238
|
-
this.classList = new ClassList(['mg-tabs']);
|
|
5239
|
-
/**
|
|
5240
|
-
* Method to set active tab
|
|
5241
|
-
*
|
|
5242
|
-
* @param {number} tabKey item tab key to set to ACTIVE status
|
|
5243
|
-
* @returns {void}
|
|
5244
|
-
*/
|
|
5245
|
-
this.setActiveTab = (tabKey) => {
|
|
5246
|
-
// reset active tabs
|
|
5247
|
-
this.tabs.forEach(tab => {
|
|
5248
|
-
if (this.tabHasGivenStatus(tab, Status.ACTIVE))
|
|
5249
|
-
tab.status = Status.VISIBLE;
|
|
5250
|
-
});
|
|
5251
|
-
// set active tab from given tab key
|
|
5252
|
-
this.tabs[tabKey - this.startIndex].status = Status.ACTIVE;
|
|
5253
|
-
// emit change active tab key event
|
|
5254
|
-
this.activeTabChange.emit(tabKey);
|
|
5255
|
-
};
|
|
5256
|
-
/**
|
|
5257
|
-
* Method to know if given tab has the given status
|
|
5258
|
-
*
|
|
5259
|
-
* @param {TabItem} tab item tab key to set to ACTIVE status
|
|
5260
|
-
* @param {Status} status status to valide
|
|
5261
|
-
* @returns {boolean} status comparaison
|
|
5262
|
-
*/
|
|
5263
|
-
this.tabHasGivenStatus = (tab, status) => tab.status === status;
|
|
5264
|
-
/**
|
|
5265
|
-
* Method to get element id from index
|
|
5266
|
-
*
|
|
5267
|
-
* @param {string} element to get id
|
|
5268
|
-
* @param {number} index to generate id
|
|
5269
|
-
* @returns {string} generated element id
|
|
5270
|
-
*/
|
|
5271
|
-
this.getElementId = (element, index) => `${element}-${this.getTabIndex(index)}`;
|
|
5272
|
-
/**
|
|
5273
|
-
* Method to get tab index
|
|
5274
|
-
*
|
|
5275
|
-
* @param {number} index to get
|
|
5276
|
-
* @returns {number} index
|
|
5277
|
-
*/
|
|
5278
|
-
this.getTabIndex = (index) => index + this.startIndex;
|
|
5279
|
-
/**
|
|
5280
|
-
* Handle click events on tabs
|
|
5281
|
-
*
|
|
5282
|
-
* @param {MouseEvent} event mouse event
|
|
5283
|
-
*/
|
|
5284
|
-
this.handleClick = (event) => {
|
|
5285
|
-
const tabId = event.currentTarget.getAttribute('data-index');
|
|
5286
|
-
this.activeTab = Number(tabId);
|
|
5287
|
-
};
|
|
5288
|
-
/**
|
|
5289
|
-
* get navigation button class from given status
|
|
5290
|
-
*
|
|
5291
|
-
* @param {Status} status button tab status
|
|
5292
|
-
* @param {boolean} isSelector set if we need a CSS selector with the dot '.' at the begin. default value = false.
|
|
5293
|
-
* @returns {string} button class/selector variant
|
|
5294
|
-
*/
|
|
5295
|
-
this.getNavigationButtonClass = (status, isSelector = false) => `${isSelector ? '.' : ''}${this.buttonTabBaseClass}--${status}`;
|
|
5296
|
-
/**
|
|
5297
|
-
* Handle keyboard event on tabs
|
|
5298
|
-
*
|
|
5299
|
-
* @param {MouseEvent} event mouse event
|
|
5300
|
-
* @returns {void}
|
|
5301
|
-
*/
|
|
5302
|
-
this.handleKeydown = (event) => {
|
|
5303
|
-
let tabId = Number(event.target.getAttribute('data-index'));
|
|
5304
|
-
const parent = event.target.parentElement;
|
|
5305
|
-
// change selected id from key code
|
|
5306
|
-
if (event.key === 'ArrowRight') {
|
|
5307
|
-
tabId++;
|
|
5308
|
-
}
|
|
5309
|
-
else if (event.key === 'ArrowLeft') {
|
|
5310
|
-
tabId--;
|
|
5311
|
-
}
|
|
5312
|
-
// get selected tab if NOT hidden, disabled
|
|
5313
|
-
const selectedTab = parent.querySelector(`[data-index="${tabId}"]:not(${[this.getNavigationButtonClass(Status.HIDDEN, true), this.getNavigationButtonClass(Status.DISABLED, true)].join()})`);
|
|
5314
|
-
// apply selected tab if exist
|
|
5315
|
-
if (selectedTab !== null) {
|
|
5316
|
-
selectedTab.focus();
|
|
5317
|
-
this.activeTab = tabId;
|
|
5318
|
-
}
|
|
5319
|
-
};
|
|
5320
|
-
/**
|
|
5321
|
-
* Validate slots setting
|
|
5322
|
-
*/
|
|
5323
|
-
this.validateSlots = () => {
|
|
5324
|
-
const slots = Array.from(this.element.children).filter(slot => { var _a; return (_a = slot.getAttribute('slot')) === null || _a === void 0 ? void 0 : _a.includes('tab_content-'); });
|
|
5325
|
-
if (slots.length !== this.tabs.length) {
|
|
5326
|
-
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
5327
|
-
}
|
|
5328
|
-
};
|
|
5329
|
-
}
|
|
5330
|
-
validateSize(newValue) {
|
|
5331
|
-
if (!sizes.includes(newValue)) {
|
|
5332
|
-
throw new Error(`<mg-tabs> prop "size" must be one of : ${sizes.join(', ')}`);
|
|
5333
|
-
}
|
|
5334
|
-
this.classList.add(`mg-tabs--size-${this.size}`);
|
|
3348
|
+
validateSize(newValue) {
|
|
3349
|
+
if (!sizes.includes(newValue)) {
|
|
3350
|
+
throw new Error(`<mg-tabs> prop "size" must be one of : ${sizes.join(', ')}`);
|
|
3351
|
+
}
|
|
3352
|
+
this.classList.add(`mg-tabs--size-${this.size}`);
|
|
5335
3353
|
}
|
|
5336
3354
|
validateItems(newValue) {
|
|
5337
3355
|
// String array
|
|
@@ -5364,6 +3382,7 @@ const MgTabs = class {
|
|
|
5364
3382
|
*/
|
|
5365
3383
|
componentWillLoad() {
|
|
5366
3384
|
// Check tabs format
|
|
3385
|
+
this.validateLabel(this.label);
|
|
5367
3386
|
this.validateItems(this.items);
|
|
5368
3387
|
this.validateActiveTab(this.activeTab);
|
|
5369
3388
|
this.validateSize(this.size);
|
|
@@ -5384,6 +3403,7 @@ const MgTabs = class {
|
|
|
5384
3403
|
}
|
|
5385
3404
|
get element() { return getElement(this); }
|
|
5386
3405
|
static get watchers() { return {
|
|
3406
|
+
"label": ["validateLabel"],
|
|
5387
3407
|
"size": ["validateSize"],
|
|
5388
3408
|
"items": ["validateItems"],
|
|
5389
3409
|
"activeTab": ["validateActiveTab"]
|
|
@@ -5561,6 +3581,11 @@ const MgTooltip = class {
|
|
|
5561
3581
|
this.guard = undefined;
|
|
5562
3582
|
};
|
|
5563
3583
|
}
|
|
3584
|
+
validateMessage(newValue) {
|
|
3585
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
3586
|
+
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
5564
3589
|
handleDisplay(newValue) {
|
|
5565
3590
|
if (newValue) {
|
|
5566
3591
|
this.show();
|
|
@@ -5641,6 +3666,7 @@ const MgTooltip = class {
|
|
|
5641
3666
|
});
|
|
5642
3667
|
});
|
|
5643
3668
|
this.handleDisplay(this.display);
|
|
3669
|
+
this.validateMessage(this.message);
|
|
5644
3670
|
}
|
|
5645
3671
|
/**
|
|
5646
3672
|
* Render
|
|
@@ -5652,9 +3678,10 @@ const MgTooltip = class {
|
|
|
5652
3678
|
}
|
|
5653
3679
|
get element() { return getElement(this); }
|
|
5654
3680
|
static get watchers() { return {
|
|
3681
|
+
"message": ["validateMessage"],
|
|
5655
3682
|
"display": ["handleDisplay"]
|
|
5656
3683
|
}; }
|
|
5657
3684
|
};
|
|
5658
3685
|
MgTooltip.style = mgTooltipCss;
|
|
5659
3686
|
|
|
5660
|
-
export { MgBadge as mg_badge, MgButton as mg_button, MgCharacterLeft as mg_character_left, MgDetails as mg_details, MgForm as mg_form, MgIcon as mg_icon, MgIllustratedMessage as mg_illustrated_message, MgInputCheckbox as mg_input_checkbox, MgInputDate as mg_input_date, MgInputNumeric as mg_input_numeric, MgInputPassword as mg_input_password, MgInputRadio as mg_input_radio, MgInputSelect as mg_input_select, MgInputText as mg_input_text, MgInputTextarea as mg_input_textarea, MgInputTitle as mg_input_title, MgInputToggle as mg_input_toggle, MgMessage as mg_message, MgPagination as mg_pagination, MgPanel as mg_panel,
|
|
3687
|
+
export { MgBadge as mg_badge, MgButton as mg_button, MgCharacterLeft as mg_character_left, MgDetails as mg_details, MgForm as mg_form, MgIcon as mg_icon, MgIllustratedMessage as mg_illustrated_message, MgInputCheckbox as mg_input_checkbox, MgInputDate as mg_input_date, MgInputNumeric as mg_input_numeric, MgInputPassword as mg_input_password, MgInputRadio as mg_input_radio, MgInputSelect as mg_input_select, MgInputText as mg_input_text, MgInputTextarea as mg_input_textarea, MgInputTitle as mg_input_title, MgInputToggle as mg_input_toggle, MgMessage as mg_message, MgPagination as mg_pagination, MgPanel as mg_panel, MgTabs as mg_tabs, MgTag as mg_tag, MgTooltip as mg_tooltip };
|