@mgdis/mg-components 6.1.0 → 6.3.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-e4a8bf81.js → index-a5b2cd1b.js} +17 -7
- package/dist/cjs/index-a5b2cd1b.js.map +1 -0
- package/dist/{esm/index-d8f69946.js → cjs/index-cc11af95.js} +6 -116
- package/dist/cjs/index-cc11af95.js.map +1 -0
- package/dist/cjs/index.es-ac7c22e3.js +152 -0
- package/dist/cjs/index.es-ac7c22e3.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_36.cjs.entry.js +380 -231
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +10 -7
- package/dist/cjs/mg-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +5 -4
- package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-progress.cjs.entry.js +82 -0
- package/dist/cjs/mg-progress.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +70 -3
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +33 -26
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +30 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +85 -4
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +29 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +30 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +29 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +30 -3
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +29 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +30 -3
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +3 -4
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +17 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +32 -2
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +19 -4
- package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +18 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.conf.js +5 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +187 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.js.map +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/types/index.js.map +1 -1
- package/dist/components/index.es.js +26 -13
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +2 -2
- package/dist/components/mg-alert.js +3 -1
- package/dist/components/mg-alert.js.map +1 -1
- package/dist/components/mg-button2.js +51 -5
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-form.js +19 -5
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +20 -29
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +18 -5
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +30 -8
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +15 -3
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +15 -2
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +15 -3
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +16 -4
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +15 -3
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-toggle.js +15 -2
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-input2.js.map +1 -1
- package/dist/components/mg-item-more2.js +5 -6
- package/dist/components/mg-item-more2.js.map +1 -1
- package/dist/components/mg-menu-item2.js +3 -3
- package/dist/components/mg-modal.js +7 -6
- package/dist/components/mg-modal.js.map +1 -1
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-panel.js +2 -2
- package/dist/components/mg-popover2.js +6 -3
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-progress.d.ts +11 -0
- package/dist/components/mg-progress.js +109 -0
- package/dist/components/mg-progress.js.map +1 -0
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs.js +4 -4
- package/dist/components/mg-tooltip2.js +3 -3
- package/dist/esm/{index-e26aede5.js → index-eb0e1053.js} +17 -7
- package/dist/esm/index-eb0e1053.js.map +1 -0
- package/dist/{cjs/index-0fe2670c.js → esm/index-f3d3fb70.js} +4 -135
- package/dist/esm/index-f3d3fb70.js.map +1 -0
- package/dist/esm/index.es-940821a9.js +130 -0
- package/dist/esm/index.es-940821a9.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_36.entry.js +232 -83
- package/dist/esm/mg-action-more_36.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +6 -3
- package/dist/esm/mg-alert.entry.js.map +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-loader.entry.js +3 -2
- package/dist/esm/mg-loader.entry.js.map +1 -1
- package/dist/esm/mg-progress.entry.js +78 -0
- package/dist/esm/mg-progress.entry.js.map +1 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-15b6849a.js +3 -0
- package/dist/mg-components/p-15b6849a.js.map +1 -0
- package/dist/mg-components/p-3aecf564.entry.js +2 -0
- package/dist/mg-components/p-3aecf564.entry.js.map +1 -0
- package/dist/mg-components/p-6f3d70b2.entry.js +2 -0
- package/dist/mg-components/p-6f3d70b2.entry.js.map +1 -0
- package/dist/mg-components/p-a17ea0af.entry.js +2 -0
- package/dist/mg-components/p-a17ea0af.entry.js.map +1 -0
- package/dist/mg-components/p-a49e2b74.js +2 -0
- package/dist/mg-components/p-a49e2b74.js.map +1 -0
- package/dist/mg-components/p-d0086664.entry.js +2 -0
- package/dist/mg-components/{p-9beb09e5.entry.js.map → p-d0086664.entry.js.map} +1 -1
- package/dist/mg-components/p-ee51ec5e.js +2 -0
- package/dist/mg-components/p-ee51ec5e.js.map +1 -0
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +9 -1
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +11 -1
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +13 -11
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +0 -2
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -9
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +12 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -0
- package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +4 -0
- package/dist/types/components/molecules/mg-form/mg-form.conf.d.ts +2 -1
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +4 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +4 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +4 -0
- package/dist/types/components/molecules/mg-progress/mg-progress.conf.d.ts +9 -0
- package/dist/types/components/molecules/mg-progress/mg-progress.d.ts +47 -0
- package/dist/types/components.d.ts +144 -10
- package/dist/types/stencil-public-runtime.d.ts +2 -0
- package/dist/types/types/index.d.ts +4 -0
- package/ide/intellij/web-types.json +219 -19
- package/ide/vscode/css-custom-data.json +16 -0
- package/ide/vscode/html-custom-data.json +176 -15
- package/package.json +27 -37
- package/dist/cjs/index-0fe2670c.js.map +0 -1
- package/dist/cjs/index-e4a8bf81.js.map +0 -1
- package/dist/esm/index-d8f69946.js.map +0 -1
- package/dist/esm/index-e26aede5.js.map +0 -1
- package/dist/mg-components/p-1fbb6ee7.js +0 -3
- package/dist/mg-components/p-1fbb6ee7.js.map +0 -1
- package/dist/mg-components/p-5c77f5dd.entry.js +0 -2
- package/dist/mg-components/p-5c77f5dd.entry.js.map +0 -1
- package/dist/mg-components/p-9beb09e5.entry.js +0 -2
- package/dist/mg-components/p-c9934e81.js +0 -2
- package/dist/mg-components/p-c9934e81.js.map +0 -1
- package/dist/mg-components/p-d7dde2ac.entry.js +0 -2
- package/dist/mg-components/p-d7dde2ac.entry.js.map +0 -1
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const
|
|
5
|
+
const index = require('./index-a5b2cd1b.js');
|
|
6
|
+
const index_es = require('./index.es-ac7c22e3.js');
|
|
7
|
+
const index$1 = require('./index-cc11af95.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Available menu item status values
|
|
@@ -29,7 +30,7 @@ const Direction = {
|
|
|
29
30
|
/**
|
|
30
31
|
* List of all possibles sizes
|
|
31
32
|
*/
|
|
32
|
-
const sizes$
|
|
33
|
+
const sizes$3 = ['medium', 'large', 'xlarge'];
|
|
33
34
|
|
|
34
35
|
const mgActionMoreCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host{--mg-c-popover-padding-vertical:var(--mg-b-size-8);--mg-c-popover-padding-horizontal:0;--mg-c-popover-max-width:unset}.mg-c-action-more__divider{--mg-c-divider-spacing-vertical:var(--mg-b-size-4)}.mg-c-action-more__chevron{transition:200ms}.mg-c-action-more__chevron--rotate.mg-c-action-more__chevron{transform:rotate(180deg)}";
|
|
35
36
|
const MgActionMoreStyle0 = mgActionMoreCss;
|
|
@@ -76,7 +77,7 @@ const MgActionMore = class {
|
|
|
76
77
|
************/
|
|
77
78
|
this.name = 'mg-action-more';
|
|
78
79
|
this.classBase = 'mg-c-action-more';
|
|
79
|
-
this.mgPopoverIdentifier =
|
|
80
|
+
this.mgPopoverIdentifier = index_es.qe(this.name);
|
|
80
81
|
/************
|
|
81
82
|
* Methods *
|
|
82
83
|
***********/
|
|
@@ -116,15 +117,15 @@ const MgActionMore = class {
|
|
|
116
117
|
}
|
|
117
118
|
validateItems(newValue) {
|
|
118
119
|
if (!isMgActionMoreItems(newValue)) {
|
|
119
|
-
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${
|
|
120
|
+
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
120
121
|
}
|
|
121
122
|
else if (isMgActionMoreItems(newValue) && newValue.length > 0 && (isMgActionMoreDivider(newValue[0]) || isMgActionMoreDivider(newValue[newValue.length - 1]))) {
|
|
122
|
-
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${
|
|
123
|
+
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${index_es.Ye(newValue)}.`);
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
validateIcon(newValue) {
|
|
126
127
|
if (newValue && !isMgActionMoreIcon(newValue)) {
|
|
127
|
-
throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${
|
|
128
|
+
throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
128
129
|
}
|
|
129
130
|
else if ((newValue === null || newValue === void 0 ? void 0 : newValue.icon) === undefined && Boolean(this.button.isIcon)) {
|
|
130
131
|
this.icon = { icon: 'ellipsis' };
|
|
@@ -132,7 +133,7 @@ const MgActionMore = class {
|
|
|
132
133
|
}
|
|
133
134
|
validateButton(newValue) {
|
|
134
135
|
if (newValue && !isMgActionMoreButton(newValue)) {
|
|
135
|
-
throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${
|
|
136
|
+
throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
validateDisplayChevron(newValue) {
|
|
@@ -203,21 +204,21 @@ const MgBadge = class {
|
|
|
203
204
|
this.label = undefined;
|
|
204
205
|
this.variant = variants$4[0];
|
|
205
206
|
this.outline = undefined;
|
|
206
|
-
this.classCollection = new
|
|
207
|
+
this.classCollection = new index_es.Xe(['mg-c-badge']);
|
|
207
208
|
}
|
|
208
209
|
validateValue(newValue) {
|
|
209
210
|
if (/^[^A-Z]+$/i.exec(`${newValue}`) === null) {
|
|
210
|
-
throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${
|
|
211
|
+
throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${index_es.Ye(newValue)}.`);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
validateLabel(newValue) {
|
|
214
|
-
if (!
|
|
215
|
-
throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${
|
|
215
|
+
if (!index_es.me(newValue)) {
|
|
216
|
+
throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
validateVariant(newValue, oldValue) {
|
|
219
220
|
if (!variants$4.includes(newValue)) {
|
|
220
|
-
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${
|
|
221
|
+
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
221
222
|
}
|
|
222
223
|
else {
|
|
223
224
|
if (oldValue !== undefined) {
|
|
@@ -257,12 +258,16 @@ const MgBadge = class {
|
|
|
257
258
|
};
|
|
258
259
|
MgBadge.style = MgBadgeStyle0;
|
|
259
260
|
|
|
261
|
+
/**
|
|
262
|
+
* List of all possibles sizes
|
|
263
|
+
*/
|
|
264
|
+
const sizes$2 = ['medium', 'large'];
|
|
260
265
|
/**
|
|
261
266
|
* List of all possibles variants
|
|
262
267
|
*/
|
|
263
268
|
const variants$3 = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success', 'link'];
|
|
264
269
|
|
|
265
|
-
const mgButtonCss = "/*!\n * @prop --mg-c-button-border-radius: Defines the border radius of the button. The default value is `--mg-b-size-radius`.\n * @prop --mg-c-button-border-top-width: Defines the top border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-right-width: Defines the right border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-bottom-width: Defines the bottom border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-left-width: Defines the left border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-radius-top-left: Defines the top left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-top-right: Defines the top right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-right: Defines the bottom right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-left: Defines the bottom left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-font-weight: Defines the font weight of the button. Unset by default, fallback on `normal`.\n * @prop --mg-c-button-icon-border-radius: Defines the border radius of the button in icon mode. The default value is `--mg-b-size-min-height`.\n */:host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:color-mix(in srgb, var(--mg-b-color-dark), transparent 90%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{/*!\n * @prop --mg-c-button-color-background-primary: Defines the background color for the primary variant button.\n * @prop --mg-c-button-color-border-primary: Defines the border color for the primary variant button.\n * @prop --mg-c-button-color-gradient-primary: Defines the gradient color for the primary variant button.\n * @prop --mg-c-button-color-text-primary: Defines the font color for the primary variant button.\n */border-color:var(--mg-c-button-color-border-primary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-primary), var(--mg-c-button-color-gradient-primary));color:var(--mg-c-button-color-text-primary)}:host(:hover) .mg-c-button.mg-c-button--primary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-primary)}.mg-c-button.mg-c-button--secondary{/*!\n * @prop --mg-c-button-color-background-secondary: Defines the background color for the secondary variant button.\n * @prop --mg-c-button-color-border-secondary: Defines the border color for the secondary variant button.\n * @prop --mg-c-button-color-gradient-secondary: Defines the gradient color for the secondary variant button.\n * @prop --mg-c-button-color-text-secondary: Defines the font color for the secondary variant button.\n */border-color:var(--mg-c-button-color-border-secondary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-secondary), var(--mg-c-button-color-gradient-secondary));color:var(--mg-c-button-color-text-secondary)}:host(:hover) .mg-c-button.mg-c-button--secondary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-secondary)}.mg-c-button.mg-c-button--danger{/*!\n * @prop --mg-c-button-color-background-danger: Defines the background color for the danger variant button.\n * @prop --mg-c-button-color-border-danger: Defines the border color for the danger variant button.\n * @prop --mg-c-button-color-gradient-danger: Defines the gradient color for the danger variant button.\n * @prop --mg-c-button-color-text-danger: Defines the font color for the danger variant button.\n */border-color:var(--mg-c-button-color-border-danger);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger), var(--mg-c-button-color-gradient-danger));color:var(--mg-c-button-color-text-danger)}:host(:hover) .mg-c-button.mg-c-button--danger:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger)}.mg-c-button.mg-c-button--info{/*!\n * @prop --mg-c-button-color-background-info: Defines the background color for the info variant button.\n * @prop --mg-c-button-color-border-info: Defines the border color for the info variant button.\n * @prop --mg-c-button-color-gradient-info: Defines the gradient color for the info variant button.\n * @prop --mg-c-button-color-text-info: Defines the font color for the info variant button.\n */border-color:var(--mg-c-button-color-border-info);background:linear-gradient(to bottom, var(--mg-c-button-color-background-info), var(--mg-c-button-color-gradient-info));color:var(--mg-c-button-color-text-info)}:host(:hover) .mg-c-button.mg-c-button--info:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-info)}.mg-c-button.mg-c-button--success{/*!\n * @prop --mg-c-button-color-background-success: Defines the background color for the success variant button.\n * @prop --mg-c-button-color-border-success: Defines the border color for the success variant button.\n * @prop --mg-c-button-color-gradient-success: Defines the gradient color for the success variant button.\n * @prop --mg-c-button-color-text-success: Defines the font color for the success variant button.\n */border-color:var(--mg-c-button-color-border-success);background:linear-gradient(to bottom, var(--mg-c-button-color-background-success), var(--mg-c-button-color-gradient-success));color:var(--mg-c-button-color-text-success)}:host(:hover) .mg-c-button.mg-c-button--success:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-success)}.mg-c-button.mg-c-button--warning{/*!\n * @prop --mg-c-button-color-background-warning: Defines the background color for the warning variant button.\n * @prop --mg-c-button-color-border-warning: Defines the border color for the warning variant button.\n * @prop --mg-c-button-color-gradient-warning: Defines the gradient color for the warning variant button.\n * @prop --mg-c-button-color-text-warning: Defines the font color for the warning variant button.\n */border-color:var(--mg-c-button-color-border-warning);background:linear-gradient(to bottom, var(--mg-c-button-color-background-warning), var(--mg-c-button-color-gradient-warning));color:var(--mg-c-button-color-text-warning)}:host(:hover) .mg-c-button.mg-c-button--warning:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-warning)}.mg-c-button.mg-c-button--danger-alt{/*!\n * @prop --mg-c-button-color-background-danger-alt: Defines the background color for the danger-alt variant button.\n * @prop --mg-c-button-color-border-danger-alt: Defines the border color for the danger-alt variant button.\n * @prop --mg-c-button-color-gradient-danger-alt: Defines the gradient color for the danger-alt variant button.\n * @prop --mg-c-button-color-text-danger-alt: Defines the font color for the danger-alt variant button.\n */border-color:var(--mg-c-button-color-border-danger-alt);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger-alt), var(--mg-c-button-color-gradient-danger-alt));color:var(--mg-c-button-color-text-danger-alt)}:host(:hover) .mg-c-button.mg-c-button--danger-alt:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger-alt)}.mg-c-button{position:relative;display:inline-flex;min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-width:var(--mg-c-button-border-top-width, var(--mg-b-size-border)) var(--mg-c-button-border-right-width, var(--mg-b-size-border)) var(--mg-c-button-border-bottom-width, var(--mg-b-size-border)) var(--mg-c-button-border-left-width, var(--mg-b-size-border));border-style:solid;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-border-radius));background-image:none;column-gap:var(--mg-b-size-8);cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button.mg-c-button--disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-button.mg-c-button--icon{width:var(--mg-b-size-min-height);height:var(--mg-b-size-min-height);justify-content:center;padding:0;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-icon-border-radius));font-size:var(--mg-b-font-size);line-height:var(--mg-b-font-size)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:var(--mg-b-size-8)}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--full-width{display:flex;justify-content:center}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}";
|
|
270
|
+
const mgButtonCss = "/*!\n * @prop --mg-c-button-border-radius: Defines the border radius of the button. The default value is `--mg-b-size-radius`.\n * @prop --mg-c-button-border-top-width: Defines the top border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-right-width: Defines the right border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-bottom-width: Defines the bottom border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-left-width: Defines the left border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-radius-top-left: Defines the top left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-top-right: Defines the top right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-right: Defines the bottom right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-left: Defines the bottom left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-font-weight: Defines the font weight of the button. Unset by default, fallback on `normal`.\n * @prop --mg-c-button-icon-border-radius: Defines the border radius of the button in icon mode. The default value is `--mg-b-size-min-height`.\n */:host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:color-mix(in srgb, var(--mg-b-color-dark), transparent 90%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{/*!\n * @prop --mg-c-button-color-background-primary: Defines the background color for the primary variant button.\n * @prop --mg-c-button-color-border-primary: Defines the border color for the primary variant button.\n * @prop --mg-c-button-color-gradient-primary: Defines the gradient color for the primary variant button.\n * @prop --mg-c-button-color-text-primary: Defines the font color for the primary variant button.\n */border-color:var(--mg-c-button-color-border-primary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-primary), var(--mg-c-button-color-gradient-primary));color:var(--mg-c-button-color-text-primary)}:host(:hover) .mg-c-button.mg-c-button--primary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-primary)}.mg-c-button.mg-c-button--secondary{/*!\n * @prop --mg-c-button-color-background-secondary: Defines the background color for the secondary variant button.\n * @prop --mg-c-button-color-border-secondary: Defines the border color for the secondary variant button.\n * @prop --mg-c-button-color-gradient-secondary: Defines the gradient color for the secondary variant button.\n * @prop --mg-c-button-color-text-secondary: Defines the font color for the secondary variant button.\n */border-color:var(--mg-c-button-color-border-secondary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-secondary), var(--mg-c-button-color-gradient-secondary));color:var(--mg-c-button-color-text-secondary)}:host(:hover) .mg-c-button.mg-c-button--secondary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-secondary)}.mg-c-button.mg-c-button--danger{/*!\n * @prop --mg-c-button-color-background-danger: Defines the background color for the danger variant button.\n * @prop --mg-c-button-color-border-danger: Defines the border color for the danger variant button.\n * @prop --mg-c-button-color-gradient-danger: Defines the gradient color for the danger variant button.\n * @prop --mg-c-button-color-text-danger: Defines the font color for the danger variant button.\n */border-color:var(--mg-c-button-color-border-danger);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger), var(--mg-c-button-color-gradient-danger));color:var(--mg-c-button-color-text-danger)}:host(:hover) .mg-c-button.mg-c-button--danger:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger)}.mg-c-button.mg-c-button--info{/*!\n * @prop --mg-c-button-color-background-info: Defines the background color for the info variant button.\n * @prop --mg-c-button-color-border-info: Defines the border color for the info variant button.\n * @prop --mg-c-button-color-gradient-info: Defines the gradient color for the info variant button.\n * @prop --mg-c-button-color-text-info: Defines the font color for the info variant button.\n */border-color:var(--mg-c-button-color-border-info);background:linear-gradient(to bottom, var(--mg-c-button-color-background-info), var(--mg-c-button-color-gradient-info));color:var(--mg-c-button-color-text-info)}:host(:hover) .mg-c-button.mg-c-button--info:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-info)}.mg-c-button.mg-c-button--success{/*!\n * @prop --mg-c-button-color-background-success: Defines the background color for the success variant button.\n * @prop --mg-c-button-color-border-success: Defines the border color for the success variant button.\n * @prop --mg-c-button-color-gradient-success: Defines the gradient color for the success variant button.\n * @prop --mg-c-button-color-text-success: Defines the font color for the success variant button.\n */border-color:var(--mg-c-button-color-border-success);background:linear-gradient(to bottom, var(--mg-c-button-color-background-success), var(--mg-c-button-color-gradient-success));color:var(--mg-c-button-color-text-success)}:host(:hover) .mg-c-button.mg-c-button--success:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-success)}.mg-c-button.mg-c-button--warning{/*!\n * @prop --mg-c-button-color-background-warning: Defines the background color for the warning variant button.\n * @prop --mg-c-button-color-border-warning: Defines the border color for the warning variant button.\n * @prop --mg-c-button-color-gradient-warning: Defines the gradient color for the warning variant button.\n * @prop --mg-c-button-color-text-warning: Defines the font color for the warning variant button.\n */border-color:var(--mg-c-button-color-border-warning);background:linear-gradient(to bottom, var(--mg-c-button-color-background-warning), var(--mg-c-button-color-gradient-warning));color:var(--mg-c-button-color-text-warning)}:host(:hover) .mg-c-button.mg-c-button--warning:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-warning)}.mg-c-button.mg-c-button--danger-alt{/*!\n * @prop --mg-c-button-color-background-danger-alt: Defines the background color for the danger-alt variant button.\n * @prop --mg-c-button-color-border-danger-alt: Defines the border color for the danger-alt variant button.\n * @prop --mg-c-button-color-gradient-danger-alt: Defines the gradient color for the danger-alt variant button.\n * @prop --mg-c-button-color-text-danger-alt: Defines the font color for the danger-alt variant button.\n */border-color:var(--mg-c-button-color-border-danger-alt);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger-alt), var(--mg-c-button-color-gradient-danger-alt));color:var(--mg-c-button-color-text-danger-alt)}:host(:hover) .mg-c-button.mg-c-button--danger-alt:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger-alt)}.mg-c-button{position:relative;display:inline-flex;min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-width:var(--mg-c-button-border-top-width, var(--mg-b-size-border)) var(--mg-c-button-border-right-width, var(--mg-b-size-border)) var(--mg-c-button-border-bottom-width, var(--mg-b-size-border)) var(--mg-c-button-border-left-width, var(--mg-b-size-border));border-style:solid;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-border-radius));background-image:none;column-gap:var(--mg-b-size-8);cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:var(--mg-b-size-8)}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--large{padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border)) calc(var(--mg-b-size-24) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon){line-height:var(--mg-b-size-24)}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) slot,.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) ::slotted(*){font-size:var(--mg-b-size-16)}.mg-c-button.mg-c-button--icon{width:var(--mg-b-size-min-height);height:var(--mg-b-size-min-height);justify-content:center;padding:0;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-icon-border-radius));font-size:var(--mg-b-font-size);line-height:var(--mg-b-font-size)}.mg-c-button.mg-c-button--icon.mg-c-button--large{width:unset;height:unset;padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--icon.mg-c-button--large ::slotted(*){min-width:var(--mg-b-size-24);min-height:var(--mg-b-size-24);align-items:center;justify-content:center}.mg-c-button.mg-c-button--full-width{display:flex;justify-content:center}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}";
|
|
266
271
|
const MgButtonStyle0 = mgButtonCss;
|
|
267
272
|
|
|
268
273
|
const MgButton = class {
|
|
@@ -312,26 +317,58 @@ const MgButton = class {
|
|
|
312
317
|
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
313
318
|
}
|
|
314
319
|
};
|
|
320
|
+
/**
|
|
321
|
+
* Set child `<mg-icon>` element `size` prop to follow the current `size` prop
|
|
322
|
+
*/
|
|
323
|
+
this.setIconSize = () => {
|
|
324
|
+
var _a, _b;
|
|
325
|
+
if (this.size === 'medium') {
|
|
326
|
+
(_a = this.element.querySelector('mg-icon')) === null || _a === void 0 ? void 0 : _a.removeAttribute('size');
|
|
327
|
+
}
|
|
328
|
+
else if (this.isIcon) {
|
|
329
|
+
(_b = this.element.querySelector('mg-icon')) === null || _b === void 0 ? void 0 : _b.setAttribute('size', this.size);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
315
332
|
this.variant = variants$3[0];
|
|
316
333
|
this.label = undefined;
|
|
317
334
|
this.type = undefined;
|
|
335
|
+
this.size = sizes$2[0];
|
|
318
336
|
this.fullWidth = false;
|
|
319
337
|
this.form = undefined;
|
|
320
338
|
this.disabled = undefined;
|
|
321
339
|
this.isIcon = false;
|
|
322
340
|
this.disableOnClick = false;
|
|
323
341
|
this.loading = false;
|
|
324
|
-
this.classCollection = new
|
|
342
|
+
this.classCollection = new index_es.Xe(['mg-c-button']);
|
|
325
343
|
}
|
|
326
344
|
validateVariant(newValue, oldValue) {
|
|
345
|
+
// validate new value
|
|
327
346
|
if (!variants$3.includes(newValue)) {
|
|
328
|
-
|
|
347
|
+
if (newValue === '') {
|
|
348
|
+
// Reactive framework like VUE render with `""` when prop is update to undefined
|
|
349
|
+
this.variant = variants$3[0];
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
if (oldValue !== undefined) {
|
|
356
|
+
this.classCollection.delete(`mg-c-button--${oldValue}`);
|
|
357
|
+
}
|
|
358
|
+
this.classCollection.add(`mg-c-button--${newValue}`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
validateSize(newValue, oldValue) {
|
|
362
|
+
// validate new value
|
|
363
|
+
if (!sizes$2.includes(newValue)) {
|
|
364
|
+
throw new Error(`<mg-button> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
329
365
|
}
|
|
330
366
|
else {
|
|
331
367
|
if (oldValue !== undefined) {
|
|
332
368
|
this.classCollection.delete(`mg-c-button--${oldValue}`);
|
|
333
369
|
}
|
|
334
370
|
this.classCollection.add(`mg-c-button--${newValue}`);
|
|
371
|
+
this.setIconSize();
|
|
335
372
|
}
|
|
336
373
|
}
|
|
337
374
|
validateFullWidth(newValue) {
|
|
@@ -363,6 +400,9 @@ const MgButton = class {
|
|
|
363
400
|
// emit value update
|
|
364
401
|
this.disabledChange.emit(isDisabled);
|
|
365
402
|
}
|
|
403
|
+
watchIsIcon() {
|
|
404
|
+
this.setIconSize();
|
|
405
|
+
}
|
|
366
406
|
loadingHandler(newValue) {
|
|
367
407
|
// we add loading style if it newvalue is true else we remove it
|
|
368
408
|
if (newValue) {
|
|
@@ -378,9 +418,11 @@ const MgButton = class {
|
|
|
378
418
|
componentWillLoad() {
|
|
379
419
|
this.validateVariant(this.variant);
|
|
380
420
|
this.validateFullWidth(this.fullWidth);
|
|
421
|
+
this.validateSize(this.size);
|
|
422
|
+
this.watchIsIcon();
|
|
381
423
|
if (this.isIcon) {
|
|
382
424
|
this.classCollection.add(`mg-c-button--icon`);
|
|
383
|
-
if (!
|
|
425
|
+
if (!index_es.me(this.label)) {
|
|
384
426
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
385
427
|
}
|
|
386
428
|
}
|
|
@@ -392,7 +434,7 @@ const MgButton = class {
|
|
|
392
434
|
* Add listners
|
|
393
435
|
*/
|
|
394
436
|
componentDidLoad() {
|
|
395
|
-
|
|
437
|
+
index_es.tt(() => {
|
|
396
438
|
var _a;
|
|
397
439
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
398
440
|
// submit buttons should trigger form submition;
|
|
@@ -409,13 +451,15 @@ const MgButton = class {
|
|
|
409
451
|
*/
|
|
410
452
|
render() {
|
|
411
453
|
var _a;
|
|
412
|
-
return (index.h(index.Host, { key: '
|
|
454
|
+
return (index.h(index.Host, { key: 'a56efb7c3e49a4aadf6751b10bacb39f20c260df', role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, index.h("div", { key: '2d47d068d188161b603b26117256d0e828393348', class: this.classCollection.join() }, this.loading && index.h("mg-icon", { key: 'ba84820c70834f1e345af506265222340659f8ec', icon: "loader", spin: true }), index.h("div", { key: 'db6c3437d5de7f828cca7df9d83670de9d3a8ed6', class: "mg-c-button__content" }, index.h("slot", { key: 'b00f76d92e1e2f9e4dd834bf41419c68c2635d1a' })))));
|
|
413
455
|
}
|
|
414
456
|
get element() { return index.getElement(this); }
|
|
415
457
|
static get watchers() { return {
|
|
416
458
|
"variant": ["validateVariant"],
|
|
459
|
+
"size": ["validateSize"],
|
|
417
460
|
"fullWidth": ["validateFullWidth"],
|
|
418
461
|
"disabled": ["disabledHandler"],
|
|
462
|
+
"isIcon": ["watchIsIcon"],
|
|
419
463
|
"loading": ["loadingHandler"]
|
|
420
464
|
}; }
|
|
421
465
|
};
|
|
@@ -452,13 +496,13 @@ const MgCharacterLeft = class {
|
|
|
452
496
|
this.maxlength = undefined;
|
|
453
497
|
}
|
|
454
498
|
watchIdentifier(newValue) {
|
|
455
|
-
if (newValue !== undefined && !
|
|
456
|
-
console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${
|
|
499
|
+
if (newValue !== undefined && !index_es.Ge(newValue)) {
|
|
500
|
+
console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
457
501
|
}
|
|
458
502
|
}
|
|
459
503
|
validateMaxlength(newValue) {
|
|
460
504
|
if (typeof newValue !== 'number') {
|
|
461
|
-
throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${
|
|
505
|
+
throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${index_es.Ye(newValue)}.`);
|
|
462
506
|
}
|
|
463
507
|
}
|
|
464
508
|
/*************
|
|
@@ -506,7 +550,7 @@ const MgDetails = class {
|
|
|
506
550
|
this.expanded = false;
|
|
507
551
|
}
|
|
508
552
|
validateTitles(newValue) {
|
|
509
|
-
if (!
|
|
553
|
+
if (!index_es.me(newValue)) {
|
|
510
554
|
throw new Error(`<mg-details> prop "toggleClosed" and "toggleOpened" is required and must be a valid string. Passed value: "toggleClosed='${this.toggleClosed}'" and "toggleOpened='${this.toggleOpened}'".`);
|
|
511
555
|
}
|
|
512
556
|
}
|
|
@@ -646,7 +690,7 @@ const MgForm = class {
|
|
|
646
690
|
*/
|
|
647
691
|
this.setMgInputs = () => {
|
|
648
692
|
// Get slotted mgInputs
|
|
649
|
-
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT
|
|
693
|
+
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT'));
|
|
650
694
|
// Set inputs readonly or disabled based on form configuration
|
|
651
695
|
// Othewise listen to events
|
|
652
696
|
this.mgInputs.forEach(input => {
|
|
@@ -664,7 +708,7 @@ const MgForm = class {
|
|
|
664
708
|
}
|
|
665
709
|
});
|
|
666
710
|
};
|
|
667
|
-
this.identifier =
|
|
711
|
+
this.identifier = index_es.qe('mg-form');
|
|
668
712
|
this.name = this.identifier;
|
|
669
713
|
this.readonly = false;
|
|
670
714
|
this.requiredMessage = undefined;
|
|
@@ -673,22 +717,22 @@ const MgForm = class {
|
|
|
673
717
|
this.disabled = false;
|
|
674
718
|
this.valid = undefined;
|
|
675
719
|
this.invalid = undefined;
|
|
676
|
-
this.classCollection = new
|
|
720
|
+
this.classCollection = new index_es.Xe(['mg-c-form']);
|
|
677
721
|
this.requiredMessageText = undefined;
|
|
678
722
|
}
|
|
679
723
|
watchIdentifier(newValue) {
|
|
680
|
-
if (!
|
|
681
|
-
console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${
|
|
724
|
+
if (!index_es.Ge(newValue)) {
|
|
725
|
+
console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
682
726
|
}
|
|
683
727
|
}
|
|
684
728
|
validateRequiredMessage(newValue) {
|
|
685
729
|
if (newValue && !requiredMessageStatus.includes(newValue)) {
|
|
686
|
-
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${
|
|
730
|
+
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
687
731
|
}
|
|
688
732
|
}
|
|
689
733
|
validateAriaRole(newValue) {
|
|
690
734
|
if (newValue && !roles.includes(newValue)) {
|
|
691
|
-
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${
|
|
735
|
+
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
692
736
|
}
|
|
693
737
|
}
|
|
694
738
|
handlelabelOnTop(newValue) {
|
|
@@ -715,6 +759,18 @@ const MgForm = class {
|
|
|
715
759
|
this.checkValidity();
|
|
716
760
|
}
|
|
717
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* Reset form inputs values, validity and error state
|
|
764
|
+
*/
|
|
765
|
+
async reset() {
|
|
766
|
+
if (!this.readonly) {
|
|
767
|
+
await Promise.all(this.mgInputs.map(async (input) => {
|
|
768
|
+
if (input.reset !== undefined) {
|
|
769
|
+
await input.reset();
|
|
770
|
+
}
|
|
771
|
+
}));
|
|
772
|
+
}
|
|
773
|
+
}
|
|
718
774
|
/*************
|
|
719
775
|
* Lifecycle *
|
|
720
776
|
*************/
|
|
@@ -754,6 +810,7 @@ const MgForm = class {
|
|
|
754
810
|
// Update mgInputs when mgForm content change
|
|
755
811
|
new MutationObserver(() => {
|
|
756
812
|
this.setMgInputs();
|
|
813
|
+
this.checkValidity();
|
|
757
814
|
}).observe(this.element, { childList: true });
|
|
758
815
|
}
|
|
759
816
|
/**
|
|
@@ -761,7 +818,7 @@ const MgForm = class {
|
|
|
761
818
|
* @returns HTML Element
|
|
762
819
|
*/
|
|
763
820
|
render() {
|
|
764
|
-
return (index.h("form", { key: '
|
|
821
|
+
return (index.h("form", { key: 'ecfaff2bb897ce2c48ed352167bb418703a56c98', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && index.h("p", { key: '4d4fa2ff3cf4f25ebe0b009ae1995734bfcafd3b', innerHTML: this.requiredMessageText }), index.h("slot", { key: 'dc0c7acadf6b744335852f847a8336b018e28cb5' }), !this.readonly && !this.disabled && index.h("slot", { key: 'ede3ace32f6a88067845013fa65e5414cae5fcea', name: "actions" })));
|
|
765
822
|
}
|
|
766
823
|
get element() { return index.getElement(this); }
|
|
767
824
|
static get watchers() { return {
|
|
@@ -821,11 +878,11 @@ const MgIcon = class {
|
|
|
821
878
|
this.variant = undefined;
|
|
822
879
|
this.variantStyle = undefined;
|
|
823
880
|
this.spin = false;
|
|
824
|
-
this.classCollection = new
|
|
881
|
+
this.classCollection = new index_es.Xe(['mg-c-icon']);
|
|
825
882
|
}
|
|
826
883
|
validateIcon(newValue, oldValue) {
|
|
827
884
|
if (!Object.keys(icons).includes(newValue))
|
|
828
|
-
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${
|
|
885
|
+
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
829
886
|
else {
|
|
830
887
|
if (oldValue !== undefined)
|
|
831
888
|
this.classCollection.delete(`mg-c-icon--${oldValue}`);
|
|
@@ -835,7 +892,7 @@ const MgIcon = class {
|
|
|
835
892
|
}
|
|
836
893
|
validateSize(newValue, oldValue) {
|
|
837
894
|
if (!sizes$1.includes(newValue))
|
|
838
|
-
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${
|
|
895
|
+
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
839
896
|
else {
|
|
840
897
|
if (oldValue !== undefined)
|
|
841
898
|
this.classCollection.delete(`mg-c-icon--size-${oldValue}`);
|
|
@@ -845,7 +902,7 @@ const MgIcon = class {
|
|
|
845
902
|
validateVariant(newValue, oldValue) {
|
|
846
903
|
if (newValue !== undefined) {
|
|
847
904
|
if (!variants$2.includes(newValue))
|
|
848
|
-
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${
|
|
905
|
+
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
849
906
|
else {
|
|
850
907
|
this.setDefaultVariantStyle();
|
|
851
908
|
if (oldValue !== undefined)
|
|
@@ -857,7 +914,7 @@ const MgIcon = class {
|
|
|
857
914
|
validateVariantStyle(newValue, oldValue) {
|
|
858
915
|
if (newValue !== undefined) {
|
|
859
916
|
if (!variantStyles$1.includes(newValue))
|
|
860
|
-
throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${
|
|
917
|
+
throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
861
918
|
else {
|
|
862
919
|
if (oldValue !== undefined)
|
|
863
920
|
this.classCollection.delete(`mg-c-icon--variant-style-${oldValue}`);
|
|
@@ -920,7 +977,7 @@ const MgIllustratedMessage = class {
|
|
|
920
977
|
componentDidLoad() {
|
|
921
978
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
922
979
|
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
923
|
-
if (!
|
|
980
|
+
if (!index_es.Ke(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
924
981
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}.`);
|
|
925
982
|
}
|
|
926
983
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -992,11 +1049,11 @@ const MgInput = class {
|
|
|
992
1049
|
this.isVerticalList = false;
|
|
993
1050
|
}
|
|
994
1051
|
watchIdentifier(newValue) {
|
|
995
|
-
if (!
|
|
996
|
-
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${
|
|
1052
|
+
if (!index_es.me(newValue)) {
|
|
1053
|
+
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
997
1054
|
}
|
|
998
|
-
else if (!
|
|
999
|
-
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${
|
|
1055
|
+
else if (!index_es.Ge(newValue)) {
|
|
1056
|
+
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1000
1057
|
}
|
|
1001
1058
|
else {
|
|
1002
1059
|
this.helpTextId = `${this.identifier}-help-text`;
|
|
@@ -1018,7 +1075,7 @@ const MgInput = class {
|
|
|
1018
1075
|
}
|
|
1019
1076
|
watchTooltipPosition(newValue) {
|
|
1020
1077
|
if (!tooltipPositions.includes(newValue)) {
|
|
1021
|
-
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${
|
|
1078
|
+
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1022
1079
|
}
|
|
1023
1080
|
}
|
|
1024
1081
|
watchErrorMessage(newValue) {
|
|
@@ -1082,8 +1139,8 @@ const MgInput = class {
|
|
|
1082
1139
|
*/
|
|
1083
1140
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
1084
1141
|
watchLabel() {
|
|
1085
|
-
if (!
|
|
1086
|
-
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${
|
|
1142
|
+
if (!index_es.me(this.label)) {
|
|
1143
|
+
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${index_es.Ye(this.label)}.`);
|
|
1087
1144
|
}
|
|
1088
1145
|
else {
|
|
1089
1146
|
this.watchAriaDescribedbyIDs();
|
|
@@ -1216,7 +1273,7 @@ const MgInputCheckboxList = (props) => (index.h("ul", { class: "mg-c-input__inpu
|
|
|
1216
1273
|
var _a, _b;
|
|
1217
1274
|
return (index.h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } },
|
|
1218
1275
|
index.h("input", { type: "checkbox", id: input._id, name: props.name, value: (_a = input.value) === null || _a === void 0 ? void 0 : _a.toString(), checked: Boolean(input.value), required: input.required, "aria-invalid": ((_b = props.invalid) === null || _b === void 0 ? void 0 : _b.toString()) || 'false', disabled: props.disabled || input.disabled, indeterminate: input.value === null, onInput: input._handleInput, onBlur: input._handleBlur, onKeyDown: input._handleKeydown }),
|
|
1219
|
-
index.h("label", { htmlFor: input._id
|
|
1276
|
+
index.h("label", { htmlFor: input._id }, input.title)));
|
|
1220
1277
|
})));
|
|
1221
1278
|
|
|
1222
1279
|
const mgInputCheckboxCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-c-input-check-size);height:var(--mg-c-input-check-size);flex-shrink:0;margin:calc((var(--mg-b-font-size)*var(--mg-b-line-height) - var(--mg-c-input-check-size))/2) var(--mg-b-size-8) 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);gap:var(--mg-b-size-12) var(--mg-b-size-24);list-style:none}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group.mg-c-input__input-group--disabled label{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:var(--mg-b-size-8)}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-group-container{padding:var(--mg-b-size-4) var(--mg-b-size-8);margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container{display:flex;width:unset;flex:unset;flex-wrap:wrap;column-gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container-list{display:flex;flex-flow:row wrap;padding:0;margin:0;gap:var(--mg-b-size-4);list-style:none}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__sections{max-height:80vh;padding-right:var(--mg-b-size-8);overflow-y:auto}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header{display:flex;min-height:var(--mg-b-size-min-height);flex-wrap:wrap;flex-wrap:nowrap;align-items:center;gap:var(--mg-b-size-8);text-wrap:nowrap}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-tootlip{display:inline-block;width:auto;height:auto;margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title{display:inline;margin:0;color:var(--mg-b-color-neutral-80)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title-label{font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title--static.mg-c-input__section-header-title{margin:0 var(--mg-b-size-12)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-value{display:inline-flex;min-width:var(--mg-b-size-min-height);min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;justify-content:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-radius:var(--mg-b-size-4);background-color:var(--mg-b-color-neutral-20);font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-no-result{text-align:center}.mg-c-input.mg-c-input--checkbox-multi b{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--disabled .mg-c-input__input-container b{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--with-values .mg-c-input__input-container{gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content{display:flex;width:calc(var(--mg-b-size-floating-element-max-width) - var(--mg-b-size-16));height:calc(50*var(--mg-b-size-8));flex-direction:column;gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi:not(.mg-c-input--label-on-top) mg-tooltip:not(.mg-c-input__section-header-tootlip){margin-left:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi mg-popover{--mg-c-card-spacing:var(--mg-b-size-8)}.mg-c-input.mg-c-input--readonly ul{display:flex;min-height:var(--mg-b-font-size);flex-flow:column wrap;padding:0;margin:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) 0 0;list-style:none;row-gap:var(--mg-b-size-8)}";
|
|
@@ -1255,6 +1312,7 @@ const MgInputCheckbox = class {
|
|
|
1255
1312
|
this.updateCheckboxItems('value', Boolean(event.target.checked), item => item._id === event.target.id);
|
|
1256
1313
|
this.updateValues();
|
|
1257
1314
|
this.checkValidity();
|
|
1315
|
+
this.setErrorMessage();
|
|
1258
1316
|
};
|
|
1259
1317
|
/**
|
|
1260
1318
|
* Keyboard handler
|
|
@@ -1281,18 +1339,10 @@ const MgInputCheckbox = class {
|
|
|
1281
1339
|
/**
|
|
1282
1340
|
* Handle blur event
|
|
1283
1341
|
*/
|
|
1284
|
-
this.handleBlur = (
|
|
1285
|
-
if (this.handlerInProgress === 'mouseenter') {
|
|
1286
|
-
event.preventDefault();
|
|
1287
|
-
return;
|
|
1288
|
-
}
|
|
1289
|
-
// set guard
|
|
1290
|
-
this.handlerInProgress = 'blur';
|
|
1342
|
+
this.handleBlur = () => {
|
|
1291
1343
|
// Check validity
|
|
1292
1344
|
this.checkValidity();
|
|
1293
1345
|
this.setErrorMessage();
|
|
1294
|
-
// reset guard
|
|
1295
|
-
this.handlerInProgress = undefined;
|
|
1296
1346
|
};
|
|
1297
1347
|
/**
|
|
1298
1348
|
* Handle input search value-change event
|
|
@@ -1334,18 +1384,6 @@ const MgInputCheckbox = class {
|
|
|
1334
1384
|
});
|
|
1335
1385
|
this.updateValues();
|
|
1336
1386
|
};
|
|
1337
|
-
/**
|
|
1338
|
-
* Handle input label mouseenter event
|
|
1339
|
-
*/
|
|
1340
|
-
this.handleMouseEnter = () => {
|
|
1341
|
-
this.handlerInProgress = 'mouseenter';
|
|
1342
|
-
};
|
|
1343
|
-
/**
|
|
1344
|
-
* Handle input label leave event
|
|
1345
|
-
*/
|
|
1346
|
-
this.handleMouseLeave = () => {
|
|
1347
|
-
this.handlerInProgress = undefined;
|
|
1348
|
-
};
|
|
1349
1387
|
/**
|
|
1350
1388
|
* Update values
|
|
1351
1389
|
*/
|
|
@@ -1354,8 +1392,6 @@ const MgInputCheckbox = class {
|
|
|
1354
1392
|
delete o._handleBlur;
|
|
1355
1393
|
delete o._handleInput;
|
|
1356
1394
|
delete o._handleKeydown;
|
|
1357
|
-
delete o._handleMouseEnter;
|
|
1358
|
-
delete o._handleMouseLeave;
|
|
1359
1395
|
delete o._id;
|
|
1360
1396
|
return o;
|
|
1361
1397
|
});
|
|
@@ -1369,7 +1405,7 @@ const MgInputCheckbox = class {
|
|
|
1369
1405
|
* Method to update searchResults
|
|
1370
1406
|
*/
|
|
1371
1407
|
this.updateSearchResults = () => {
|
|
1372
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
1408
|
+
this.searchResults = this.checkboxItems.filter(item => index_es.et(item.title).includes(index_es.et(this.searchValue)));
|
|
1373
1409
|
};
|
|
1374
1410
|
/**
|
|
1375
1411
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1401,13 +1437,13 @@ const MgInputCheckbox = class {
|
|
|
1401
1437
|
* @returns message to display
|
|
1402
1438
|
*/
|
|
1403
1439
|
this.getSelectValuesButtonMessage = () => {
|
|
1404
|
-
if (this.selectValuesButtonKey === 'editButton' &&
|
|
1440
|
+
if (this.selectValuesButtonKey === 'editButton' && index_es.me(this.editButtonMessage)) {
|
|
1405
1441
|
return this.editButtonMessage;
|
|
1406
1442
|
}
|
|
1407
|
-
else if (this.selectValuesButtonKey === 'showButton' &&
|
|
1443
|
+
else if (this.selectValuesButtonKey === 'showButton' && index_es.me(this.showButtonMessage)) {
|
|
1408
1444
|
return this.showButtonMessage;
|
|
1409
1445
|
}
|
|
1410
|
-
else if (this.selectValuesButtonKey === 'selectButton' &&
|
|
1446
|
+
else if (this.selectValuesButtonKey === 'selectButton' && index_es.me(this.selectButtonMessage)) {
|
|
1411
1447
|
return this.selectButtonMessage;
|
|
1412
1448
|
}
|
|
1413
1449
|
else {
|
|
@@ -1476,7 +1512,7 @@ const MgInputCheckbox = class {
|
|
|
1476
1512
|
this.editButtonMessage = undefined;
|
|
1477
1513
|
this.showButtonMessage = undefined;
|
|
1478
1514
|
this.selectButtonMessage = undefined;
|
|
1479
|
-
this.classCollection = new
|
|
1515
|
+
this.classCollection = new index_es.Xe([this.baseClassName, classFieldset]);
|
|
1480
1516
|
this.errorMessage = undefined;
|
|
1481
1517
|
this.checkboxItems = [];
|
|
1482
1518
|
this.displaySearchInput = undefined;
|
|
@@ -1486,16 +1522,16 @@ const MgInputCheckbox = class {
|
|
|
1486
1522
|
}
|
|
1487
1523
|
validateValue(newValue) {
|
|
1488
1524
|
if (isCheckboxItems(newValue)) {
|
|
1489
|
-
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this)
|
|
1525
|
+
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this) })));
|
|
1490
1526
|
this.valueChange.emit(newValue);
|
|
1491
1527
|
}
|
|
1492
1528
|
else {
|
|
1493
|
-
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${
|
|
1529
|
+
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1494
1530
|
}
|
|
1495
1531
|
}
|
|
1496
1532
|
validateType(newValue) {
|
|
1497
1533
|
if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
|
|
1498
|
-
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${
|
|
1534
|
+
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1499
1535
|
}
|
|
1500
1536
|
else if (newValue === undefined) {
|
|
1501
1537
|
this.mode = 'auto';
|
|
@@ -1584,7 +1620,7 @@ const MgInputCheckbox = class {
|
|
|
1584
1620
|
if (typeof valid !== 'boolean') {
|
|
1585
1621
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
|
|
1586
1622
|
}
|
|
1587
|
-
else if (!
|
|
1623
|
+
else if (!index_es.me(errorMessage)) {
|
|
1588
1624
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
|
|
1589
1625
|
}
|
|
1590
1626
|
else {
|
|
@@ -1593,6 +1629,17 @@ const MgInputCheckbox = class {
|
|
|
1593
1629
|
this.hasDisplayedError = this.invalid;
|
|
1594
1630
|
}
|
|
1595
1631
|
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Reset value, validity and error state
|
|
1634
|
+
*/
|
|
1635
|
+
async reset() {
|
|
1636
|
+
if (!this.readonly) {
|
|
1637
|
+
this.value = this.value.map(item => (Object.assign(Object.assign({}, item), { value: false })));
|
|
1638
|
+
this.checkValidity();
|
|
1639
|
+
this.errorMessage = undefined;
|
|
1640
|
+
this.hasDisplayedError = false;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1596
1643
|
/**
|
|
1597
1644
|
* Method to set validity values
|
|
1598
1645
|
* @param newValue - valid new value
|
|
@@ -1602,7 +1649,7 @@ const MgInputCheckbox = class {
|
|
|
1602
1649
|
this.valid = newValue;
|
|
1603
1650
|
this.invalid = !this.valid;
|
|
1604
1651
|
// We need to send valid event even if it is the same value
|
|
1605
|
-
if (this.
|
|
1652
|
+
if (this.valid !== oldValidValue)
|
|
1606
1653
|
this.inputValid.emit(this.valid);
|
|
1607
1654
|
}
|
|
1608
1655
|
/**
|
|
@@ -1710,7 +1757,7 @@ const MgInputCheckbox = class {
|
|
|
1710
1757
|
else {
|
|
1711
1758
|
inputContent = this.renderCheckboxMulti();
|
|
1712
1759
|
}
|
|
1713
|
-
return (index.h("mg-input", { key: '
|
|
1760
|
+
return (index.h("mg-input", { key: '5a6c84d1f533159645c5aec09bb6e82a7cd30cc7', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
|
|
1714
1761
|
}
|
|
1715
1762
|
get element() { return index.getElement(this); }
|
|
1716
1763
|
static get watchers() { return {
|
|
@@ -1843,7 +1890,7 @@ const MgInputDate = class {
|
|
|
1843
1890
|
* @param value - value to test
|
|
1844
1891
|
* @returns truthy when value match the pattern
|
|
1845
1892
|
*/
|
|
1846
|
-
this.isValidPattern = (value) =>
|
|
1893
|
+
this.isValidPattern = (value) => index_es.me(value) && index_es.He.test(value);
|
|
1847
1894
|
/**
|
|
1848
1895
|
* Format help text to display
|
|
1849
1896
|
* @param helpText - help text format
|
|
@@ -1851,10 +1898,10 @@ const MgInputDate = class {
|
|
|
1851
1898
|
*/
|
|
1852
1899
|
this.formatHelpText = (helpText) => {
|
|
1853
1900
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
1854
|
-
let text =
|
|
1901
|
+
let text = index_es.me(helpText) ? helpText : this.messages.input.date.helpText;
|
|
1855
1902
|
if (text.includes(defaultHelpTextVariable))
|
|
1856
1903
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
1857
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}',
|
|
1904
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', index_es.ze(index_es.ft(new Date('2023-12-24')), this.systemLocale));
|
|
1858
1905
|
};
|
|
1859
1906
|
/**
|
|
1860
1907
|
* Handle input event
|
|
@@ -1946,8 +1993,8 @@ const MgInputDate = class {
|
|
|
1946
1993
|
// min, max & minMax
|
|
1947
1994
|
else if (['min', 'max', 'minMax'].includes(inputError)) {
|
|
1948
1995
|
this.errorMessage = this.messages.errors.date[inputError]
|
|
1949
|
-
.replace('{min}',
|
|
1950
|
-
.replace('{max}',
|
|
1996
|
+
.replace('{min}', index_es.ze(this.min, this.systemLocale))
|
|
1997
|
+
.replace('{max}', index_es.ze(this.max, this.systemLocale));
|
|
1951
1998
|
}
|
|
1952
1999
|
// wrong date format
|
|
1953
2000
|
// element.validity.badInput is default error message
|
|
@@ -1961,7 +2008,7 @@ const MgInputDate = class {
|
|
|
1961
2008
|
* @returns translated html pattern
|
|
1962
2009
|
*/
|
|
1963
2010
|
this.renderPattern = () => {
|
|
1964
|
-
let patternLocal =
|
|
2011
|
+
let patternLocal = index_es.ct(this.systemLocale);
|
|
1965
2012
|
for (const key in this.messages.input.date.pattern) {
|
|
1966
2013
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
1967
2014
|
}
|
|
@@ -1983,7 +2030,7 @@ const MgInputDate = class {
|
|
|
1983
2030
|
this.helpText = undefined;
|
|
1984
2031
|
this.valid = undefined;
|
|
1985
2032
|
this.invalid = undefined;
|
|
1986
|
-
this.classCollection = new
|
|
2033
|
+
this.classCollection = new index_es.Xe(['mg-c-input--date']);
|
|
1987
2034
|
this.errorMessage = undefined;
|
|
1988
2035
|
}
|
|
1989
2036
|
validateValue(newValue) {
|
|
@@ -1991,8 +2038,8 @@ const MgInputDate = class {
|
|
|
1991
2038
|
if (newValue === '')
|
|
1992
2039
|
newValue = null;
|
|
1993
2040
|
// check value validity
|
|
1994
|
-
if (newValue && !
|
|
1995
|
-
throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${
|
|
2041
|
+
if (newValue && !index_es.me(newValue)) {
|
|
2042
|
+
throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1996
2043
|
}
|
|
1997
2044
|
else if ([null, undefined].includes(newValue) || this.isValidPattern(newValue)) {
|
|
1998
2045
|
this.valueChange.emit(newValue);
|
|
@@ -2009,7 +2056,7 @@ const MgInputDate = class {
|
|
|
2009
2056
|
}
|
|
2010
2057
|
validateMinMax(newValue) {
|
|
2011
2058
|
if (newValue && !this.isValidPattern(newValue)) {
|
|
2012
|
-
throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${
|
|
2059
|
+
throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2013
2060
|
}
|
|
2014
2061
|
}
|
|
2015
2062
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -2048,7 +2095,7 @@ const MgInputDate = class {
|
|
|
2048
2095
|
if (typeof valid !== 'boolean') {
|
|
2049
2096
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean.');
|
|
2050
2097
|
}
|
|
2051
|
-
else if (!
|
|
2098
|
+
else if (!index_es.me(errorMessage)) {
|
|
2052
2099
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string.');
|
|
2053
2100
|
}
|
|
2054
2101
|
else {
|
|
@@ -2057,6 +2104,18 @@ const MgInputDate = class {
|
|
|
2057
2104
|
this.hasDisplayedError = this.invalid;
|
|
2058
2105
|
}
|
|
2059
2106
|
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Reset value, validity and error state
|
|
2109
|
+
*/
|
|
2110
|
+
async reset() {
|
|
2111
|
+
if (!this.readonly) {
|
|
2112
|
+
this.value = '';
|
|
2113
|
+
this.checkValidity();
|
|
2114
|
+
this.invalid = false;
|
|
2115
|
+
this.errorMessage = undefined;
|
|
2116
|
+
this.hasDisplayedError = false;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2060
2119
|
/**
|
|
2061
2120
|
* Method to set validity values
|
|
2062
2121
|
* @param newValue - valid new value
|
|
@@ -2102,7 +2161,7 @@ const MgInputDate = class {
|
|
|
2102
2161
|
* @returns HTML Element
|
|
2103
2162
|
*/
|
|
2104
2163
|
render() {
|
|
2105
|
-
return (index.h("mg-input", { key: '
|
|
2164
|
+
return (index.h("mg-input", { key: '33ffeaf0b7b07cc65081891709a73a44c9454092', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && ['', undefined].includes(this.value) ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly ? (this.value && index.h("b", { class: "mg-c-input__readonly-value" }, index_es.ze(this.value, this.locale))) : (index.h("input", { type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
|
2106
2165
|
if (el !== null)
|
|
2107
2166
|
this.input = el;
|
|
2108
2167
|
} }))));
|
|
@@ -2123,9 +2182,9 @@ MgInputDate.style = MgInputDateStyle0;
|
|
|
2123
2182
|
* List of all possibles types
|
|
2124
2183
|
*/
|
|
2125
2184
|
const types = ['decimal', 'integer'];
|
|
2126
|
-
const formats = ['none', 'number', 'currency'];
|
|
2185
|
+
const formats = ['none', 'number', 'currency', 'percent', 'unit'];
|
|
2127
2186
|
|
|
2128
|
-
const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)
|
|
2187
|
+
const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
|
|
2129
2188
|
const MgInputNumericStyle0 = mgInputNumericCss;
|
|
2130
2189
|
|
|
2131
2190
|
const MgInputNumeric = class {
|
|
@@ -2188,7 +2247,9 @@ const MgInputNumeric = class {
|
|
|
2188
2247
|
this.errorMessage = this.messages.errors[inputError];
|
|
2189
2248
|
}
|
|
2190
2249
|
else {
|
|
2191
|
-
|
|
2250
|
+
const formattedMin = this.formatValue(this.min);
|
|
2251
|
+
const formattedMax = this.formatValue(this.max);
|
|
2252
|
+
this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
|
|
2192
2253
|
}
|
|
2193
2254
|
}
|
|
2194
2255
|
};
|
|
@@ -2226,9 +2287,13 @@ const MgInputNumeric = class {
|
|
|
2226
2287
|
this.formatValue = (value) => {
|
|
2227
2288
|
switch (this.format) {
|
|
2228
2289
|
case 'number':
|
|
2229
|
-
return
|
|
2290
|
+
return index_es.$t(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2230
2291
|
case 'currency':
|
|
2231
|
-
return
|
|
2292
|
+
return index_es.ut(value, this.locale, this.currency);
|
|
2293
|
+
case 'percent':
|
|
2294
|
+
return index_es.dt(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2295
|
+
case 'unit':
|
|
2296
|
+
return index_es.pt(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2232
2297
|
case 'none':
|
|
2233
2298
|
return value.toString();
|
|
2234
2299
|
}
|
|
@@ -2274,11 +2339,13 @@ const MgInputNumeric = class {
|
|
|
2274
2339
|
this.type = 'decimal';
|
|
2275
2340
|
this.format = 'number';
|
|
2276
2341
|
this.currency = 'EUR';
|
|
2342
|
+
this.unit = undefined;
|
|
2343
|
+
this.unitDisplay = 'short';
|
|
2277
2344
|
this.integerLength = 13;
|
|
2278
2345
|
this.decimalLength = 2;
|
|
2279
2346
|
this.valid = undefined;
|
|
2280
2347
|
this.invalid = undefined;
|
|
2281
|
-
this.classCollection = new
|
|
2348
|
+
this.classCollection = new index_es.Xe(['mg-c-input--numeric']);
|
|
2282
2349
|
this.errorMessage = undefined;
|
|
2283
2350
|
this.hasFocus = undefined;
|
|
2284
2351
|
}
|
|
@@ -2333,22 +2400,22 @@ const MgInputNumeric = class {
|
|
|
2333
2400
|
}
|
|
2334
2401
|
validateType(newValue) {
|
|
2335
2402
|
if (!types.includes(newValue)) {
|
|
2336
|
-
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${
|
|
2403
|
+
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2337
2404
|
}
|
|
2338
2405
|
}
|
|
2339
2406
|
watchFormat(newValue) {
|
|
2340
2407
|
if (!formats.includes(newValue)) {
|
|
2341
|
-
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${
|
|
2408
|
+
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2342
2409
|
}
|
|
2343
2410
|
}
|
|
2344
2411
|
validateIntegerLength(newValue) {
|
|
2345
2412
|
if (newValue < 1) {
|
|
2346
|
-
throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${
|
|
2413
|
+
throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2347
2414
|
}
|
|
2348
2415
|
}
|
|
2349
2416
|
validateDecimalLength(newValue) {
|
|
2350
2417
|
if (newValue < 1) {
|
|
2351
|
-
throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${
|
|
2418
|
+
throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2352
2419
|
}
|
|
2353
2420
|
}
|
|
2354
2421
|
/**
|
|
@@ -2371,7 +2438,7 @@ const MgInputNumeric = class {
|
|
|
2371
2438
|
if (typeof valid !== 'boolean') {
|
|
2372
2439
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
|
|
2373
2440
|
}
|
|
2374
|
-
else if (!
|
|
2441
|
+
else if (!index_es.me(errorMessage)) {
|
|
2375
2442
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
|
|
2376
2443
|
}
|
|
2377
2444
|
else {
|
|
@@ -2380,6 +2447,17 @@ const MgInputNumeric = class {
|
|
|
2380
2447
|
this.hasDisplayedError = this.invalid;
|
|
2381
2448
|
}
|
|
2382
2449
|
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Reset value, validity and error state
|
|
2452
|
+
*/
|
|
2453
|
+
async reset() {
|
|
2454
|
+
if (!this.readonly) {
|
|
2455
|
+
this.value = '';
|
|
2456
|
+
this.checkValidity();
|
|
2457
|
+
this.errorMessage = undefined;
|
|
2458
|
+
this.hasDisplayedError = false;
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2383
2461
|
/**
|
|
2384
2462
|
* Method to set validity values
|
|
2385
2463
|
* @param newValue - valid new value
|
|
@@ -2466,7 +2544,7 @@ const MgInputNumeric = class {
|
|
|
2466
2544
|
* @returns HTML Element
|
|
2467
2545
|
*/
|
|
2468
2546
|
render() {
|
|
2469
|
-
return (index.h("mg-input", { key: '
|
|
2547
|
+
return (index.h("mg-input", { key: '6d34c2b7e9762cdefc5de3814ff4afd95fa4a6a6', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
|
|
2470
2548
|
? this.readonlyValue && this.renderReadonly()
|
|
2471
2549
|
: [
|
|
2472
2550
|
index.h("input", { key: "input", type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
@@ -2493,7 +2571,7 @@ const MgInputNumeric = class {
|
|
|
2493
2571
|
};
|
|
2494
2572
|
MgInputNumeric.style = MgInputNumericStyle0;
|
|
2495
2573
|
|
|
2496
|
-
const mgInputPasswordCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)
|
|
2574
|
+
const mgInputPasswordCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--password .mg-c-input__input-icon{color:var(--mg-b-color-dark)}.mg-c-input.mg-c-input--password .mg-c-input__input-group{position:relative;flex-grow:1}.mg-c-input.mg-c-input--password .mg-c-input__append-button{position:absolute;right:0}.mg-c-input.mg-c-input--password .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-8))}.mg-c-input.mg-c-input--password .mg-c-input__box::-ms-reveal{display:none}";
|
|
2497
2575
|
const MgInputPasswordStyle0 = mgInputPasswordCss;
|
|
2498
2576
|
|
|
2499
2577
|
const MgInputPassword = class {
|
|
@@ -2569,7 +2647,7 @@ const MgInputPassword = class {
|
|
|
2569
2647
|
this.helpText = undefined;
|
|
2570
2648
|
this.valid = undefined;
|
|
2571
2649
|
this.invalid = undefined;
|
|
2572
|
-
this.classCollection = new
|
|
2650
|
+
this.classCollection = new index_es.Xe(['mg-c-input--password']);
|
|
2573
2651
|
this.errorMessage = undefined;
|
|
2574
2652
|
this.displayPassword = false;
|
|
2575
2653
|
}
|
|
@@ -2627,7 +2705,7 @@ const MgInputPassword = class {
|
|
|
2627
2705
|
if (typeof valid !== 'boolean') {
|
|
2628
2706
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
|
|
2629
2707
|
}
|
|
2630
|
-
else if (!
|
|
2708
|
+
else if (!index_es.me(errorMessage)) {
|
|
2631
2709
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
|
|
2632
2710
|
}
|
|
2633
2711
|
else {
|
|
@@ -2636,6 +2714,17 @@ const MgInputPassword = class {
|
|
|
2636
2714
|
this.hasDisplayedError = this.invalid;
|
|
2637
2715
|
}
|
|
2638
2716
|
}
|
|
2717
|
+
/**
|
|
2718
|
+
* Reset value, validity and error state
|
|
2719
|
+
*/
|
|
2720
|
+
async reset() {
|
|
2721
|
+
if (!this.readonly) {
|
|
2722
|
+
this.value = '';
|
|
2723
|
+
this.checkValidity();
|
|
2724
|
+
this.errorMessage = undefined;
|
|
2725
|
+
this.hasDisplayedError = false;
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2639
2728
|
/**
|
|
2640
2729
|
* Method to set validity values
|
|
2641
2730
|
* @param newValue - valid new value
|
|
@@ -2673,7 +2762,7 @@ const MgInputPassword = class {
|
|
|
2673
2762
|
* @returns HTML Element
|
|
2674
2763
|
*/
|
|
2675
2764
|
render() {
|
|
2676
|
-
return (index.h("mg-input", { key: '
|
|
2765
|
+
return (index.h("mg-input", { key: 'af313cb20a94a9c8dcf2b944c31b7ea36b2d3feb', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && index.h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (index.h("span", { class: "mg-c-input__input-group" }, index.h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
2677
2766
|
if (el !== null)
|
|
2678
2767
|
this.input = el;
|
|
2679
2768
|
} }), index.h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, index.h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
|
|
@@ -2774,14 +2863,15 @@ const MgInputRadio = class {
|
|
|
2774
2863
|
this.helpText = undefined;
|
|
2775
2864
|
this.valid = undefined;
|
|
2776
2865
|
this.invalid = undefined;
|
|
2777
|
-
this.classCollection = new
|
|
2866
|
+
this.classCollection = new index_es.Xe(['mg-c-input--radio', classFieldset]);
|
|
2778
2867
|
this.errorMessage = undefined;
|
|
2779
2868
|
this.options = undefined;
|
|
2780
2869
|
this.readonlyValue = undefined;
|
|
2781
2870
|
}
|
|
2871
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2782
2872
|
watchValue(newValue) {
|
|
2783
2873
|
var _a;
|
|
2784
|
-
if (
|
|
2874
|
+
if (index_es.Je(this.items) && typeof newValue === 'string') {
|
|
2785
2875
|
this.readonlyValue = newValue;
|
|
2786
2876
|
}
|
|
2787
2877
|
else if (Array.isArray(this.items) && this.items.every(isOption$3)) {
|
|
@@ -2795,10 +2885,10 @@ const MgInputRadio = class {
|
|
|
2795
2885
|
validateItems(newValue) {
|
|
2796
2886
|
// Validate if items have required min length
|
|
2797
2887
|
if (typeof newValue === 'object' && newValue.length < 2) {
|
|
2798
|
-
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${
|
|
2888
|
+
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2799
2889
|
}
|
|
2800
2890
|
// String array
|
|
2801
|
-
else if (
|
|
2891
|
+
else if (index_es.Je(newValue)) {
|
|
2802
2892
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
2803
2893
|
}
|
|
2804
2894
|
// Object array
|
|
@@ -2806,7 +2896,7 @@ const MgInputRadio = class {
|
|
|
2806
2896
|
this.options = newValue;
|
|
2807
2897
|
}
|
|
2808
2898
|
else {
|
|
2809
|
-
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${
|
|
2899
|
+
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2810
2900
|
}
|
|
2811
2901
|
}
|
|
2812
2902
|
watchInputVerticalList(newValue) {
|
|
@@ -2857,7 +2947,7 @@ const MgInputRadio = class {
|
|
|
2857
2947
|
if (typeof valid !== 'boolean') {
|
|
2858
2948
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');
|
|
2859
2949
|
}
|
|
2860
|
-
else if (!
|
|
2950
|
+
else if (!index_es.me(errorMessage)) {
|
|
2861
2951
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');
|
|
2862
2952
|
}
|
|
2863
2953
|
else {
|
|
@@ -2866,6 +2956,17 @@ const MgInputRadio = class {
|
|
|
2866
2956
|
this.hasDisplayedError = this.invalid;
|
|
2867
2957
|
}
|
|
2868
2958
|
}
|
|
2959
|
+
/**
|
|
2960
|
+
* Reset value, validity and error state
|
|
2961
|
+
*/
|
|
2962
|
+
async reset() {
|
|
2963
|
+
if (!this.readonly) {
|
|
2964
|
+
this.value = undefined;
|
|
2965
|
+
this.checkValidity();
|
|
2966
|
+
this.errorMessage = undefined;
|
|
2967
|
+
this.hasDisplayedError = false;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2869
2970
|
/**
|
|
2870
2971
|
* Method to set validity values
|
|
2871
2972
|
* @param newValue - valid new value
|
|
@@ -2906,7 +3007,7 @@ const MgInputRadio = class {
|
|
|
2906
3007
|
* @returns HTML Element
|
|
2907
3008
|
*/
|
|
2908
3009
|
render() {
|
|
2909
|
-
return (index.h("mg-input", { key: '
|
|
3010
|
+
return (index.h("mg-input", { key: '1f27ea2672375c28b2b7afca66ebd09f8dfc2354', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && index.h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (index.h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index$1) => (index.h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, index.h("input", { type: "radio", id: this.identifier + '_' + index$1, name: this.identifier, value: index$1, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index$1].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
|
|
2910
3011
|
if (el !== null)
|
|
2911
3012
|
this.inputs[index$1] = el;
|
|
2912
3013
|
} }), index.h("label", { htmlFor: this.identifier + '_' + index$1 }, input.title))))))));
|
|
@@ -2923,7 +3024,7 @@ const MgInputRadio = class {
|
|
|
2923
3024
|
};
|
|
2924
3025
|
MgInputRadio.style = MgInputRadioStyle0;
|
|
2925
3026
|
|
|
2926
|
-
const mgInputSelectCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)
|
|
3027
|
+
const mgInputSelectCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
|
|
2927
3028
|
const MgInputSelectStyle0 = mgInputSelectCss;
|
|
2928
3029
|
|
|
2929
3030
|
/**
|
|
@@ -3004,7 +3105,7 @@ const MgInputSelect = class {
|
|
|
3004
3105
|
if (this.input.value === '') {
|
|
3005
3106
|
this.setValue(null);
|
|
3006
3107
|
}
|
|
3007
|
-
else if (
|
|
3108
|
+
else if (index_es.Je(this.items) && this.items.includes(this.input.value)) {
|
|
3008
3109
|
this.setValue(this.input.value);
|
|
3009
3110
|
}
|
|
3010
3111
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3078,7 +3179,7 @@ const MgInputSelect = class {
|
|
|
3078
3179
|
this.helpText = undefined;
|
|
3079
3180
|
this.valid = undefined;
|
|
3080
3181
|
this.invalid = undefined;
|
|
3081
|
-
this.classCollection = new
|
|
3182
|
+
this.classCollection = new index_es.Xe(['mg-c-input--select']);
|
|
3082
3183
|
this.errorMessage = undefined;
|
|
3083
3184
|
this.options = undefined;
|
|
3084
3185
|
this.valueExist = undefined;
|
|
@@ -3086,7 +3187,7 @@ const MgInputSelect = class {
|
|
|
3086
3187
|
}
|
|
3087
3188
|
validateValue(newValue) {
|
|
3088
3189
|
var _a, _b;
|
|
3089
|
-
if (
|
|
3190
|
+
if (index_es.Je(this.items) && typeof newValue === 'string') {
|
|
3090
3191
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) !== undefined ? this.input.value : newValue;
|
|
3091
3192
|
}
|
|
3092
3193
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3103,7 +3204,7 @@ const MgInputSelect = class {
|
|
|
3103
3204
|
this.options = [];
|
|
3104
3205
|
}
|
|
3105
3206
|
// String array
|
|
3106
|
-
else if (
|
|
3207
|
+
else if (index_es.Je(newValue)) {
|
|
3107
3208
|
if (typeof this.value === 'string')
|
|
3108
3209
|
this.valueExist = newValue.includes(this.value);
|
|
3109
3210
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3121,7 +3222,7 @@ const MgInputSelect = class {
|
|
|
3121
3222
|
}
|
|
3122
3223
|
}
|
|
3123
3224
|
else {
|
|
3124
|
-
throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${
|
|
3225
|
+
throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3125
3226
|
}
|
|
3126
3227
|
}
|
|
3127
3228
|
watchReadonly(newValue) {
|
|
@@ -3175,7 +3276,7 @@ const MgInputSelect = class {
|
|
|
3175
3276
|
if (typeof valid !== 'boolean') {
|
|
3176
3277
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean.');
|
|
3177
3278
|
}
|
|
3178
|
-
else if (!
|
|
3279
|
+
else if (!index_es.me(errorMessage)) {
|
|
3179
3280
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string.');
|
|
3180
3281
|
}
|
|
3181
3282
|
else {
|
|
@@ -3184,6 +3285,17 @@ const MgInputSelect = class {
|
|
|
3184
3285
|
this.hasDisplayedError = this.invalid;
|
|
3185
3286
|
}
|
|
3186
3287
|
}
|
|
3288
|
+
/**
|
|
3289
|
+
* Reset value, validity and error state
|
|
3290
|
+
*/
|
|
3291
|
+
async reset() {
|
|
3292
|
+
if (!this.readonly) {
|
|
3293
|
+
this.value = null;
|
|
3294
|
+
this.checkValidity();
|
|
3295
|
+
this.errorMessage = undefined;
|
|
3296
|
+
this.hasDisplayedError = false;
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3187
3299
|
/**
|
|
3188
3300
|
* Method to set validity values
|
|
3189
3301
|
* @param newValue - valid new value
|
|
@@ -3228,7 +3340,7 @@ const MgInputSelect = class {
|
|
|
3228
3340
|
* @returns HTML Element
|
|
3229
3341
|
*/
|
|
3230
3342
|
render() {
|
|
3231
|
-
return (index.h("mg-input", { key: '
|
|
3343
|
+
return (index.h("mg-input", { key: '23ce3f91b4a5abdbd9b9731a895ca38d37b8c0a5', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && index.h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (index.h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
3232
3344
|
if (el !== null)
|
|
3233
3345
|
this.input = el;
|
|
3234
3346
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
@@ -3246,7 +3358,7 @@ const MgInputSelect = class {
|
|
|
3246
3358
|
};
|
|
3247
3359
|
MgInputSelect.style = MgInputSelectStyle0;
|
|
3248
3360
|
|
|
3249
|
-
const mgInputTextCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)
|
|
3361
|
+
const mgInputTextCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__error ::slotted(*){margin-top:0}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__with-character-left{position:relative;width:100%}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left .mg-c-input__box{padding-right:max(var(--mg-c-character-left-message-length)*(.35ch + .3rem) + var(--mg-b-size-16)*clamp(0,var(--mg-c-character-left-message-length),1),var(--mg-b-size-8))}.mg-c-input__with-character-left mg-character-left{position:absolute;top:50%;right:var(--mg-b-size-8);display:none;font-size:var(--mg-b-font-size-small);opacity:.6;transform:translateY(-50%)}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{display:block}.mg-c-input.mg-c-input--readonly b{min-height:var(--mg-b-font-size);margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}";
|
|
3250
3362
|
const MgInputTextStyle0 = mgInputTextCss;
|
|
3251
3363
|
|
|
3252
3364
|
/**
|
|
@@ -3260,7 +3372,7 @@ const isOption$1 = (option) => typeof option === 'object' && typeof option.title
|
|
|
3260
3372
|
* @param options - Datalist options to check.
|
|
3261
3373
|
* @returns True if datalist is well structured.
|
|
3262
3374
|
*/
|
|
3263
|
-
const isDatalistOptions = (options) =>
|
|
3375
|
+
const isDatalistOptions = (options) => index_es.Je(options) || (Array.isArray(options) && options.every(isOption$1));
|
|
3264
3376
|
const MgInputText = class {
|
|
3265
3377
|
constructor(hostRef) {
|
|
3266
3378
|
index.registerInstance(this, hostRef);
|
|
@@ -3292,7 +3404,7 @@ const MgInputText = class {
|
|
|
3292
3404
|
*/
|
|
3293
3405
|
this.handleFocus = () => {
|
|
3294
3406
|
this.classCollection.add(this.classFocus);
|
|
3295
|
-
this.classCollection = new
|
|
3407
|
+
this.classCollection = new index_es.Xe(this.classCollection.classes);
|
|
3296
3408
|
};
|
|
3297
3409
|
/**
|
|
3298
3410
|
* Handle blur event
|
|
@@ -3300,7 +3412,7 @@ const MgInputText = class {
|
|
|
3300
3412
|
this.handleBlur = () => {
|
|
3301
3413
|
// Manage focus
|
|
3302
3414
|
this.classCollection.delete(this.classFocus);
|
|
3303
|
-
this.classCollection = new
|
|
3415
|
+
this.classCollection = new index_es.Xe(this.classCollection.classes);
|
|
3304
3416
|
// Display Error
|
|
3305
3417
|
this.handlerInProgress = 'blur';
|
|
3306
3418
|
this.displayError().finally(() => {
|
|
@@ -3388,7 +3500,7 @@ const MgInputText = class {
|
|
|
3388
3500
|
this.helpText = undefined;
|
|
3389
3501
|
this.valid = undefined;
|
|
3390
3502
|
this.invalid = undefined;
|
|
3391
|
-
this.classCollection = new
|
|
3503
|
+
this.classCollection = new index_es.Xe(['mg-c-input--text']);
|
|
3392
3504
|
this.errorMessage = undefined;
|
|
3393
3505
|
}
|
|
3394
3506
|
handleValue(newValue) {
|
|
@@ -3410,7 +3522,7 @@ const MgInputText = class {
|
|
|
3410
3522
|
}
|
|
3411
3523
|
validateDatalistoptions(newValue) {
|
|
3412
3524
|
if (Boolean(newValue) && !isDatalistOptions(newValue)) {
|
|
3413
|
-
throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${
|
|
3525
|
+
throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3414
3526
|
}
|
|
3415
3527
|
}
|
|
3416
3528
|
watchReadonly(newValue) {
|
|
@@ -3445,8 +3557,8 @@ const MgInputText = class {
|
|
|
3445
3557
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3446
3558
|
}
|
|
3447
3559
|
validatePattern(newValue) {
|
|
3448
|
-
if (newValue !== undefined && !(
|
|
3449
|
-
throw new Error(`<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${
|
|
3560
|
+
if (newValue !== undefined && !(index_es.me(this.pattern) && index_es.me(this.patternErrorMessage))) {
|
|
3561
|
+
throw new Error(`<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${index_es.Ye(this.pattern)}'" and "patternErrorMessage='${index_es.Ye(this.patternErrorMessage)}'".`);
|
|
3450
3562
|
}
|
|
3451
3563
|
}
|
|
3452
3564
|
/**
|
|
@@ -3475,7 +3587,7 @@ const MgInputText = class {
|
|
|
3475
3587
|
if (typeof valid !== 'boolean') {
|
|
3476
3588
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean.');
|
|
3477
3589
|
}
|
|
3478
|
-
else if (!
|
|
3590
|
+
else if (!index_es.me(errorMessage)) {
|
|
3479
3591
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string.');
|
|
3480
3592
|
}
|
|
3481
3593
|
else {
|
|
@@ -3484,6 +3596,17 @@ const MgInputText = class {
|
|
|
3484
3596
|
this.hasDisplayedError = this.invalid;
|
|
3485
3597
|
}
|
|
3486
3598
|
}
|
|
3599
|
+
/**
|
|
3600
|
+
* Reset value, validity and error state
|
|
3601
|
+
*/
|
|
3602
|
+
async reset() {
|
|
3603
|
+
if (!this.readonly) {
|
|
3604
|
+
this.value = '';
|
|
3605
|
+
this.checkValidity();
|
|
3606
|
+
this.errorMessage = undefined;
|
|
3607
|
+
this.hasDisplayedError = false;
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3487
3610
|
/**
|
|
3488
3611
|
* Method to set validity values
|
|
3489
3612
|
* @param newValue - valid new value
|
|
@@ -3529,12 +3652,12 @@ const MgInputText = class {
|
|
|
3529
3652
|
* @returns HTML Element
|
|
3530
3653
|
*/
|
|
3531
3654
|
render() {
|
|
3532
|
-
return (index.h("mg-input", { key: '
|
|
3655
|
+
return (index.h("mg-input", { key: '6ed4f9339354571851d415755b989824f623d62d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
|
|
3533
3656
|
? this.value && this.renderReadonly()
|
|
3534
3657
|
: [
|
|
3535
3658
|
index.h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
|
|
3536
3659
|
'--mg-c-character-left-message-length': (!this.characterLeftHide
|
|
3537
|
-
? (this.maxlength
|
|
3660
|
+
? (this.maxlength.toString().length * 2 + 1)
|
|
3538
3661
|
: 0).toString(),
|
|
3539
3662
|
} }, this.icon !== undefined && index.h("mg-icon", { icon: this.icon }), index.h("input", { type: this.type, class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, list: this.hasDatalist() ? this.datalistId : undefined, autocomplete: this.hasDatalist() ? 'off' : undefined, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
3540
3663
|
if (el !== null)
|
|
@@ -3558,7 +3681,7 @@ const MgInputText = class {
|
|
|
3558
3681
|
};
|
|
3559
3682
|
MgInputText.style = MgInputTextStyle0;
|
|
3560
3683
|
|
|
3561
|
-
const mgInputTextareaCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)
|
|
3684
|
+
const mgInputTextareaCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__error ::slotted(*){margin-top:0}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__input{align-items:start}.mg-c-input__box{display:block;height:auto;resize:none}.mg-c-input__box.mg-c-input__box--resizable{resize:both}.mg-c-input__box.mg-c-input__box--resizable-horizontal{resize:horizontal}.mg-c-input__box.mg-c-input__box--resizable-vertical{resize:vertical}.mg-c-input__readonly-value{white-space:pre-line}.mg-c-input__with-character-left{flex-grow:1}.mg-c-input__with-character-left mg-character-left{display:block;text-align:end;visibility:hidden}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-c-input__box{overflow-x:hidden}}";
|
|
3562
3685
|
const MgInputTextareaStyle0 = mgInputTextareaCss;
|
|
3563
3686
|
|
|
3564
3687
|
const MgInputTextarea = class {
|
|
@@ -3589,7 +3712,7 @@ const MgInputTextarea = class {
|
|
|
3589
3712
|
*/
|
|
3590
3713
|
this.handleFocus = () => {
|
|
3591
3714
|
this.classCollection.add(this.classFocus);
|
|
3592
|
-
this.classCollection = new
|
|
3715
|
+
this.classCollection = new index_es.Xe(this.classCollection.classes);
|
|
3593
3716
|
};
|
|
3594
3717
|
/**
|
|
3595
3718
|
* Handle blur event
|
|
@@ -3597,7 +3720,7 @@ const MgInputTextarea = class {
|
|
|
3597
3720
|
this.handleBlur = () => {
|
|
3598
3721
|
// Manage focus
|
|
3599
3722
|
this.classCollection.delete(this.classFocus);
|
|
3600
|
-
this.classCollection = new
|
|
3723
|
+
this.classCollection = new index_es.Xe(this.classCollection.classes);
|
|
3601
3724
|
// Display Error
|
|
3602
3725
|
this.handlerInProgress = 'blur';
|
|
3603
3726
|
this.displayError().finally(() => {
|
|
@@ -3660,7 +3783,7 @@ const MgInputTextarea = class {
|
|
|
3660
3783
|
this.valid = undefined;
|
|
3661
3784
|
this.invalid = undefined;
|
|
3662
3785
|
this.resizable = 'none';
|
|
3663
|
-
this.classCollection = new
|
|
3786
|
+
this.classCollection = new index_es.Xe(['mg-c-input--textarea']);
|
|
3664
3787
|
this.errorMessage = undefined;
|
|
3665
3788
|
}
|
|
3666
3789
|
handleValue(newValue) {
|
|
@@ -3699,8 +3822,8 @@ const MgInputTextarea = class {
|
|
|
3699
3822
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3700
3823
|
}
|
|
3701
3824
|
validatePattern(newValue) {
|
|
3702
|
-
if (newValue !== undefined && !(
|
|
3703
|
-
throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${
|
|
3825
|
+
if (newValue !== undefined && !(index_es.me(this.pattern) && index_es.me(this.patternErrorMessage))) {
|
|
3826
|
+
throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${index_es.Ye(this.pattern)}'" and "patternErrorMessage='${index_es.Ye(this.patternErrorMessage)}'".`);
|
|
3704
3827
|
}
|
|
3705
3828
|
}
|
|
3706
3829
|
validatecharacterLeftHide(newValue) {
|
|
@@ -3731,7 +3854,7 @@ const MgInputTextarea = class {
|
|
|
3731
3854
|
if (typeof valid !== 'boolean') {
|
|
3732
3855
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean.');
|
|
3733
3856
|
}
|
|
3734
|
-
else if (!
|
|
3857
|
+
else if (!index_es.me(errorMessage)) {
|
|
3735
3858
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string.');
|
|
3736
3859
|
}
|
|
3737
3860
|
else {
|
|
@@ -3740,6 +3863,17 @@ const MgInputTextarea = class {
|
|
|
3740
3863
|
this.hasDisplayedError = this.invalid;
|
|
3741
3864
|
}
|
|
3742
3865
|
}
|
|
3866
|
+
/**
|
|
3867
|
+
* Reset value, validity and error state
|
|
3868
|
+
*/
|
|
3869
|
+
async reset() {
|
|
3870
|
+
if (!this.readonly) {
|
|
3871
|
+
this.value = '';
|
|
3872
|
+
this.checkValidity();
|
|
3873
|
+
this.errorMessage = undefined;
|
|
3874
|
+
this.hasDisplayedError = false;
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3743
3877
|
/**
|
|
3744
3878
|
* Method to set validity values
|
|
3745
3879
|
* @param newValue - valid new value
|
|
@@ -3782,7 +3916,7 @@ const MgInputTextarea = class {
|
|
|
3782
3916
|
* @returns HTML Element
|
|
3783
3917
|
*/
|
|
3784
3918
|
render() {
|
|
3785
|
-
return (index.h("mg-input", { key: '
|
|
3919
|
+
return (index.h("mg-input", { key: '311c9e0b36a6373aff8e3ca666dd4af93c2c1137', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && index.h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (index.h("div", { class: "mg-c-input__with-character-left" }, index.h("textarea", { class: {
|
|
3786
3920
|
'mg-c-input__box': true,
|
|
3787
3921
|
'mg-c-input__box--width': true,
|
|
3788
3922
|
'mg-c-input__box--resizable': this.resizable === 'both',
|
|
@@ -3820,11 +3954,11 @@ const MgInputTitle = class {
|
|
|
3820
3954
|
this.tagName = 'label';
|
|
3821
3955
|
}
|
|
3822
3956
|
validateIdentifier(newValue) {
|
|
3823
|
-
if (!
|
|
3957
|
+
if (!index_es.me(newValue)) {
|
|
3824
3958
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
3825
3959
|
}
|
|
3826
|
-
else if (!
|
|
3827
|
-
console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${
|
|
3960
|
+
else if (!index_es.Ge(newValue)) {
|
|
3961
|
+
console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3828
3962
|
}
|
|
3829
3963
|
}
|
|
3830
3964
|
validateIsLegend(newValue) {
|
|
@@ -3937,12 +4071,13 @@ const MgInputToggle = class {
|
|
|
3937
4071
|
this.tooltip = undefined;
|
|
3938
4072
|
this.tooltipPosition = 'input';
|
|
3939
4073
|
this.helpText = undefined;
|
|
3940
|
-
this.classCollection = new
|
|
4074
|
+
this.classCollection = new index_es.Xe(['mg-c-input--toggle']);
|
|
3941
4075
|
this.options = undefined;
|
|
3942
4076
|
this.errorMessage = undefined;
|
|
3943
4077
|
this.valid = undefined;
|
|
3944
4078
|
this.checked = false;
|
|
3945
4079
|
}
|
|
4080
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3946
4081
|
handleValue(newValue) {
|
|
3947
4082
|
// Swich to the right option
|
|
3948
4083
|
this.setChecked();
|
|
@@ -3951,10 +4086,10 @@ const MgInputToggle = class {
|
|
|
3951
4086
|
}
|
|
3952
4087
|
validateItems(newValue) {
|
|
3953
4088
|
if (typeof newValue === 'object' && this.items.length !== 2) {
|
|
3954
|
-
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${
|
|
4089
|
+
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3955
4090
|
}
|
|
3956
4091
|
// String array
|
|
3957
|
-
else if (
|
|
4092
|
+
else if (index_es.Je(newValue)) {
|
|
3958
4093
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
3959
4094
|
}
|
|
3960
4095
|
// Object array
|
|
@@ -3962,7 +4097,7 @@ const MgInputToggle = class {
|
|
|
3962
4097
|
this.options = newValue;
|
|
3963
4098
|
}
|
|
3964
4099
|
else {
|
|
3965
|
-
throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${
|
|
4100
|
+
throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3966
4101
|
}
|
|
3967
4102
|
}
|
|
3968
4103
|
watchIsOnOff(newValue) {
|
|
@@ -4010,7 +4145,7 @@ const MgInputToggle = class {
|
|
|
4010
4145
|
if (typeof valid !== 'boolean') {
|
|
4011
4146
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
|
|
4012
4147
|
}
|
|
4013
|
-
else if (!
|
|
4148
|
+
else if (!index_es.me(errorMessage)) {
|
|
4014
4149
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
|
|
4015
4150
|
}
|
|
4016
4151
|
else {
|
|
@@ -4019,6 +4154,17 @@ const MgInputToggle = class {
|
|
|
4019
4154
|
this.setErrorMessage(valid ? undefined : errorMessage);
|
|
4020
4155
|
}
|
|
4021
4156
|
}
|
|
4157
|
+
/**
|
|
4158
|
+
* Reset value, validity, error and visual state
|
|
4159
|
+
*/
|
|
4160
|
+
async reset() {
|
|
4161
|
+
if (!this.readonly) {
|
|
4162
|
+
this.value = this.options[0].value;
|
|
4163
|
+
this.errorMessage = undefined;
|
|
4164
|
+
this.valid = undefined;
|
|
4165
|
+
this.setChecked();
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4022
4168
|
/**
|
|
4023
4169
|
* set checked state
|
|
4024
4170
|
*/
|
|
@@ -4066,7 +4212,7 @@ const MgInputToggle = class {
|
|
|
4066
4212
|
*/
|
|
4067
4213
|
render() {
|
|
4068
4214
|
const checkedItem = this.getCheckedItem(this.checked);
|
|
4069
|
-
return (index.h("mg-input", { key: '
|
|
4215
|
+
return (index.h("mg-input", { key: 'b47ba6e093e47f8405e12744576f2098943e5fbe', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && index.h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (index.h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, index.h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { name: "item-1" })), index.h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { name: "item-2" }))))));
|
|
4070
4216
|
}
|
|
4071
4217
|
get element() { return index.getElement(this); }
|
|
4072
4218
|
static get watchers() { return {
|
|
@@ -4237,12 +4383,11 @@ const MgItemMore = class {
|
|
|
4237
4383
|
*/
|
|
4238
4384
|
this.setProxyElement = (proxified) => {
|
|
4239
4385
|
const proxy = this.moreElementMenuItem.querySelector(`[identifier="${proxified.identifier}"]`);
|
|
4240
|
-
|
|
4241
|
-
if (!proxy) {
|
|
4386
|
+
if (proxy === null) {
|
|
4242
4387
|
return;
|
|
4243
4388
|
}
|
|
4244
4389
|
// remove proxy id to prevent duplicate key. default html id is: '';
|
|
4245
|
-
if (
|
|
4390
|
+
if (index_es.me(proxy.id))
|
|
4246
4391
|
proxy.id = '';
|
|
4247
4392
|
const proxyClickHandler = () => {
|
|
4248
4393
|
this.parentMenu
|
|
@@ -4286,7 +4431,7 @@ const MgItemMore = class {
|
|
|
4286
4431
|
// create item-more menu items element from main menu-items clones
|
|
4287
4432
|
this.moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
|
|
4288
4433
|
// we need to get all `mg-menu-item` linked to the cloned one to set mirror process
|
|
4289
|
-
|
|
4434
|
+
index_es.tt(() => {
|
|
4290
4435
|
this.setProxyElement(child);
|
|
4291
4436
|
if (child.querySelector('mg-menu') !== null) {
|
|
4292
4437
|
child.querySelectorAll('mg-menu-item').forEach(this.setProxyElement);
|
|
@@ -4302,17 +4447,17 @@ const MgItemMore = class {
|
|
|
4302
4447
|
}
|
|
4303
4448
|
validateIcon(newValue) {
|
|
4304
4449
|
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
|
|
4305
|
-
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${
|
|
4450
|
+
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4306
4451
|
}
|
|
4307
4452
|
validateSlotLabel(newValue) {
|
|
4308
4453
|
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
|
|
4309
|
-
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${
|
|
4454
|
+
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4310
4455
|
else if (typeof newValue.label !== 'string')
|
|
4311
4456
|
this.slotlabel.label = this.messages.menuLabel;
|
|
4312
4457
|
}
|
|
4313
4458
|
validateSize(newValue) {
|
|
4314
|
-
if (newValue && !sizes$
|
|
4315
|
-
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${
|
|
4459
|
+
if (newValue && !sizes$3.includes(newValue))
|
|
4460
|
+
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4316
4461
|
}
|
|
4317
4462
|
/*************
|
|
4318
4463
|
* Lifecycle *
|
|
@@ -4359,11 +4504,11 @@ const MgItemMore = class {
|
|
|
4359
4504
|
* @returns HTML Element
|
|
4360
4505
|
*/
|
|
4361
4506
|
render() {
|
|
4362
|
-
return (index.h(index.Host, { key: '
|
|
4507
|
+
return (index.h(index.Host, { key: '11c43154129c5756e80db0af3434c88cab2191f3', role: "listitem" }, this.parentMenu && (index.h("mg-menu-item", { key: '38fc92410328c317fb046f4e1ec4f94175d484fb', "data-overflow-more": true, "data-size": this.parentMenu.size, identifier: "mg-item-more", ref: el => {
|
|
4363
4508
|
if (el !== null) {
|
|
4364
4509
|
this.moreElementMenuItem = el;
|
|
4365
4510
|
}
|
|
4366
|
-
} }, index.h("mg-icon", { key: '
|
|
4511
|
+
} }, index.h("mg-icon", { key: '90e21f30004e38a1a0938359276dccd7458e5e86', icon: this.icon.icon, size: this.size, slot: "image" }), index.h("span", { key: '20f846c5718a19d39ad94abf59bab54658e1ff9c', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), index.h("mg-menu", { key: 'b52f97129e736be9164ae18b717057d1bfc0cd0a', direction: Direction.VERTICAL, label: this.messages.menuLabel, size: this.size })))));
|
|
4367
4512
|
}
|
|
4368
4513
|
get element() { return index.getElement(this); }
|
|
4369
4514
|
static get watchers() { return {
|
|
@@ -4472,12 +4617,12 @@ const MgMenu = class {
|
|
|
4472
4617
|
}
|
|
4473
4618
|
validateLabel(newValue) {
|
|
4474
4619
|
if (newValue === undefined && !this.element.hasAttribute('aria-label')) {
|
|
4475
|
-
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${
|
|
4620
|
+
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4476
4621
|
}
|
|
4477
4622
|
}
|
|
4478
4623
|
validateDirection(newValue) {
|
|
4479
4624
|
if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
|
|
4480
|
-
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${
|
|
4625
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4481
4626
|
}
|
|
4482
4627
|
}
|
|
4483
4628
|
validateItemMore(newValue) {
|
|
@@ -4489,8 +4634,8 @@ const MgMenu = class {
|
|
|
4489
4634
|
}
|
|
4490
4635
|
}
|
|
4491
4636
|
validateSize(newValue) {
|
|
4492
|
-
if (!sizes$
|
|
4493
|
-
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$
|
|
4637
|
+
if (!sizes$3.includes(newValue)) {
|
|
4638
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$3.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4494
4639
|
}
|
|
4495
4640
|
}
|
|
4496
4641
|
/*************
|
|
@@ -4614,7 +4759,7 @@ const MgMenuItem = class {
|
|
|
4614
4759
|
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
4615
4760
|
['label', 'metadata'].forEach(slot => {
|
|
4616
4761
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
4617
|
-
if (!
|
|
4762
|
+
if (!index_es.me(element.textContent))
|
|
4618
4763
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
4619
4764
|
if ((guard && !element.hasAttribute('title')) || !guard)
|
|
4620
4765
|
element.setAttribute('title', element.textContent);
|
|
@@ -4683,13 +4828,13 @@ const MgMenuItem = class {
|
|
|
4683
4828
|
* @returns HTML Element
|
|
4684
4829
|
*/
|
|
4685
4830
|
this.renderSlot = () => index.h("slot", null);
|
|
4686
|
-
this.identifier =
|
|
4831
|
+
this.identifier = index_es.qe('mg-menu-item');
|
|
4687
4832
|
this.href = undefined;
|
|
4688
4833
|
this.target = undefined;
|
|
4689
4834
|
this.status = Status$1.VISIBLE;
|
|
4690
4835
|
this.expanded = false;
|
|
4691
4836
|
this.size = 'medium';
|
|
4692
|
-
this.navigationButtonClassList = new
|
|
4837
|
+
this.navigationButtonClassList = new index_es.Xe([this.navigationButton]);
|
|
4693
4838
|
this.direction = undefined;
|
|
4694
4839
|
this.isInMainMenu = undefined;
|
|
4695
4840
|
this.isItemMore = undefined;
|
|
@@ -4697,13 +4842,13 @@ const MgMenuItem = class {
|
|
|
4697
4842
|
this.displayNotificationBadge = undefined;
|
|
4698
4843
|
}
|
|
4699
4844
|
watchIdentifier(newValue) {
|
|
4700
|
-
if (!
|
|
4701
|
-
console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${
|
|
4845
|
+
if (!index_es.Ge(newValue)) {
|
|
4846
|
+
console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4702
4847
|
}
|
|
4703
4848
|
}
|
|
4704
4849
|
watchTarget(newValue) {
|
|
4705
4850
|
if (newValue && !targets.includes(newValue)) {
|
|
4706
|
-
throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${
|
|
4851
|
+
throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4707
4852
|
}
|
|
4708
4853
|
}
|
|
4709
4854
|
validateStatus(newValue, oldValue) {
|
|
@@ -4715,7 +4860,7 @@ const MgMenuItem = class {
|
|
|
4715
4860
|
}
|
|
4716
4861
|
validateExpanded(newValue) {
|
|
4717
4862
|
if (typeof newValue !== 'boolean')
|
|
4718
|
-
throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${
|
|
4863
|
+
throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4719
4864
|
// if menu-item has sub-menu we have to apply some updates:
|
|
4720
4865
|
if (this.hasChildren) {
|
|
4721
4866
|
const subItems = Array.from(this.element.querySelectorAll(this.name));
|
|
@@ -4843,7 +4988,7 @@ const MgMenuItem = class {
|
|
|
4843
4988
|
* @returns promise process wich emit the 'item-updated' event
|
|
4844
4989
|
*/
|
|
4845
4990
|
componentShouldUpdate() {
|
|
4846
|
-
return
|
|
4991
|
+
return index_es.tt(() => {
|
|
4847
4992
|
this.itemUpdated.emit();
|
|
4848
4993
|
});
|
|
4849
4994
|
}
|
|
@@ -4912,12 +5057,12 @@ const MgMessage = class {
|
|
|
4912
5057
|
};
|
|
4913
5058
|
this.variant = 'info';
|
|
4914
5059
|
this.variantStyle = 'bar-left';
|
|
4915
|
-
this.classCollection = new
|
|
5060
|
+
this.classCollection = new index_es.Xe(['mg-c-message']);
|
|
4916
5061
|
this.hasActions = false;
|
|
4917
5062
|
}
|
|
4918
5063
|
watchVariant(newValue, oldValue) {
|
|
4919
5064
|
if (!variants$1.includes(newValue)) {
|
|
4920
|
-
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${
|
|
5065
|
+
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4921
5066
|
}
|
|
4922
5067
|
else {
|
|
4923
5068
|
if (newValue !== undefined)
|
|
@@ -4928,7 +5073,7 @@ const MgMessage = class {
|
|
|
4928
5073
|
}
|
|
4929
5074
|
watchVariantStyle(newValue, oldValue) {
|
|
4930
5075
|
if (!variantStyles.includes(newValue)) {
|
|
4931
|
-
throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${
|
|
5076
|
+
throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4932
5077
|
}
|
|
4933
5078
|
else {
|
|
4934
5079
|
if (newValue !== undefined)
|
|
@@ -4981,6 +5126,7 @@ const MgModal = class {
|
|
|
4981
5126
|
index.registerInstance(this, hostRef);
|
|
4982
5127
|
this.componentShow = index.createEvent(this, "component-show", 7);
|
|
4983
5128
|
this.componentHide = index.createEvent(this, "component-hide", 7);
|
|
5129
|
+
this.componentClose = index.createEvent(this, "component-close", 7);
|
|
4984
5130
|
// IDs
|
|
4985
5131
|
this.titleId = '';
|
|
4986
5132
|
/***********
|
|
@@ -4991,27 +5137,28 @@ const MgModal = class {
|
|
|
4991
5137
|
*/
|
|
4992
5138
|
this.handleClose = () => {
|
|
4993
5139
|
this.open = false;
|
|
5140
|
+
this.componentClose.emit();
|
|
4994
5141
|
};
|
|
4995
|
-
this.identifier =
|
|
5142
|
+
this.identifier = index_es.qe('mg-modal');
|
|
4996
5143
|
this.dialogRole = dialogRoles[0];
|
|
4997
5144
|
this.modalTitle = undefined;
|
|
4998
5145
|
this.closeButton = false;
|
|
4999
5146
|
this.open = false;
|
|
5000
5147
|
this.hasActions = false;
|
|
5001
|
-
this.classCollection = new
|
|
5148
|
+
this.classCollection = new index_es.Xe(['mg-c-modal']);
|
|
5002
5149
|
}
|
|
5003
5150
|
watchIdentifier(newValue) {
|
|
5004
|
-
if (!
|
|
5005
|
-
throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${
|
|
5151
|
+
if (!index_es.Ge(newValue)) {
|
|
5152
|
+
throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5006
5153
|
}
|
|
5007
5154
|
}
|
|
5008
5155
|
validateDialogRole(newValue) {
|
|
5009
5156
|
if (!dialogRoles.includes(newValue))
|
|
5010
|
-
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${
|
|
5157
|
+
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5011
5158
|
}
|
|
5012
5159
|
validateModalTitle(newValue) {
|
|
5013
|
-
if (!
|
|
5014
|
-
throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${
|
|
5160
|
+
if (!index_es.me(newValue)) {
|
|
5161
|
+
throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5015
5162
|
}
|
|
5016
5163
|
}
|
|
5017
5164
|
watchOpen(newValue) {
|
|
@@ -5052,6 +5199,7 @@ const MgModal = class {
|
|
|
5052
5199
|
// update open prop when use escape key
|
|
5053
5200
|
this.dialog.addEventListener('close', () => {
|
|
5054
5201
|
this.open = false;
|
|
5202
|
+
this.componentClose.emit();
|
|
5055
5203
|
});
|
|
5056
5204
|
}
|
|
5057
5205
|
/**
|
|
@@ -5059,13 +5207,11 @@ const MgModal = class {
|
|
|
5059
5207
|
* @returns HTML Element
|
|
5060
5208
|
*/
|
|
5061
5209
|
render() {
|
|
5062
|
-
return (index.h("dialog", { key: '
|
|
5210
|
+
return (index.h("dialog", { key: 'e4091c6fa70e4b7bccd24db2212e0d2b94ae3099', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
|
|
5063
5211
|
if (el !== null) {
|
|
5064
5212
|
this.dialog = el;
|
|
5065
5213
|
}
|
|
5066
|
-
} }, index.h("mg-card", { key: '
|
|
5067
|
-
// eslint-disable-next-line react/jsx-no-bind
|
|
5068
|
-
onClick: this.handleClose }, index.h("mg-icon", { key: '256f467d254ba056505d8b0fdffbbef0bc426b37', icon: "cross" })))), index.h("h1", { key: '9812cb37e4cc713309191d53a83526b1970389c1', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), index.h("article", { key: 'a83b1be738c8556d60e1c0c74c7adb24c751bdf9', class: "mg-c-modal__content" }, index.h("slot", { key: '3431c31ac066e43748063cc28daa785ae39f7b25' })), this.hasActions && (index.h("footer", { key: '0080243246ca901e0566fd947e74737c12fc2426', class: "mg-c-modal__footer" }, index.h("slot", { key: '044104989259ebd5a3ca8b84a24b7b1e844b7d7e', name: "actions" })))))));
|
|
5214
|
+
} }, index.h("mg-card", { key: 'd674065eb361fbae99545e79840ee13779dff236' }, index.h("div", { key: 'f3c7464c97710c9b58db1e4ad5b3c80c43de5493', class: "mg-c-modal__dialog" }, index.h("header", { key: 'b6f714cdaf553e26ab1a8212608a50949cfc0395', class: "mg-c-modal__header" }, this.closeButton && (index.h("span", { key: '95310b0c375e412da21487ae68cb3437afdf7537', class: "mg-c-modal__close-button" }, index.h("mg-button", { key: '29303f06b8db367aaa372196996b2ab074d799f2', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, index.h("mg-icon", { key: '153eb9f3039422b5e9c554a7878ebc9678b2a997', icon: "cross" })))), index.h("h1", { key: 'fae980d224a9947ac11ae6d7ddddcc7591ba695f', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), index.h("article", { key: 'e5efb0df7f7726f454d7f4347c8f5cee7bac1f00', class: "mg-c-modal__content" }, index.h("slot", { key: '38eeb27cf83588402e6ebc0d674e3967c45576ea' })), this.hasActions && (index.h("footer", { key: 'c50c3bde92a3e6fae3a047ad7803a8f80f277eeb', class: "mg-c-modal__footer" }, index.h("slot", { key: '777984d09b3df311a2f6e30dda664dfe0771bfd4', name: "actions" })))))));
|
|
5069
5215
|
}
|
|
5070
5216
|
get element() { return index.getElement(this); }
|
|
5071
5217
|
static get watchers() { return {
|
|
@@ -5137,7 +5283,7 @@ const MgPagination = class {
|
|
|
5137
5283
|
this.handleGoToPage = (action, disabled) => {
|
|
5138
5284
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
5139
5285
|
};
|
|
5140
|
-
this.identifier =
|
|
5286
|
+
this.identifier = index_es.qe('mg-pagination');
|
|
5141
5287
|
this.label = undefined;
|
|
5142
5288
|
this.hideNavigationLabels = undefined;
|
|
5143
5289
|
this.hidePageCount = undefined;
|
|
@@ -5145,18 +5291,18 @@ const MgPagination = class {
|
|
|
5145
5291
|
this.currentPage = 1;
|
|
5146
5292
|
}
|
|
5147
5293
|
watchIdentifier(newValue) {
|
|
5148
|
-
if (!
|
|
5149
|
-
console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${
|
|
5294
|
+
if (!index_es.Ge(newValue)) {
|
|
5295
|
+
console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5150
5296
|
}
|
|
5151
5297
|
}
|
|
5152
5298
|
validateTotalPages(newValue) {
|
|
5153
5299
|
if (newValue < 1) {
|
|
5154
|
-
throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${
|
|
5300
|
+
throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5155
5301
|
}
|
|
5156
5302
|
}
|
|
5157
5303
|
validateCurrentPage(newValue) {
|
|
5158
5304
|
if (newValue < 1) {
|
|
5159
|
-
throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${
|
|
5305
|
+
throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5160
5306
|
}
|
|
5161
5307
|
else if (newValue > this.totalPages) {
|
|
5162
5308
|
throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page.');
|
|
@@ -5309,7 +5455,7 @@ const MgPanel = class {
|
|
|
5309
5455
|
];
|
|
5310
5456
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
5311
5457
|
};
|
|
5312
|
-
this.identifier =
|
|
5458
|
+
this.identifier = index_es.qe('mg-panel');
|
|
5313
5459
|
this.panelTitle = undefined;
|
|
5314
5460
|
this.titlePattern = undefined;
|
|
5315
5461
|
this.titlePatternErrorMessage = undefined;
|
|
@@ -5318,18 +5464,18 @@ const MgPanel = class {
|
|
|
5318
5464
|
this.expanded = false;
|
|
5319
5465
|
this.expandToggleDisplay = expandToggleDisplays[0];
|
|
5320
5466
|
this.expandToggleDisabled = undefined;
|
|
5321
|
-
this.classCollection = new
|
|
5467
|
+
this.classCollection = new index_es.Xe(['mg-c-panel']);
|
|
5322
5468
|
this.isEditing = false;
|
|
5323
5469
|
this.updatedPanelTitle = undefined;
|
|
5324
5470
|
}
|
|
5325
5471
|
watchIdentifier(newValue) {
|
|
5326
|
-
if (!
|
|
5327
|
-
console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${
|
|
5472
|
+
if (!index_es.Ge(newValue)) {
|
|
5473
|
+
console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5328
5474
|
}
|
|
5329
5475
|
}
|
|
5330
5476
|
validatePanelTitle(newValue) {
|
|
5331
|
-
if (!
|
|
5332
|
-
throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${
|
|
5477
|
+
if (!index_es.me(newValue))
|
|
5478
|
+
throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5333
5479
|
this.titleChange.emit(newValue);
|
|
5334
5480
|
}
|
|
5335
5481
|
validateTitlePattern(newValue) {
|
|
@@ -5338,14 +5484,14 @@ const MgPanel = class {
|
|
|
5338
5484
|
}
|
|
5339
5485
|
validateTitlePosition(newValue) {
|
|
5340
5486
|
if (!titlePositions.includes(newValue))
|
|
5341
|
-
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${
|
|
5487
|
+
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5342
5488
|
}
|
|
5343
5489
|
handleExpanded(newValue) {
|
|
5344
5490
|
this.expandedChange.emit(newValue);
|
|
5345
5491
|
}
|
|
5346
5492
|
validateExpandToggleDisplay(newValue) {
|
|
5347
5493
|
if (!expandToggleDisplays.includes(newValue))
|
|
5348
|
-
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${
|
|
5494
|
+
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5349
5495
|
if (newValue === 'icon' && this.titleEditable)
|
|
5350
5496
|
this.titleEditable = false;
|
|
5351
5497
|
}
|
|
@@ -7193,6 +7339,7 @@ const MgPopover = class {
|
|
|
7193
7339
|
constructor(hostRef) {
|
|
7194
7340
|
index.registerInstance(this, hostRef);
|
|
7195
7341
|
this.displayChange = index.createEvent(this, "display-change", 7);
|
|
7342
|
+
this.componentClose = index.createEvent(this, "component-close", 7);
|
|
7196
7343
|
/**
|
|
7197
7344
|
* Check if clicked outside of component
|
|
7198
7345
|
* @param event - mouse event
|
|
@@ -7257,6 +7404,7 @@ const MgPopover = class {
|
|
|
7257
7404
|
*/
|
|
7258
7405
|
this.handleHideContent = () => {
|
|
7259
7406
|
this.display = false;
|
|
7407
|
+
this.componentClose.emit();
|
|
7260
7408
|
};
|
|
7261
7409
|
/**
|
|
7262
7410
|
* Render popover content element
|
|
@@ -7284,7 +7432,7 @@ const MgPopover = class {
|
|
|
7284
7432
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
7285
7433
|
}
|
|
7286
7434
|
};
|
|
7287
|
-
this.identifier =
|
|
7435
|
+
this.identifier = index_es.qe('mg-popover');
|
|
7288
7436
|
this.placement = 'bottom';
|
|
7289
7437
|
this.arrowHide = false;
|
|
7290
7438
|
this.closeButton = false;
|
|
@@ -7292,8 +7440,8 @@ const MgPopover = class {
|
|
|
7292
7440
|
this.disabled = false;
|
|
7293
7441
|
}
|
|
7294
7442
|
validateIdentifier(newValue) {
|
|
7295
|
-
if (!
|
|
7296
|
-
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${
|
|
7443
|
+
if (!index_es.Ge(newValue)) {
|
|
7444
|
+
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7297
7445
|
}
|
|
7298
7446
|
// use renderPopoverContent to update popover-content id
|
|
7299
7447
|
this.renderPopoverContent();
|
|
@@ -7330,7 +7478,7 @@ const MgPopover = class {
|
|
|
7330
7478
|
*/
|
|
7331
7479
|
componentWillLoad() {
|
|
7332
7480
|
// Get windows to attach events
|
|
7333
|
-
this.windows =
|
|
7481
|
+
this.windows = index_es.Ze(window);
|
|
7334
7482
|
// render mg-popover-content slot
|
|
7335
7483
|
this.renderPopoverContent();
|
|
7336
7484
|
this.validateCloseButton(this.closeButton);
|
|
@@ -7386,6 +7534,7 @@ const MgPopover = class {
|
|
|
7386
7534
|
this.element.addEventListener('keydown', e => {
|
|
7387
7535
|
if (!this.disabled && e.code === 'Escape') {
|
|
7388
7536
|
this.display = false;
|
|
7537
|
+
this.componentClose.emit();
|
|
7389
7538
|
interactiveElement.focus();
|
|
7390
7539
|
}
|
|
7391
7540
|
});
|
|
@@ -7396,7 +7545,7 @@ const MgPopover = class {
|
|
|
7396
7545
|
* @returns HTML Element
|
|
7397
7546
|
*/
|
|
7398
7547
|
render() {
|
|
7399
|
-
return (index.h(index.Host, { key: '
|
|
7548
|
+
return (index.h(index.Host, { key: '659148b3948900bbfe18d0d6898ad0c3a77ccd4d' }, index.h("slot", { key: 'd1fe9c5465fafd8e6a5c42476b2b6096f91ef3ee' }), index.h("slot", { key: 'ac905b983bd5bf55ceea4d7fb0a6de31875cd0ba', name: "content" })));
|
|
7400
7549
|
}
|
|
7401
7550
|
get element() { return index.getElement(this); }
|
|
7402
7551
|
static get watchers() { return {
|
|
@@ -7422,7 +7571,7 @@ const MgPopoverContent = class {
|
|
|
7422
7571
|
this.hideContent.emit();
|
|
7423
7572
|
};
|
|
7424
7573
|
this.closeButton = false;
|
|
7425
|
-
this.classCollection = new
|
|
7574
|
+
this.classCollection = new index_es.Xe(['mg-c-popover-content']);
|
|
7426
7575
|
}
|
|
7427
7576
|
/*************
|
|
7428
7577
|
* Lifecycle *
|
|
@@ -7440,7 +7589,7 @@ const MgPopoverContent = class {
|
|
|
7440
7589
|
componentDidLoad() {
|
|
7441
7590
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
7442
7591
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
7443
|
-
if (slottedTitleElement && !
|
|
7592
|
+
if (slottedTitleElement && !index_es.Ke(slottedTitleElement, headingTags)) {
|
|
7444
7593
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}.`);
|
|
7445
7594
|
}
|
|
7446
7595
|
}
|
|
@@ -7476,7 +7625,7 @@ const MgSkipLinks = class {
|
|
|
7476
7625
|
this.links = undefined;
|
|
7477
7626
|
}
|
|
7478
7627
|
validateLinks(links) {
|
|
7479
|
-
if (links === undefined || links.length === 0 || links.some(link => !
|
|
7628
|
+
if (links === undefined || links.length === 0 || links.some(link => !index_es.me(link.href) || !link.href.startsWith('#') || !index_es.me(link.label))) {
|
|
7480
7629
|
throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
|
|
7481
7630
|
}
|
|
7482
7631
|
}
|
|
@@ -7495,7 +7644,7 @@ const MgSkipLinks = class {
|
|
|
7495
7644
|
* @returns HTML Element
|
|
7496
7645
|
*/
|
|
7497
7646
|
render() {
|
|
7498
|
-
return (index.h("nav", { key: '
|
|
7647
|
+
return (index.h("nav", { key: '0b4e4d6b9481a88faae78602b07c4f5e851da517', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, index.h("ul", { key: 'aaa15193eb2c9e1d9ee3b2e2a7d8d0fd37836ed7', class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (index.h("li", { key: link.href }, index.h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
7499
7648
|
}
|
|
7500
7649
|
get element() { return index.getElement(this); }
|
|
7501
7650
|
static get watchers() { return {
|
|
@@ -7635,7 +7784,7 @@ const MgTabs = class {
|
|
|
7635
7784
|
*/
|
|
7636
7785
|
this.resetFocus = () => {
|
|
7637
7786
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
7638
|
-
|
|
7787
|
+
index_es.tt(() => {
|
|
7639
7788
|
this.tabFocus = undefined;
|
|
7640
7789
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
7641
7790
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -7650,39 +7799,39 @@ const MgTabs = class {
|
|
|
7650
7799
|
if (slots.length !== this.tabs.length)
|
|
7651
7800
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
7652
7801
|
};
|
|
7653
|
-
this.identifier =
|
|
7802
|
+
this.identifier = index_es.qe('mg-tabs');
|
|
7654
7803
|
this.label = undefined;
|
|
7655
7804
|
this.size = 'medium';
|
|
7656
7805
|
this.items = undefined;
|
|
7657
7806
|
this.activeTab = undefined;
|
|
7658
7807
|
this.tabs = [];
|
|
7659
|
-
this.classCollection = new
|
|
7808
|
+
this.classCollection = new index_es.Xe(['mg-c-tabs']);
|
|
7660
7809
|
}
|
|
7661
7810
|
watchIdentifier(newValue) {
|
|
7662
|
-
if (!
|
|
7663
|
-
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${
|
|
7811
|
+
if (!index_es.Ge(newValue)) {
|
|
7812
|
+
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7664
7813
|
}
|
|
7665
7814
|
}
|
|
7666
7815
|
validateLabel(newValue) {
|
|
7667
|
-
if (!
|
|
7668
|
-
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${
|
|
7816
|
+
if (!index_es.me(newValue)) {
|
|
7817
|
+
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7669
7818
|
}
|
|
7670
7819
|
}
|
|
7671
7820
|
validateSize(newValue) {
|
|
7672
7821
|
if (!sizes.includes(newValue)) {
|
|
7673
|
-
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${
|
|
7822
|
+
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7674
7823
|
}
|
|
7675
7824
|
this.classCollection.add(`mg-c-tabs--size-${this.size}`);
|
|
7676
7825
|
}
|
|
7677
7826
|
validateItems(newValue) {
|
|
7678
7827
|
// String array
|
|
7679
|
-
if (
|
|
7828
|
+
if (index_es.Je(newValue))
|
|
7680
7829
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
7681
7830
|
// Object array
|
|
7682
7831
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
7683
7832
|
this.tabs = newValue;
|
|
7684
7833
|
else
|
|
7685
|
-
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${
|
|
7834
|
+
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7686
7835
|
}
|
|
7687
7836
|
validateActiveTab(newValue) {
|
|
7688
7837
|
// when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
|
|
@@ -7707,7 +7856,7 @@ const MgTabs = class {
|
|
|
7707
7856
|
this.activeTabChange.emit(newValue);
|
|
7708
7857
|
}
|
|
7709
7858
|
else {
|
|
7710
|
-
throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${
|
|
7859
|
+
throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${index_es.Ye(newValue)}.`);
|
|
7711
7860
|
}
|
|
7712
7861
|
}
|
|
7713
7862
|
/*************
|
|
@@ -7742,7 +7891,7 @@ const MgTabs = class {
|
|
|
7742
7891
|
* @returns HTML Element
|
|
7743
7892
|
*/
|
|
7744
7893
|
render() {
|
|
7745
|
-
return (index.h("div", { key: '
|
|
7894
|
+
return (index.h("div", { key: '54bad50e0a610aaae267fb34384384a2aa3a2295', class: this.classCollection.join() }, index.h("header", { key: '8bc4f73112f9de115b8558a7d322398b62983fb7', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index$1) => (index.h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index$1), class: {
|
|
7746
7895
|
[`${this.buttonTabBaseClass}`]: true,
|
|
7747
7896
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
7748
7897
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -7781,11 +7930,11 @@ const MgTag = class {
|
|
|
7781
7930
|
this.variant = variants[0];
|
|
7782
7931
|
this.outline = undefined;
|
|
7783
7932
|
this.soft = undefined;
|
|
7784
|
-
this.classCollection = new
|
|
7933
|
+
this.classCollection = new index_es.Xe(['mg-c-tag']);
|
|
7785
7934
|
}
|
|
7786
7935
|
validateVariant(newValue, oldValue) {
|
|
7787
7936
|
if (!variants.includes(newValue)) {
|
|
7788
|
-
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${
|
|
7937
|
+
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7789
7938
|
}
|
|
7790
7939
|
else {
|
|
7791
7940
|
if (oldValue !== undefined) {
|
|
@@ -7818,7 +7967,7 @@ const MgTag = class {
|
|
|
7818
7967
|
* @param textContent - html element textContent property
|
|
7819
7968
|
*/
|
|
7820
7969
|
validateTextContent(textContent) {
|
|
7821
|
-
if (!
|
|
7970
|
+
if (!index_es.me(textContent))
|
|
7822
7971
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
7823
7972
|
}
|
|
7824
7973
|
/*************
|
|
@@ -7877,7 +8026,7 @@ const MgTooltip = class {
|
|
|
7877
8026
|
// Enable the event listeners
|
|
7878
8027
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
7879
8028
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
7880
|
-
|
|
8029
|
+
index_es.tt(() => {
|
|
7881
8030
|
this.windows.forEach((localWindow) => {
|
|
7882
8031
|
localWindow.addEventListener('click', this.handleClickOutside, false);
|
|
7883
8032
|
localWindow.addEventListener('keydown', this.handlePressEscape, false);
|
|
@@ -8073,22 +8222,22 @@ const MgTooltip = class {
|
|
|
8073
8222
|
element.setAttribute('aria-describedby', `${[...new Set([...element.getAttribute('aria-describedby').split(' '), this.identifier])].join(' ')}`);
|
|
8074
8223
|
}
|
|
8075
8224
|
};
|
|
8076
|
-
this.identifier =
|
|
8225
|
+
this.identifier = index_es.qe('mg-tooltip');
|
|
8077
8226
|
this.message = undefined;
|
|
8078
8227
|
this.placement = 'bottom';
|
|
8079
8228
|
this.display = false;
|
|
8080
8229
|
this.disabled = false;
|
|
8081
8230
|
}
|
|
8082
8231
|
watchIdentifier(newValue) {
|
|
8083
|
-
if (!
|
|
8084
|
-
throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${
|
|
8232
|
+
if (!index_es.Ge(newValue)) {
|
|
8233
|
+
throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
8085
8234
|
}
|
|
8086
8235
|
// use renderTooltipContent to update tooltip-content id
|
|
8087
8236
|
this.renderTooltipContent();
|
|
8088
8237
|
}
|
|
8089
8238
|
watchMessage(newValue) {
|
|
8090
|
-
if (!
|
|
8091
|
-
throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${
|
|
8239
|
+
if (!index_es.me(newValue)) {
|
|
8240
|
+
throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
8092
8241
|
}
|
|
8093
8242
|
if (this.mgTooltipContent !== undefined)
|
|
8094
8243
|
this.mgTooltipContent.message = newValue;
|
|
@@ -8143,7 +8292,7 @@ const MgTooltip = class {
|
|
|
8143
8292
|
*/
|
|
8144
8293
|
componentWillLoad() {
|
|
8145
8294
|
// Get windows to attach events
|
|
8146
|
-
this.windows =
|
|
8295
|
+
this.windows = index_es.Ze(window);
|
|
8147
8296
|
// Get tooltip element
|
|
8148
8297
|
this.renderTooltipContent();
|
|
8149
8298
|
//validate properties
|
|
@@ -8161,7 +8310,7 @@ const MgTooltip = class {
|
|
|
8161
8310
|
// get slotted element wich is not the tooltip
|
|
8162
8311
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
8163
8312
|
// Get interactive element
|
|
8164
|
-
const interactiveElement = slotElement.matches(
|
|
8313
|
+
const interactiveElement = slotElement.matches(index_es.Qe) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(index_es.Qe);
|
|
8165
8314
|
this.setTooltipedElement(interactiveElement || slotElement);
|
|
8166
8315
|
// Check if slotted element is a disabled mg-button
|
|
8167
8316
|
// In this case we wrap the mg-button into a div to enable the tooltip
|