@mgdis/mg-components 3.3.0 → 4.0.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-bead7dbd.js → index-88560a66.js} +47 -48
- package/dist/cjs/{index-369388eb.js → index-a39c5567.js} +97 -10
- package/dist/cjs/loader.cjs.js +3 -17
- package/dist/cjs/mg-badge_21.cjs.entry.js +461 -281
- package/dist/cjs/mg-components.cjs.js +3 -7
- package/dist/cjs/mg-modal.cjs.entry.js +12 -6
- package/dist/cjs/mg-popover.cjs.entry.js +15 -6
- package/dist/cjs/{popper-0c3964e7.js → popper-71bf3058.js} +6 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -3
- package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +2 -2
- package/dist/collection/components/atoms/mg-button/mg-button.css +6 -30
- package/dist/collection/components/atoms/mg-button/mg-button.js +7 -2
- package/dist/collection/components/atoms/mg-character-left/{mg-character-left.stories.js → doc/mg-character-left.stories.js} +1 -1
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +10 -47
- package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +86 -10
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +4 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
- package/dist/collection/components/atoms/mg-input-title/{mg-input-title.stories.js → doc/mg-input-title.stories.js} +0 -0
- package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +1 -1
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
- package/dist/collection/components/atoms/mg-tooltip/{mg-tooltip.stories.js → doc/mg-tooltip.stories.js} +14 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +20 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -2
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
- package/dist/collection/components/molecules/inputs/MgInput.js +5 -15
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +0 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +19 -13
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -21
- package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +0 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +19 -18
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +19 -18
- package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +20 -19
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +43 -19
- package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +10 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +19 -18
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -22
- package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +0 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +19 -13
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +8 -15
- package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +10 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +20 -18
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +24 -31
- package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +11 -7
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +51 -28
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +42 -43
- package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +10 -4
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +51 -22
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +64 -37
- package/dist/collection/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.js → doc/mg-input-toggle.stories.js} +0 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +18 -9
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -3
- package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +0 -0
- package/dist/collection/components/molecules/mg-form/mg-form.css +4 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +5 -3
- package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
- package/dist/collection/components/molecules/mg-modal/{mg-modal.stories.js → doc/mg-modal.stories.js} +0 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +10 -4
- package/dist/collection/components/molecules/mg-pagination/{mg-pagination.stories.js → doc/mg-pagination.stories.js} +0 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
- package/dist/collection/components/molecules/mg-panel/{mg-panel.stories.js → doc/mg-panel.stories.js} +0 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +5 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +10 -9
- package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +10 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +19 -5
- package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +11 -5
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +72 -26
- package/dist/collection/locales/index.js +33 -4
- package/dist/collection/stories/helpers.stories.js +33 -0
- package/dist/collection/utils/locale.utils.js +7 -4
- package/dist/collection/variables.css +10 -5
- package/dist/collection/variables.scss +10 -5
- package/dist/components/MgInput.js +6 -23
- package/dist/components/index.d.ts +23 -5
- package/dist/components/index.js +23 -0
- package/dist/components/index2.js +97 -8
- package/dist/components/locale.utils.js +7 -5
- package/dist/components/mg-badge2.js +16 -4
- package/dist/components/mg-button2.js +8 -3
- package/dist/components/mg-character-left2.js +4 -27
- package/dist/components/mg-form.js +6 -4
- package/dist/components/mg-icon2.js +109 -17
- package/dist/components/mg-input-checkbox.js +11 -27
- package/dist/components/mg-input-date.js +21 -25
- package/dist/components/mg-input-numeric.js +28 -26
- package/dist/components/mg-input-password.js +18 -28
- package/dist/components/mg-input-radio.js +10 -22
- package/dist/components/mg-input-select2.js +24 -35
- package/dist/components/mg-input-text2.js +38 -26
- package/dist/components/mg-input-textarea.js +43 -20
- package/dist/components/mg-input-toggle.js +11 -11
- package/dist/components/mg-message.js +16 -8
- package/dist/components/mg-modal.js +11 -5
- package/dist/components/mg-pagination.js +16 -22
- package/dist/components/mg-panel.js +8 -7
- package/dist/components/mg-popover.js +13 -4
- package/dist/components/mg-tabs.js +75 -21
- package/dist/components/mg-tag.js +20 -5
- package/dist/components/mg-tooltip2.js +1 -1
- package/dist/components/popper.js +6 -2
- package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
- package/dist/esm/{index-c346f52d.js → index-e51ae032.js} +97 -8
- package/dist/esm/loader.js +3 -17
- package/dist/esm/mg-badge_21.entry.js +458 -278
- package/dist/esm/mg-components.js +3 -7
- package/dist/esm/mg-modal.entry.js +12 -6
- package/dist/esm/mg-popover.entry.js +15 -6
- package/dist/esm/{popper-8874fd6c.js → popper-93ecb064.js} +6 -2
- package/dist/index.js +1 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-003a1344.entry.js +1 -0
- package/dist/mg-components/p-462d648a.entry.js +1 -0
- package/dist/mg-components/p-4c66f794.js +1 -0
- package/dist/mg-components/p-5126ab10.entry.js +1 -0
- package/dist/mg-components/p-780bd52d.js +1 -0
- package/dist/mg-components/p-b14a3443.js +2 -0
- package/dist/mg-components/variables.css +10 -5
- package/dist/mg-components/variables.scss +10 -5
- package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
- package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +1 -1
- package/dist/types/components/atoms/mg-character-left/{mg-character-left.stories.d.ts → doc/mg-character-left.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
- package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
- package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +29 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +8 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
- package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
- package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
- package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
- package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
- package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
- package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
- package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
- package/dist/types/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.d.ts → doc/mg-input-textarea.stories.d.ts} +8 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +14 -6
- package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
- package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -0
- package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
- package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
- package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
- package/dist/types/components/molecules/mg-panel/{mg-panel.stories.d.ts → doc/mg-panel.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +5 -0
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +25 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +9 -1
- package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +44 -0
- package/dist/types/components.d.ts +149 -151
- package/dist/types/locales/index.d.ts +109 -46
- package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
- package/dist/types/utils/locale.utils.d.ts +7 -3
- package/loader/index.js +1 -1
- package/package.json +41 -14
- package/readme.md +6 -35
- package/dist/cjs/css-shim-629916b0.js +0 -6
- package/dist/cjs/shadow-css-546083ef.js +0 -390
- package/dist/collection/stories/buttons.stories.js +0 -43
- package/dist/collection/stories/messages.stories.js +0 -44
- package/dist/collection/stories/tags.stories.js +0 -13
- package/dist/esm/css-shim-0993aa3b.js +0 -4
- package/dist/esm/shadow-css-dfa0587f.js +0 -388
- package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
- package/dist/esm-es5/index-9e877561.js +0 -1
- package/dist/esm-es5/index-c346f52d.js +0 -1
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +0 -1
- package/dist/esm-es5/mg-badge_21.entry.js +0 -2
- package/dist/esm-es5/mg-components.js +0 -1
- package/dist/esm-es5/mg-modal.entry.js +0 -1
- package/dist/esm-es5/mg-popover.entry.js +0 -1
- package/dist/esm-es5/popper-8874fd6c.js +0 -1
- package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
- package/dist/mg-components/mg-components.js +0 -132
- package/dist/mg-components/p-136c8d6f.system.entry.js +0 -2
- package/dist/mg-components/p-3c14153d.js +0 -1
- package/dist/mg-components/p-50ea2036.system.js +0 -1
- package/dist/mg-components/p-55a22b35.system.js +0 -1
- package/dist/mg-components/p-5e796581.js +0 -12
- package/dist/mg-components/p-656b5efb.system.js +0 -1
- package/dist/mg-components/p-68d6f104.js +0 -1
- package/dist/mg-components/p-6d49ed95.js +0 -1
- package/dist/mg-components/p-6f173f62.system.entry.js +0 -1
- package/dist/mg-components/p-70177194.entry.js +0 -1
- package/dist/mg-components/p-8b2d8a2a.system.js +0 -13
- package/dist/mg-components/p-8cb61c3f.system.js +0 -1
- package/dist/mg-components/p-ace173b1.js +0 -1
- package/dist/mg-components/p-b7488a4c.entry.js +0 -1
- package/dist/mg-components/p-c1ffb2e1.entry.js +0 -1
- package/dist/mg-components/p-c90cc4bf.system.js +0 -1
- package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
- package/dist/mg-components/p-e4a502b5.system.js +0 -1
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
- package/dist/types/stories/messages.stories.d.ts +0 -13
- package/dist/types/stories/tags.stories.d.ts +0 -5
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { c as createID } from './components.utils.js';
|
|
3
|
-
import {
|
|
4
|
-
import { d as defineCustomElement$
|
|
5
|
-
import { d as defineCustomElement$6 } from './mg-character-left2.js';
|
|
3
|
+
import { i as initLocales } from './index2.js';
|
|
4
|
+
import { d as defineCustomElement$6 } from './mg-button2.js';
|
|
6
5
|
import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
7
6
|
import { d as defineCustomElement$4 } from './mg-input-select2.js';
|
|
8
7
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
@@ -14,7 +13,7 @@ var NavigationAction;
|
|
|
14
13
|
NavigationAction["PREVIOUS"] = "previous";
|
|
15
14
|
})(NavigationAction || (NavigationAction = {}));
|
|
16
15
|
|
|
17
|
-
const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-pagination__nav{display
|
|
16
|
+
const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-pagination__nav{display:flex;align-items:center;flex-direction:row}.mg-pagination__nav mg-input-select{margin-right:0.5rem}.mg-pagination__button{display:flex}.mg-pagination__button:first-of-type{margin-right:1rem}.mg-pagination__button:last-of-type{margin-left:1rem}";
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* Range generator
|
|
@@ -43,19 +42,11 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
43
42
|
this.__registerHost();
|
|
44
43
|
this.__attachShadow();
|
|
45
44
|
this.currentPageChange = createEvent(this, "current-page-change", 7);
|
|
46
|
-
/**************
|
|
47
|
-
* Decorators *
|
|
48
|
-
**************/
|
|
49
45
|
/**
|
|
50
46
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
51
47
|
* If not set, it will be created.
|
|
52
48
|
*/
|
|
53
49
|
this.identifier = createID('mg-pagination');
|
|
54
|
-
/**
|
|
55
|
-
* Panignation label. Is a short description.
|
|
56
|
-
* Customize default value can be usefull to improve accessibility
|
|
57
|
-
*/
|
|
58
|
-
this.label = 'pagination';
|
|
59
50
|
/**
|
|
60
51
|
* Component total pages
|
|
61
52
|
*/
|
|
@@ -119,8 +110,15 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
119
110
|
* @returns {void}
|
|
120
111
|
*/
|
|
121
112
|
componentWillLoad() {
|
|
113
|
+
// Get locales
|
|
114
|
+
this.messages = initLocales(this.element).messages;
|
|
115
|
+
// Validate
|
|
122
116
|
this.validateTotalPages(this.totalPages);
|
|
123
117
|
this.validateCurrentPage(this.currentPage);
|
|
118
|
+
// Set default label
|
|
119
|
+
if (this.label === undefined || this.label === '') {
|
|
120
|
+
this.label = this.messages.pagination.label;
|
|
121
|
+
}
|
|
124
122
|
}
|
|
125
123
|
/**
|
|
126
124
|
* Render
|
|
@@ -128,11 +126,12 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
128
126
|
* @returns {HTMLElement} HTML Element
|
|
129
127
|
*/
|
|
130
128
|
render() {
|
|
131
|
-
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, class: "mg-pagination__button", label: messages.pagination[`${action}Page`],
|
|
129
|
+
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, class: "mg-pagination__button", label: this.messages.pagination[`${action}Page`],
|
|
132
130
|
// eslint-disable-next-line react/jsx-no-bind
|
|
133
|
-
onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
134
|
-
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination__nav" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? messages.pagination.pages : messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
131
|
+
onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
132
|
+
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination__nav" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
135
133
|
}
|
|
134
|
+
get element() { return this; }
|
|
136
135
|
static get watchers() { return {
|
|
137
136
|
"totalPages": ["validateTotalPages"],
|
|
138
137
|
"currentPage": ["validateCurrentPage"]
|
|
@@ -140,7 +139,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
140
139
|
static get style() { return mgPaginationCss; }
|
|
141
140
|
}, [1, "mg-pagination", {
|
|
142
141
|
"identifier": [1],
|
|
143
|
-
"label": [
|
|
142
|
+
"label": [1025],
|
|
144
143
|
"totalPages": [2, "total-pages"],
|
|
145
144
|
"currentPage": [1538, "current-page"]
|
|
146
145
|
}]);
|
|
@@ -148,7 +147,7 @@ function defineCustomElement$1() {
|
|
|
148
147
|
if (typeof customElements === "undefined") {
|
|
149
148
|
return;
|
|
150
149
|
}
|
|
151
|
-
const components = ["mg-pagination", "mg-button", "mg-
|
|
150
|
+
const components = ["mg-pagination", "mg-button", "mg-icon", "mg-input-select", "mg-input-title", "mg-tooltip"];
|
|
152
151
|
components.forEach(tagName => { switch (tagName) {
|
|
153
152
|
case "mg-pagination":
|
|
154
153
|
if (!customElements.get(tagName)) {
|
|
@@ -156,11 +155,6 @@ function defineCustomElement$1() {
|
|
|
156
155
|
}
|
|
157
156
|
break;
|
|
158
157
|
case "mg-button":
|
|
159
|
-
if (!customElements.get(tagName)) {
|
|
160
|
-
defineCustomElement$7();
|
|
161
|
-
}
|
|
162
|
-
break;
|
|
163
|
-
case "mg-character-left":
|
|
164
158
|
if (!customElements.get(tagName)) {
|
|
165
159
|
defineCustomElement$6();
|
|
166
160
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { c as createID, C as ClassList } from './components.utils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { i as initLocales } from './index2.js';
|
|
4
4
|
import { d as defineCustomElement$7 } from './mg-button2.js';
|
|
5
5
|
import { d as defineCustomElement$6 } from './mg-character-left2.js';
|
|
6
6
|
import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
@@ -8,7 +8,7 @@ import { d as defineCustomElement$4 } from './mg-input-text2.js';
|
|
|
8
8
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
10
10
|
|
|
11
|
-
const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius)
|
|
11
|
+
const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__header-right{flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1}.mg-panel__collapse-button .mg-button{font-family:var(--font-family-heading);font-size:1.4rem;font-weight:500}.mg-panel__collapse-button,.mg-panel__edit-button{margin:0 0.3rem 0 0}.mg-panel__content{padding:1.5rem}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
|
|
12
12
|
|
|
13
13
|
const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
@@ -17,9 +17,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
17
17
|
this.__attachShadow();
|
|
18
18
|
this.titleChange = createEvent(this, "title-change", 7);
|
|
19
19
|
this.expandedChange = createEvent(this, "expanded-change", 7);
|
|
20
|
-
/**************
|
|
21
|
-
* Decorators *
|
|
22
|
-
**************/
|
|
23
20
|
/**
|
|
24
21
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
25
22
|
* If not set, it will be created.
|
|
@@ -118,13 +115,13 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
118
115
|
if (this.titleEditable && !this.isEditing) {
|
|
119
116
|
return [
|
|
120
117
|
collapseButton(),
|
|
121
|
-
h("mg-button", { "is-icon": true, variant: "flat", label: messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
|
|
118
|
+
h("mg-button", { "is-icon": true, variant: "flat", class: "mg-panel__edit-button", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
|
|
122
119
|
];
|
|
123
120
|
}
|
|
124
121
|
if (this.titleEditable && this.isEditing) {
|
|
125
122
|
return [
|
|
126
123
|
collapseButton(),
|
|
127
|
-
h("mg-input-text", { label: messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: messages.general.
|
|
124
|
+
h("mg-input-text", { label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` }, h("mg-icon", { icon: "check" }))),
|
|
128
125
|
];
|
|
129
126
|
}
|
|
130
127
|
return collapseButton();
|
|
@@ -153,6 +150,9 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
153
150
|
* @returns {void}
|
|
154
151
|
*/
|
|
155
152
|
componentWillLoad() {
|
|
153
|
+
// Get locales
|
|
154
|
+
this.messages = initLocales(this.element).messages;
|
|
155
|
+
// Validate
|
|
156
156
|
this.validatetitlePattern(this.titlePattern);
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
@@ -174,6 +174,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
174
174
|
render() {
|
|
175
175
|
return (h("section", { class: this.classList.join(), id: this.identifier }, h("header", { class: "mg-panel__header", id: `${this.identifier}-header` }, h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()), h("div", { class: "mg-panel__header-right" }, h("slot", { name: "header-right" }))), h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded }, h("slot", null))));
|
|
176
176
|
}
|
|
177
|
+
get element() { return this; }
|
|
177
178
|
static get watchers() { return {
|
|
178
179
|
"panelTitle": ["handelTileChange"],
|
|
179
180
|
"titlePattern": ["validatetitlePattern"],
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { c as createID } from './components.utils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { i as initLocales } from './index2.js';
|
|
4
4
|
import { d as defineCustomElement$3 } from './mg-button2.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
6
6
|
import { c as createPopper } from './popper.js';
|
|
7
7
|
|
|
8
|
-
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color))
|
|
8
|
+
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show].sc-mg-popover{display:block}.mg-popover.sc-mg-popover mg-button.sc-mg-popover{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover,.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover{visibility:hidden}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{bottom:-6px}.mg-popover[data-popper-placement^=bottom].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{top:-6px}.mg-popover[data-popper-placement^=left].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{right:-6px}.mg-popover[data-popper-placement^=right].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{left:-6px}.mg-popover__title.sc-mg-popover-s>*,.mg-popover__title .sc-mg-popover-s>*{margin:0 0 1rem;font-size:var(--mg-popover-title-font-size);font-weight:600}";
|
|
9
9
|
|
|
10
10
|
const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
@@ -73,7 +73,7 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
73
73
|
this.popover.removeAttribute('data-show');
|
|
74
74
|
// Disable the event listeners
|
|
75
75
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
76
|
-
// Remove
|
|
76
|
+
// Remove event listener
|
|
77
77
|
document.removeEventListener('click', this.clickOutside, false);
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
@@ -96,6 +96,15 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
96
96
|
/*************
|
|
97
97
|
* Lifecycle *
|
|
98
98
|
*************/
|
|
99
|
+
/**
|
|
100
|
+
* Check if component props are well configured on init
|
|
101
|
+
*
|
|
102
|
+
* @returns {void} timeout
|
|
103
|
+
*/
|
|
104
|
+
componentWillLoad() {
|
|
105
|
+
// Get locales
|
|
106
|
+
this.messages = initLocales(this.element).messages;
|
|
107
|
+
}
|
|
99
108
|
/**
|
|
100
109
|
* Check if component props are well configured on init
|
|
101
110
|
*
|
|
@@ -149,7 +158,7 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
149
158
|
* @returns {HTMLElement} HTML Element
|
|
150
159
|
*/
|
|
151
160
|
render() {
|
|
152
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" }), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
161
|
+
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" }), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
153
162
|
}
|
|
154
163
|
get element() { return this; }
|
|
155
164
|
static get watchers() { return {
|
|
@@ -3,12 +3,19 @@ import { c as createID, C as ClassList, a as allItemsAreString } from './compone
|
|
|
3
3
|
import { d as defineCustomElement$3 } from './mg-badge2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
5
5
|
|
|
6
|
+
var Status;
|
|
7
|
+
(function (Status) {
|
|
8
|
+
Status["VISIBLE"] = "visible";
|
|
9
|
+
Status["HIDDEN"] = "hidden";
|
|
10
|
+
Status["DISABLED"] = "disabled";
|
|
11
|
+
Status["ACTIVE"] = "active";
|
|
12
|
+
})(Status || (Status = {}));
|
|
6
13
|
/**
|
|
7
14
|
* List of all possibles sizes
|
|
8
15
|
*/
|
|
9
16
|
const sizes = ['regular', 'large'];
|
|
10
17
|
|
|
11
|
-
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular
|
|
18
|
+
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button{padding:calc(1rem + 0.3rem) calc(1rem * 1.3) 1rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button{padding:calc(1.8rem + 0.3rem) calc(1.8rem * 1.3) 1.8rem}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:0.5rem;background:none;border:none;border-bottom:0.3rem solid transparent;color:hsl(var(--color-dark));line-height:var(--line-height);cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:30%}.mg-tabs__navigation-button:hover:not(:disabled),.mg-tabs__navigation-button:focus:not(:disabled){background-color:hsla(var(--color-info-h), var(--color-info-s), var(--color-info-l), 10%)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--color-info));border-bottom-color:hsl(var(--color-info));font-weight:700}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__content-container:focus-visible{outline:none}";
|
|
12
19
|
|
|
13
20
|
/**
|
|
14
21
|
* type TabItem validation function
|
|
@@ -22,6 +29,12 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
22
29
|
super();
|
|
23
30
|
this.__registerHost();
|
|
24
31
|
this.activeTabChange = createEvent(this, "active-tab-change", 7);
|
|
32
|
+
/************
|
|
33
|
+
* Internal *
|
|
34
|
+
************/
|
|
35
|
+
this.tabPanel = 'panel';
|
|
36
|
+
this.startIndex = 1;
|
|
37
|
+
this.buttonTabBaseClass = 'mg-tabs__navigation-button';
|
|
25
38
|
/**
|
|
26
39
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
27
40
|
* If not set, it will be created.
|
|
@@ -44,6 +57,46 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
44
57
|
* Component classes
|
|
45
58
|
*/
|
|
46
59
|
this.classList = new ClassList(['mg-tabs']);
|
|
60
|
+
/**
|
|
61
|
+
* Method to set active tab
|
|
62
|
+
*
|
|
63
|
+
* @param {number} tabKey item tab key to set to ACTIVE status
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
this.setActiveTab = (tabKey) => {
|
|
67
|
+
// reset active tabs
|
|
68
|
+
this.tabs.forEach(tab => {
|
|
69
|
+
if (this.tabHasGivenStatus(tab, Status.ACTIVE))
|
|
70
|
+
tab.status = Status.VISIBLE;
|
|
71
|
+
});
|
|
72
|
+
// set active tab from given tab key
|
|
73
|
+
this.tabs[tabKey - this.startIndex].status = Status.ACTIVE;
|
|
74
|
+
// emit change active tab key event
|
|
75
|
+
this.activeTabChange.emit(tabKey);
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Method to know if given tab has the given status
|
|
79
|
+
*
|
|
80
|
+
* @param {TabItem} tab item tab key to set to ACTIVE status
|
|
81
|
+
* @param {Status} status status to valide
|
|
82
|
+
* @returns {boolean} status comparaison
|
|
83
|
+
*/
|
|
84
|
+
this.tabHasGivenStatus = (tab, status) => tab.status === status;
|
|
85
|
+
/**
|
|
86
|
+
* Method to get element id from index
|
|
87
|
+
*
|
|
88
|
+
* @param {string} element to get id
|
|
89
|
+
* @param {number} index to generate id
|
|
90
|
+
* @returns {string} generated element id
|
|
91
|
+
*/
|
|
92
|
+
this.getElementId = (element, index) => `${element}-${this.getTabIndex(index)}`;
|
|
93
|
+
/**
|
|
94
|
+
* Method to get tab index
|
|
95
|
+
*
|
|
96
|
+
* @param {number} index to get
|
|
97
|
+
* @returns {number} index
|
|
98
|
+
*/
|
|
99
|
+
this.getTabIndex = (index) => index + this.startIndex;
|
|
47
100
|
/**
|
|
48
101
|
* Handle click events on tabs
|
|
49
102
|
*
|
|
@@ -53,6 +106,14 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
53
106
|
const tabId = event.currentTarget.getAttribute('data-index');
|
|
54
107
|
this.activeTab = Number(tabId);
|
|
55
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* get navigation button class from given status
|
|
111
|
+
*
|
|
112
|
+
* @param {Status} status button tab status
|
|
113
|
+
* @param {boolean} isSelector set if we need a CSS selector with the dot '.' at the begin. default value = false.
|
|
114
|
+
* @returns {string} button class/selector variant
|
|
115
|
+
*/
|
|
116
|
+
this.getNavigationButtonClass = (status, isSelector = false) => `${isSelector ? '.' : ''}${this.buttonTabBaseClass}--${status}`;
|
|
56
117
|
/**
|
|
57
118
|
* Handle keyboard event on tabs
|
|
58
119
|
*
|
|
@@ -63,16 +124,14 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
63
124
|
let tabId = Number(event.target.getAttribute('data-index'));
|
|
64
125
|
const parent = event.target.parentElement;
|
|
65
126
|
// change selected id from key code
|
|
66
|
-
|
|
67
|
-
if (['ArrowRight', 'Right'].includes(event.key)) {
|
|
127
|
+
if (event.key === 'ArrowRight') {
|
|
68
128
|
tabId++;
|
|
69
|
-
// /* IE FIX */ delete 'Left'
|
|
70
129
|
}
|
|
71
|
-
else if (
|
|
130
|
+
else if (event.key === 'ArrowLeft') {
|
|
72
131
|
tabId--;
|
|
73
132
|
}
|
|
74
|
-
// get selected tab
|
|
75
|
-
const selectedTab = parent.querySelector(`[data-index="${tabId}"]`);
|
|
133
|
+
// get selected tab if NOT hidden, disabled
|
|
134
|
+
const selectedTab = parent.querySelector(`[data-index="${tabId}"]:not(${[this.getNavigationButtonClass(Status.HIDDEN, true), this.getNavigationButtonClass(Status.DISABLED, true)].join()})`);
|
|
76
135
|
// apply selected tab if exist
|
|
77
136
|
if (selectedTab !== null) {
|
|
78
137
|
selectedTab.focus();
|
|
@@ -98,7 +157,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
98
157
|
validateItems(newValue) {
|
|
99
158
|
// String array
|
|
100
159
|
if (allItemsAreString(newValue)) {
|
|
101
|
-
this.tabs = newValue.map(item => ({ label: item,
|
|
160
|
+
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
102
161
|
}
|
|
103
162
|
// Object array
|
|
104
163
|
else if (newValue && newValue.every(item => isTabItem(item))) {
|
|
@@ -113,7 +172,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
113
172
|
throw new Error('<mg-tabs> prop "activeTab" must be between 1 and tabs length.');
|
|
114
173
|
}
|
|
115
174
|
else {
|
|
116
|
-
this.
|
|
175
|
+
this.setActiveTab(newValue);
|
|
117
176
|
}
|
|
118
177
|
}
|
|
119
178
|
/*************
|
|
@@ -137,17 +196,12 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
137
196
|
* @returns {HTMLElement} HTML Element
|
|
138
197
|
*/
|
|
139
198
|
render() {
|
|
140
|
-
return (h(Host, null, h("div", { class: this.classList.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}, tabindex: tabIndex === this.activeTab ? 0 : -1, "aria-selected": (tabIndex === this.activeTab).toString(), "aria-controls": `pannel-${tabIndex}`, onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": tabIndex, disabled: tab.disabled }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label })));
|
|
147
|
-
})), this.tabs.map((_tab, index) => {
|
|
148
|
-
const tabIndex = index + 1;
|
|
149
|
-
return (h("article", { role: "tabpanel", id: `pannel-${tabIndex}`, hidden: tabIndex !== this.activeTab, "aria-labelledby": `${this.identifier}-${this.activeTab}`, tabindex: tabIndex === this.activeTab ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: `tab_content-${tabIndex}` })));
|
|
150
|
-
}))));
|
|
199
|
+
return (h(Host, null, h("div", { class: this.classList.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
200
|
+
[`${this.buttonTabBaseClass}`]: true,
|
|
201
|
+
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasGivenStatus(tab, Status.ACTIVE),
|
|
202
|
+
[`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasGivenStatus(tab, Status.DISABLED),
|
|
203
|
+
[`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasGivenStatus(tab, Status.HIDDEN),
|
|
204
|
+
}, tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasGivenStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabIndex(index), disabled: this.tabHasGivenStatus(tab, Status.DISABLED) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label }))))), this.tabs.map((tab, index) => (h("article", { role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasGivenStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) })))))));
|
|
151
205
|
}
|
|
152
206
|
get element() { return this; }
|
|
153
207
|
static get watchers() { return {
|
|
@@ -156,7 +210,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
156
210
|
"activeTab": ["validateActiveTab"]
|
|
157
211
|
}; }
|
|
158
212
|
static get style() { return mgTabsCss; }
|
|
159
|
-
}, [
|
|
213
|
+
}, [4, "mg-tabs", {
|
|
160
214
|
"identifier": [1],
|
|
161
215
|
"label": [1],
|
|
162
216
|
"size": [1],
|
|
@@ -6,31 +6,46 @@ import { C as ClassList } from './components.utils.js';
|
|
|
6
6
|
*/
|
|
7
7
|
const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'];
|
|
8
8
|
|
|
9
|
-
const mgTagCss = ".mg-tag{padding:calc((var(--mg-tag-height) - 0.2rem - var(--mg-tag-font-size) * var(--line-height)) / 2) 0.6rem;min-height:var(--mg-tag-height)
|
|
9
|
+
const mgTagCss = ".mg-tag{padding:calc((var(--mg-tag-height) - 0.2rem - var(--mg-tag-font-size) * var(--line-height)) / 2) 0.6rem;min-height:var(--mg-tag-height);box-sizing:border-box;border-radius:var(--mg-tag-border-radius);border:0.1rem solid;font-size:var(--mg-tag-font-size);font-weight:600;text-align:center}.mg-tag.mg-tag--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-tag.mg-tag--primary.mg-tag--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-tag.mg-tag--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-tag.mg-tag--secondary.mg-tag--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-tag.mg-tag--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-tag.mg-tag--success.mg-tag--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-tag.mg-tag--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-tag.mg-tag--warning.mg-tag--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-tag.mg-tag--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-tag.mg-tag--danger.mg-tag--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-tag.mg-tag--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-tag.mg-tag--info.mg-tag--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-tag,mg-tag{display:inline-block;vertical-align:middle}";
|
|
10
10
|
|
|
11
11
|
const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
this.__registerHost();
|
|
15
15
|
this.__attachShadow();
|
|
16
|
+
/************
|
|
17
|
+
* Internal *
|
|
18
|
+
************/
|
|
19
|
+
// classes
|
|
20
|
+
this.classOutline = `mg-tag--outline`;
|
|
21
|
+
/**************
|
|
22
|
+
* Decorators *
|
|
23
|
+
**************/
|
|
16
24
|
/**
|
|
17
25
|
* Define button variant
|
|
18
26
|
*/
|
|
19
|
-
this.variant = variants[0]; //
|
|
27
|
+
this.variant = variants[0]; // primary
|
|
20
28
|
/**
|
|
21
29
|
* Component classes
|
|
22
30
|
*/
|
|
23
31
|
this.classList = new ClassList(['mg-tag']);
|
|
24
32
|
}
|
|
25
|
-
validateVariant(newValue) {
|
|
33
|
+
validateVariant(newValue, oldValue) {
|
|
26
34
|
if (!variants.includes(newValue)) {
|
|
27
35
|
throw new Error(`<mg-tag> prop "variant" must be one of : ${variants.join(', ')}.`);
|
|
28
36
|
}
|
|
29
|
-
|
|
37
|
+
else {
|
|
38
|
+
if (oldValue !== undefined) {
|
|
39
|
+
this.classList.delete(`mg-tag--${oldValue}`);
|
|
40
|
+
}
|
|
41
|
+
this.classList.add(`mg-tag--${newValue}`);
|
|
42
|
+
}
|
|
30
43
|
}
|
|
31
44
|
validateOutline(newValue) {
|
|
32
45
|
if (newValue)
|
|
33
|
-
this.classList.add(
|
|
46
|
+
this.classList.add(this.classOutline);
|
|
47
|
+
else
|
|
48
|
+
this.classList.delete(this.classOutline);
|
|
34
49
|
}
|
|
35
50
|
/*************
|
|
36
51
|
* Lifecycle *
|
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal
|
|
|
2
2
|
import { c as createID } from './components.utils.js';
|
|
3
3
|
import { c as createPopper } from './popper.js';
|
|
4
4
|
|
|
5
|
-
const mgTooltipCss = ".sc-mg-tooltip-h{display:inline-block}.mg-tooltip.sc-mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:9999;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}.mg-tooltip[data-show].sc-mg-tooltip{display:block}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip,.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip{visibility:hidden}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{visibility:visible;content:\"\"
|
|
5
|
+
const mgTooltipCss = ".sc-mg-tooltip-h{display:inline-block}.mg-tooltip.sc-mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:9999;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}.mg-tooltip[data-show].sc-mg-tooltip{display:block}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip,.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip{visibility:hidden}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{top:-4px}.mg-tooltip[data-popper-placement^=left].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{right:-4px}.mg-tooltip[data-popper-placement^=right].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{left:-4px}";
|
|
6
6
|
|
|
7
7
|
const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
@@ -298,6 +298,10 @@ function getContainingBlock(element) {
|
|
|
298
298
|
|
|
299
299
|
var currentNode = getParentNode(element);
|
|
300
300
|
|
|
301
|
+
if (isShadowRoot(currentNode)) {
|
|
302
|
+
currentNode = currentNode.host;
|
|
303
|
+
}
|
|
304
|
+
|
|
301
305
|
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
302
306
|
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
303
307
|
// create a containing block.
|
|
@@ -521,7 +525,7 @@ function mapToStyles(_ref2) {
|
|
|
521
525
|
|
|
522
526
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
523
527
|
sideY = bottom;
|
|
524
|
-
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
528
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
525
529
|
offsetParent[heightProp];
|
|
526
530
|
y -= offsetY - popperRect.height;
|
|
527
531
|
y *= gpuAcceleration ? 1 : -1;
|
|
@@ -529,7 +533,7 @@ function mapToStyles(_ref2) {
|
|
|
529
533
|
|
|
530
534
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
531
535
|
sideX = right;
|
|
532
|
-
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
536
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
533
537
|
offsetParent[widthProp];
|
|
534
538
|
x -= offsetX - popperRect.width;
|
|
535
539
|
x *= gpuAcceleration ? 1 : -1;
|