@mgdis/mg-components 5.3.0 → 5.5.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-94497267.js → index-c3450336.js} +0 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{mg-badge_29.cjs.entry.js → mg-badge_30.cjs.entry.js} +517 -715
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -7
- package/dist/collection/components/atoms/mg-badge/mg-badge.css +6 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +5 -8
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -7
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.css +19 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +13 -30
- package/dist/collection/components/atoms/mg-card/mg-card.css +6 -1
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +2 -3
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +0 -6
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +20 -4
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +27 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +7 -12
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +4 -8
- package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +1 -9
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +58 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +60 -15
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +97 -68
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +7 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +17 -33
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +7 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +17 -25
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +6 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +24 -47
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +7 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -29
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +7 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +18 -33
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +6 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +23 -33
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +6 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +23 -41
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +6 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +23 -45
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +6 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +16 -33
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +8 -23
- package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +8 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +55 -24
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +18 -33
- package/dist/collection/components/molecules/mg-details/mg-details.css +6 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +4 -8
- package/dist/collection/components/molecules/mg-form/mg-form.js +9 -23
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +2 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +0 -6
- package/dist/collection/components/molecules/mg-message/mg-message.css +13 -19
- package/dist/collection/components/molecules/mg-message/mg-message.js +8 -27
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +12 -7
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -26
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +6 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -13
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +10 -5
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -22
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +13 -9
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -23
- package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +24 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +28 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +77 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +10 -23
- package/dist/collection/locales/en/messages.json +3 -0
- package/dist/collection/locales/fr/messages.json +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +8 -0
- package/dist/components/mg-badge2.js +6 -9
- package/dist/components/mg-button2.js +14 -31
- package/dist/components/mg-card.js +1 -37
- package/dist/components/mg-card2.js +39 -0
- package/dist/components/mg-character-left2.js +2 -3
- package/dist/components/mg-details.js +5 -9
- package/dist/components/mg-divider.js +0 -6
- package/dist/components/mg-form.js +9 -23
- package/dist/components/mg-icon2.js +28 -17
- package/dist/components/mg-illustrated-message.js +1 -7
- package/dist/components/mg-input-checkbox.js +18 -34
- package/dist/components/mg-input-date.js +18 -26
- package/dist/components/mg-input-numeric.js +25 -48
- package/dist/components/mg-input-password.js +18 -30
- package/dist/components/mg-input-radio.js +19 -34
- package/dist/components/mg-input-select2.js +25 -35
- package/dist/components/mg-input-text2.js +24 -42
- package/dist/components/mg-input-textarea.js +24 -46
- package/dist/components/mg-input-title2.js +4 -8
- package/dist/components/mg-input-toggle.js +17 -34
- package/dist/components/mg-menu-item.js +18 -33
- package/dist/components/mg-menu.js +9 -24
- package/dist/components/mg-message.js +17 -30
- package/dist/components/mg-modal.js +18 -30
- package/dist/components/mg-pagination.js +5 -14
- package/dist/components/mg-panel.js +20 -25
- package/dist/components/mg-popover.js +16 -26
- package/dist/components/mg-skip-links.d.ts +11 -0
- package/dist/components/mg-skip-links.js +66 -0
- package/dist/components/mg-tabs.js +10 -23
- package/dist/components/mg-tag.js +34 -12
- package/dist/components/mg-tooltip2.js +97 -68
- package/dist/esm/{index-aad0184c.js → index-78edde1d.js} +0 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mg-badge_29.entry.js → mg-badge_30.entry.js} +517 -716
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/mg-components/locales/en/messages.json +3 -0
- package/dist/mg-components/locales/fr/messages.json +3 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-3899d5d2.js → p-125c54ca.js} +0 -0
- package/dist/mg-components/p-4961c96c.entry.js +1 -0
- package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -11
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -1
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -11
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +6 -6
- package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -13
- package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +5 -1
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +27 -6
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +15 -0
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +0 -5
- package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +1 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +0 -4
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +1 -1
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -1
- package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +7 -0
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +34 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +2 -2
- package/dist/types/components.d.ts +37 -6
- package/dist/types/locales/index.d.ts +6 -0
- package/dist/types/stencil-public-runtime.d.ts +5 -0
- package/dist/types/utils/unit.test.utils.d.ts +42 -0
- package/package.json +36 -31
- package/readme.md +3 -1
- package/dist/mg-components/p-204af46f.entry.js +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { f as focusableElements, c as createID, C as ClassList } from './components.utils.js';
|
|
3
3
|
import { i as initLocales } from './index2.js';
|
|
4
|
-
import { d as defineCustomElement$
|
|
4
|
+
import { d as defineCustomElement$4 } from './mg-button2.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './mg-card2.js';
|
|
5
6
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
6
7
|
|
|
7
|
-
const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;position:relative;flex-direction:column;align-self:center;row-gap:3rem;
|
|
8
|
+
const mgModalCss = ":host{--mg-card-border-radius:var(--mg-modal-border-radius);--mg-card-padding:1.5rem 2.5rem;--mg-card-border:none}.mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal mg-card{display:flex;width:60rem;max-width:100%;max-height:100%}.mg-modal__dialog{display:flex;position:relative;flex-direction:column;align-self:center;row-gap:3rem;height:fit-content;max-height:100%}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
|
|
8
9
|
|
|
9
10
|
const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
11
|
constructor() {
|
|
@@ -18,31 +19,6 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
18
19
|
// IDs
|
|
19
20
|
this.closeButtonId = '';
|
|
20
21
|
this.titleId = '';
|
|
21
|
-
/**
|
|
22
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
23
|
-
* If not set, it will be created.
|
|
24
|
-
*/
|
|
25
|
-
this.identifier = createID('mg-modal');
|
|
26
|
-
/**
|
|
27
|
-
* Define if modal has a cross button
|
|
28
|
-
*/
|
|
29
|
-
this.closeButton = false;
|
|
30
|
-
/**
|
|
31
|
-
* Define if modal is hidden
|
|
32
|
-
*/
|
|
33
|
-
this.hide = false;
|
|
34
|
-
/**
|
|
35
|
-
* Define if component is using actions slot
|
|
36
|
-
*/
|
|
37
|
-
this.hasActions = false;
|
|
38
|
-
/**
|
|
39
|
-
* Define if component is using content slot
|
|
40
|
-
*/
|
|
41
|
-
this.hasContent = false;
|
|
42
|
-
/**
|
|
43
|
-
* Component classes
|
|
44
|
-
*/
|
|
45
|
-
this.classList = new ClassList(['mg-modal']);
|
|
46
22
|
this.setFocus = () => {
|
|
47
23
|
// Get all focusable elements
|
|
48
24
|
this.modalFocusableElements = Array.from(this.element.querySelectorAll(focusableElements)).reduce((acc, focusableElement) => {
|
|
@@ -85,6 +61,13 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
85
61
|
this.handleClose = () => {
|
|
86
62
|
this.hide = true;
|
|
87
63
|
};
|
|
64
|
+
this.identifier = createID('mg-modal');
|
|
65
|
+
this.modalTitle = undefined;
|
|
66
|
+
this.closeButton = false;
|
|
67
|
+
this.hide = false;
|
|
68
|
+
this.hasActions = false;
|
|
69
|
+
this.hasContent = false;
|
|
70
|
+
this.classList = new ClassList(['mg-modal']);
|
|
88
71
|
}
|
|
89
72
|
validateModalTitle(newValue) {
|
|
90
73
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -160,7 +143,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
160
143
|
* @returns {HTMLElement} HTML Element
|
|
161
144
|
*/
|
|
162
145
|
render() {
|
|
163
|
-
return (h("
|
|
146
|
+
return (h("div", { role: "alertdialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", null, h("div", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" })))))));
|
|
164
147
|
}
|
|
165
148
|
get element() { return this; }
|
|
166
149
|
static get watchers() { return {
|
|
@@ -181,7 +164,7 @@ function defineCustomElement$1() {
|
|
|
181
164
|
if (typeof customElements === "undefined") {
|
|
182
165
|
return;
|
|
183
166
|
}
|
|
184
|
-
const components = ["mg-modal", "mg-button", "mg-icon"];
|
|
167
|
+
const components = ["mg-modal", "mg-button", "mg-card", "mg-icon"];
|
|
185
168
|
components.forEach(tagName => { switch (tagName) {
|
|
186
169
|
case "mg-modal":
|
|
187
170
|
if (!customElements.get(tagName)) {
|
|
@@ -189,6 +172,11 @@ function defineCustomElement$1() {
|
|
|
189
172
|
}
|
|
190
173
|
break;
|
|
191
174
|
case "mg-button":
|
|
175
|
+
if (!customElements.get(tagName)) {
|
|
176
|
+
defineCustomElement$4();
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case "mg-card":
|
|
192
180
|
if (!customElements.get(tagName)) {
|
|
193
181
|
defineCustomElement$3();
|
|
194
182
|
}
|
|
@@ -13,7 +13,7 @@ var NavigationAction;
|
|
|
13
13
|
NavigationAction["PREVIOUS"] = "previous";
|
|
14
14
|
})(NavigationAction || (NavigationAction = {}));
|
|
15
15
|
|
|
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{display:flex;align-items:center;flex-direction:row}.mg-pagination mg-input-select{margin-right:0.5rem}.mg-pagination mg-button{display:flex}.mg-pagination mg-button:first-of-type{margin-right:1rem}.mg-pagination mg-button:last-of-type{margin-left:1rem}";
|
|
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}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-pagination{display:flex;align-items:center;flex-direction:row}.mg-pagination mg-input-select{margin-right:0.5rem}.mg-pagination mg-button{display:flex}.mg-pagination mg-button:first-of-type{margin-right:1rem}.mg-pagination mg-button:last-of-type{margin-left:1rem}";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Range generator
|
|
@@ -42,19 +42,6 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
42
42
|
this.__registerHost();
|
|
43
43
|
this.__attachShadow();
|
|
44
44
|
this.currentPageChange = createEvent(this, "current-page-change", 7);
|
|
45
|
-
/**
|
|
46
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
47
|
-
* If not set, it will be created.
|
|
48
|
-
*/
|
|
49
|
-
this.identifier = createID('mg-pagination');
|
|
50
|
-
/**
|
|
51
|
-
* Component total pages
|
|
52
|
-
*/
|
|
53
|
-
this.totalPages = 1;
|
|
54
|
-
/**
|
|
55
|
-
* Component current page
|
|
56
|
-
*/
|
|
57
|
-
this.currentPage = 1;
|
|
58
45
|
/**
|
|
59
46
|
* Change current page from target
|
|
60
47
|
*
|
|
@@ -87,6 +74,10 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
87
74
|
this.handleGoToPage = (action, disabled) => {
|
|
88
75
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
89
76
|
};
|
|
77
|
+
this.identifier = createID('mg-pagination');
|
|
78
|
+
this.label = undefined;
|
|
79
|
+
this.totalPages = 1;
|
|
80
|
+
this.currentPage = 1;
|
|
90
81
|
}
|
|
91
82
|
validateTotalPages(newValue) {
|
|
92
83
|
if (newValue < 1) {
|
|
@@ -1,14 +1,15 @@
|
|
|
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
3
|
import { i as initLocales } from './index2.js';
|
|
4
|
-
import { d as defineCustomElement$
|
|
4
|
+
import { d as defineCustomElement$8 } from './mg-button2.js';
|
|
5
|
+
import { d as defineCustomElement$7 } from './mg-card2.js';
|
|
5
6
|
import { d as defineCustomElement$6 } from './mg-character-left2.js';
|
|
6
7
|
import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
7
8
|
import { d as defineCustomElement$4 } from './mg-input-text2.js';
|
|
8
9
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
9
10
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
10
11
|
|
|
11
|
-
const mgPanelCss = "
|
|
12
|
+
const mgPanelCss = ":host{--mg-card-border:none;--mg-card-padding:0;--mg-card-border-radius:var(--mg-panel-border-radius);--mg-card-background:hsl(var(--mg-panel-background));--mg-card-box-shadow:var(--mg-panel-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-right{padding-left:0.3rem;flex:1 auto;min-height:var(--default-size);align-items:center}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
|
|
12
13
|
|
|
13
14
|
const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
15
|
constructor() {
|
|
@@ -17,27 +18,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
17
18
|
this.__attachShadow();
|
|
18
19
|
this.titleChange = createEvent(this, "title-change", 7);
|
|
19
20
|
this.expandedChange = createEvent(this, "expanded-change", 7);
|
|
20
|
-
/**
|
|
21
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
22
|
-
* If not set, it will be created.
|
|
23
|
-
*/
|
|
24
|
-
this.identifier = createID('mg-panel');
|
|
25
|
-
/**
|
|
26
|
-
* Panel is opened
|
|
27
|
-
*/
|
|
28
|
-
this.expanded = false;
|
|
29
|
-
/**
|
|
30
|
-
* Panel title is editabled
|
|
31
|
-
*/
|
|
32
|
-
this.titleEditable = false;
|
|
33
|
-
/**
|
|
34
|
-
* Component classes
|
|
35
|
-
*/
|
|
36
|
-
this.classList = new ClassList(['mg-panel']);
|
|
37
|
-
/**
|
|
38
|
-
* Title is in edition mode
|
|
39
|
-
*/
|
|
40
|
-
this.isEditing = false;
|
|
41
21
|
/************
|
|
42
22
|
* Methods *
|
|
43
23
|
************/
|
|
@@ -122,6 +102,16 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
122
102
|
}
|
|
123
103
|
return collapseButton();
|
|
124
104
|
};
|
|
105
|
+
this.identifier = createID('mg-panel');
|
|
106
|
+
this.panelTitle = undefined;
|
|
107
|
+
this.titlePattern = undefined;
|
|
108
|
+
this.titlePatternErrorMessage = undefined;
|
|
109
|
+
this.expanded = false;
|
|
110
|
+
this.expandToggleDisabled = undefined;
|
|
111
|
+
this.titleEditable = false;
|
|
112
|
+
this.classList = new ClassList(['mg-panel']);
|
|
113
|
+
this.isEditing = false;
|
|
114
|
+
this.updatedPanelTitle = undefined;
|
|
125
115
|
}
|
|
126
116
|
validatePanelTitle(newValue) {
|
|
127
117
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -172,7 +162,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
172
162
|
* @returns {HTMLElement} html element
|
|
173
163
|
*/
|
|
174
164
|
render() {
|
|
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))));
|
|
165
|
+
return (h("section", { class: this.classList.join(), id: this.identifier }, h("mg-card", null, 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
166
|
}
|
|
177
167
|
get element() { return this; }
|
|
178
168
|
static get watchers() { return {
|
|
@@ -197,7 +187,7 @@ function defineCustomElement$1() {
|
|
|
197
187
|
if (typeof customElements === "undefined") {
|
|
198
188
|
return;
|
|
199
189
|
}
|
|
200
|
-
const components = ["mg-panel", "mg-button", "mg-character-left", "mg-icon", "mg-input-text", "mg-input-title", "mg-tooltip"];
|
|
190
|
+
const components = ["mg-panel", "mg-button", "mg-card", "mg-character-left", "mg-icon", "mg-input-text", "mg-input-title", "mg-tooltip"];
|
|
201
191
|
components.forEach(tagName => { switch (tagName) {
|
|
202
192
|
case "mg-panel":
|
|
203
193
|
if (!customElements.get(tagName)) {
|
|
@@ -205,6 +195,11 @@ function defineCustomElement$1() {
|
|
|
205
195
|
}
|
|
206
196
|
break;
|
|
207
197
|
case "mg-button":
|
|
198
|
+
if (!customElements.get(tagName)) {
|
|
199
|
+
defineCustomElement$8();
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
case "mg-card":
|
|
208
203
|
if (!customElements.get(tagName)) {
|
|
209
204
|
defineCustomElement$7();
|
|
210
205
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { c as createID, i as isTagName } from './components.utils.js';
|
|
3
3
|
import { i as initLocales } from './index2.js';
|
|
4
|
-
import { d as defineCustomElement$
|
|
4
|
+
import { d as defineCustomElement$4 } from './mg-button2.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './mg-card2.js';
|
|
5
6
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
6
7
|
import { c as createPopper } from './popper.js';
|
|
7
8
|
|
|
8
|
-
const mgPopoverCss = "
|
|
9
|
+
const mgPopoverCss = ":host{--mg-card-padding:1.5rem;--mg-card-border:none;--mg-card-border-radius:0.5rem;--mg-card-background:hsl(var(--mg-popover-background-color));position:relative;display:contents}:host::slotted(*){display:inline-block}.mg-popover{display:none;z-index:2000;color:hsl(var(--mg-popover-font-color))}.mg-popover mg-card{z-index:-1}.mg-popover[data-show]{display:block}.mg-popover mg-button{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover__arrow,.mg-popover__arrow::before{position:absolute;width:2rem;height:2rem;z-index:2000;background:hsl(var(--mg-popover-background-color))}.mg-popover__arrow{visibility:hidden}.mg-popover__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow{bottom:-6px}.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow{top:-6px}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow{right:-6px}.mg-popover[data-popper-placement^=right]>.mg-popover__arrow{left:-6px}.mg-popover__title ::slotted([slot=title]){margin:0 0 1rem !important;font-size:var(--mg-popover-title-font-size) !important;font-weight:600}";
|
|
9
10
|
|
|
10
11
|
const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
12
|
constructor() {
|
|
@@ -14,27 +15,6 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14
15
|
this.__attachShadow();
|
|
15
16
|
this.displayChange = createEvent(this, "display-change", 7);
|
|
16
17
|
this.closeButtonId = '';
|
|
17
|
-
/**
|
|
18
|
-
* Sets an `id` attribute.
|
|
19
|
-
* Needed by the input for accessibility `aria-decribedby`.
|
|
20
|
-
*/
|
|
21
|
-
this.identifier = createID('mg-popover');
|
|
22
|
-
/**
|
|
23
|
-
* Popover placement
|
|
24
|
-
*/
|
|
25
|
-
this.placement = 'bottom';
|
|
26
|
-
/**
|
|
27
|
-
* Define if popover has a cross button
|
|
28
|
-
*/
|
|
29
|
-
this.closeButton = false;
|
|
30
|
-
/**
|
|
31
|
-
* Display popover
|
|
32
|
-
*/
|
|
33
|
-
this.display = false;
|
|
34
|
-
/**
|
|
35
|
-
* Disable popover
|
|
36
|
-
*/
|
|
37
|
-
this.disabled = false;
|
|
38
18
|
/**
|
|
39
19
|
* Check if clicked outside of component
|
|
40
20
|
*
|
|
@@ -85,6 +65,11 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
85
65
|
this.handleCloseButton = () => {
|
|
86
66
|
this.display = false;
|
|
87
67
|
};
|
|
68
|
+
this.identifier = createID('mg-popover');
|
|
69
|
+
this.placement = 'bottom';
|
|
70
|
+
this.closeButton = false;
|
|
71
|
+
this.display = false;
|
|
72
|
+
this.disabled = false;
|
|
88
73
|
}
|
|
89
74
|
handleDisplay(newValue) {
|
|
90
75
|
if (newValue) {
|
|
@@ -123,7 +108,7 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
123
108
|
this.closeButtonId = `${this.identifier}-close-button`;
|
|
124
109
|
}
|
|
125
110
|
// Get popover content
|
|
126
|
-
this.popover = this.element.shadowRoot.
|
|
111
|
+
this.popover = this.element.shadowRoot.getElementById(this.identifier);
|
|
127
112
|
//Get interactive element (first element without slot attribute)
|
|
128
113
|
const interactiveElement = this.element.querySelector(':not([slot])');
|
|
129
114
|
// Add aria attributes
|
|
@@ -160,7 +145,7 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
160
145
|
* @returns {HTMLElement} HTML Element
|
|
161
146
|
*/
|
|
162
147
|
render() {
|
|
163
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, 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 }))));
|
|
148
|
+
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, h("mg-card", null, !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 }))));
|
|
164
149
|
}
|
|
165
150
|
get element() { return this; }
|
|
166
151
|
static get watchers() { return {
|
|
@@ -178,7 +163,7 @@ function defineCustomElement$1() {
|
|
|
178
163
|
if (typeof customElements === "undefined") {
|
|
179
164
|
return;
|
|
180
165
|
}
|
|
181
|
-
const components = ["mg-popover", "mg-button", "mg-icon"];
|
|
166
|
+
const components = ["mg-popover", "mg-button", "mg-card", "mg-icon"];
|
|
182
167
|
components.forEach(tagName => { switch (tagName) {
|
|
183
168
|
case "mg-popover":
|
|
184
169
|
if (!customElements.get(tagName)) {
|
|
@@ -186,6 +171,11 @@ function defineCustomElement$1() {
|
|
|
186
171
|
}
|
|
187
172
|
break;
|
|
188
173
|
case "mg-button":
|
|
174
|
+
if (!customElements.get(tagName)) {
|
|
175
|
+
defineCustomElement$4();
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
case "mg-card":
|
|
189
179
|
if (!customElements.get(tagName)) {
|
|
190
180
|
defineCustomElement$3();
|
|
191
181
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MgSkipLinks extends Components.MgSkipLinks, HTMLElement {}
|
|
4
|
+
export const MgSkipLinks: {
|
|
5
|
+
prototype: MgSkipLinks;
|
|
6
|
+
new (): MgSkipLinks;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { i as initLocales } from './index2.js';
|
|
3
|
+
|
|
4
|
+
const mgSkipLinksCss = ".mg-skip-links{position:absolute;transform:translateY(-100%);opacity:0;background:hsl(var(--color-light))}.mg-skip-links:focus-within{position:relative;transform:translateY(0);opacity:1}.mg-skip-links__list{display:flex;flex-wrap:wrap;align-items:center;gap:0.6rem;margin:0;padding:0.64rem 1.8rem;list-style:none}.mg-skip-links__link{display:inline-block;padding:1.2rem;color:hsl(var(--color-dark))}.mg-skip-links__link:hover{background:hsl(var(--color-dark), 0.1)}";
|
|
5
|
+
|
|
6
|
+
const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.links = undefined;
|
|
12
|
+
}
|
|
13
|
+
validateLinks(links) {
|
|
14
|
+
if (links === undefined ||
|
|
15
|
+
links.length === 0 ||
|
|
16
|
+
links.some(link => link.href === undefined || !link.href.startsWith('#') || link.label === undefined || link.label.trim() === '')) {
|
|
17
|
+
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.`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/*************
|
|
21
|
+
* Lifecycle *
|
|
22
|
+
*************/
|
|
23
|
+
/**
|
|
24
|
+
* Check if props are well configured on init
|
|
25
|
+
*
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
28
|
+
componentWillLoad() {
|
|
29
|
+
this.validateLinks(this.links);
|
|
30
|
+
this.messages = initLocales(this.element).messages;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Render
|
|
34
|
+
*
|
|
35
|
+
* @returns {HTMLElement} HTML Element
|
|
36
|
+
*/
|
|
37
|
+
render() {
|
|
38
|
+
return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list" }, this.links.map(link => (h("li", null, h("a", { class: "mg-skip-links__link", href: link.href }, link.label)))))));
|
|
39
|
+
}
|
|
40
|
+
get element() { return this; }
|
|
41
|
+
static get watchers() { return {
|
|
42
|
+
"links": ["validateLinks"]
|
|
43
|
+
}; }
|
|
44
|
+
static get style() { return mgSkipLinksCss; }
|
|
45
|
+
}, [1, "mg-skip-links", {
|
|
46
|
+
"links": [1040]
|
|
47
|
+
}]);
|
|
48
|
+
function defineCustomElement$1() {
|
|
49
|
+
if (typeof customElements === "undefined") {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const components = ["mg-skip-links"];
|
|
53
|
+
components.forEach(tagName => { switch (tagName) {
|
|
54
|
+
case "mg-skip-links":
|
|
55
|
+
if (!customElements.get(tagName)) {
|
|
56
|
+
customElements.define(tagName, MgSkipLinks$1);
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
} });
|
|
60
|
+
}
|
|
61
|
+
defineCustomElement$1();
|
|
62
|
+
|
|
63
|
+
const MgSkipLinks = MgSkipLinks$1;
|
|
64
|
+
const defineCustomElement = defineCustomElement$1;
|
|
65
|
+
|
|
66
|
+
export { MgSkipLinks, defineCustomElement };
|
|
@@ -36,31 +36,11 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
36
36
|
/************
|
|
37
37
|
* Internal *
|
|
38
38
|
************/
|
|
39
|
+
// classes
|
|
39
40
|
this.tabPanel = 'panel';
|
|
40
|
-
this.startIndex = 1;
|
|
41
41
|
this.buttonTabBaseClass = 'mg-tabs__navigation-button';
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* If not set, it will be created.
|
|
45
|
-
*/
|
|
46
|
-
this.identifier = createID('mg-tabs');
|
|
47
|
-
/**
|
|
48
|
-
* Define tabs size
|
|
49
|
-
*/
|
|
50
|
-
this.size = 'regular';
|
|
51
|
-
/**
|
|
52
|
-
* Active tab number
|
|
53
|
-
* default: first is 1
|
|
54
|
-
*/
|
|
55
|
-
this.activeTab = 1;
|
|
56
|
-
/**
|
|
57
|
-
* Component tabs
|
|
58
|
-
*/
|
|
59
|
-
this.tabs = [];
|
|
60
|
-
/**
|
|
61
|
-
* Component classes
|
|
62
|
-
*/
|
|
63
|
-
this.classList = new ClassList(['mg-tabs']);
|
|
42
|
+
// variables
|
|
43
|
+
this.startIndex = 1;
|
|
64
44
|
/**
|
|
65
45
|
* Method to set active tab
|
|
66
46
|
*
|
|
@@ -151,6 +131,13 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
151
131
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
152
132
|
}
|
|
153
133
|
};
|
|
134
|
+
this.identifier = createID('mg-tabs');
|
|
135
|
+
this.label = undefined;
|
|
136
|
+
this.size = 'regular';
|
|
137
|
+
this.items = undefined;
|
|
138
|
+
this.activeTab = 1;
|
|
139
|
+
this.tabs = [];
|
|
140
|
+
this.classList = new ClassList(['mg-tabs']);
|
|
154
141
|
}
|
|
155
142
|
validateLabel(newValue) {
|
|
156
143
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -6,7 +6,7 @@ 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);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}";
|
|
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--primary.mg-tag--soft{font-weight:200;background-color:hsl(var(--color-dark-h), var(--color-dark-s), 90%);border-color:hsl(var(--color-dark-h), var(--color-dark-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--primary.mg-tag--soft ::slotted(mg-icon){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--secondary.mg-tag--soft{font-weight:200;background-color:hsl(var(--color-light-h), var(--color-light-s), 90%);border-color:hsl(var(--color-light-h), var(--color-light-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--secondary.mg-tag--soft ::slotted(mg-icon){color:hsl(var(--color-dark))}.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--success.mg-tag--soft{font-weight:200;background-color:hsl(var(--color-success-h), var(--color-success-s), 90%);border-color:hsl(var(--color-success-h), var(--color-success-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--success.mg-tag--soft ::slotted(mg-icon){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--warning.mg-tag--soft{font-weight:200;background-color:hsl(var(--color-warning-h), var(--color-warning-s), 90%);border-color:hsl(var(--color-warning-h), var(--color-warning-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--warning.mg-tag--soft ::slotted(mg-icon){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--danger.mg-tag--soft{font-weight:200;background-color:hsl(var(--color-danger-h), var(--color-danger-s), 90%);border-color:hsl(var(--color-danger-h), var(--color-danger-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--danger.mg-tag--soft ::slotted(mg-icon){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--info.mg-tag--soft{font-weight:200;background-color:hsl(var(--color-info-h), var(--color-info-s), 90%);border-color:hsl(var(--color-info-h), var(--color-info-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--info.mg-tag--soft ::slotted(mg-icon){color:hsl(var(--color-info))}.mg-tag,mg-tag{display:inline-block;vertical-align:middle}::slotted(mg-icon){margin-right:0.4rem}";
|
|
10
10
|
|
|
11
11
|
const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
@@ -18,16 +18,10 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
18
18
|
************/
|
|
19
19
|
// Classes
|
|
20
20
|
this.classOutline = `mg-tag--outline`;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Define button variant
|
|
26
|
-
*/
|
|
27
|
-
this.variant = variants[0]; // primary
|
|
28
|
-
/**
|
|
29
|
-
* Component classes
|
|
30
|
-
*/
|
|
21
|
+
this.classSoft = `mg-tag--soft`;
|
|
22
|
+
this.variant = variants[0];
|
|
23
|
+
this.outline = undefined;
|
|
24
|
+
this.soft = undefined;
|
|
31
25
|
this.classList = new ClassList(['mg-tag']);
|
|
32
26
|
}
|
|
33
27
|
validateVariant(newValue, oldValue) {
|
|
@@ -47,6 +41,29 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
47
41
|
else
|
|
48
42
|
this.classList.delete(this.classOutline);
|
|
49
43
|
}
|
|
44
|
+
validateSoft(newValue) {
|
|
45
|
+
// usage validation
|
|
46
|
+
if (newValue && this.outline)
|
|
47
|
+
throw new Error('<mg-tag> prop "soft" can NOT be used with prop "outline".');
|
|
48
|
+
// apply class
|
|
49
|
+
if (newValue)
|
|
50
|
+
this.classList.add(this.classSoft);
|
|
51
|
+
else
|
|
52
|
+
this.classList.delete(this.classSoft);
|
|
53
|
+
}
|
|
54
|
+
/*************
|
|
55
|
+
* Methods *
|
|
56
|
+
*************/
|
|
57
|
+
/**
|
|
58
|
+
* Validate the given textContent
|
|
59
|
+
*
|
|
60
|
+
* @param {string} textContent html element textContent property
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
validateTextContent(textContent) {
|
|
64
|
+
if (!textContent || textContent.trim() === '')
|
|
65
|
+
throw new Error('<mg-tag> slot must contain a text content.');
|
|
66
|
+
}
|
|
50
67
|
/*************
|
|
51
68
|
* Lifecycle *
|
|
52
69
|
*************/
|
|
@@ -58,6 +75,8 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
58
75
|
componentWillLoad() {
|
|
59
76
|
this.validateVariant(this.variant);
|
|
60
77
|
this.validateOutline(this.outline);
|
|
78
|
+
this.validateSoft(this.soft);
|
|
79
|
+
this.validateTextContent(this.element.textContent);
|
|
61
80
|
}
|
|
62
81
|
/**
|
|
63
82
|
* Render
|
|
@@ -67,14 +86,17 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
67
86
|
render() {
|
|
68
87
|
return (h("span", { class: this.classList.join() }, h("slot", null)));
|
|
69
88
|
}
|
|
89
|
+
get element() { return this; }
|
|
70
90
|
static get watchers() { return {
|
|
71
91
|
"variant": ["validateVariant"],
|
|
72
|
-
"outline": ["validateOutline"]
|
|
92
|
+
"outline": ["validateOutline"],
|
|
93
|
+
"soft": ["validateSoft"]
|
|
73
94
|
}; }
|
|
74
95
|
static get style() { return mgTagCss; }
|
|
75
96
|
}, [1, "mg-tag", {
|
|
76
97
|
"variant": [1],
|
|
77
98
|
"outline": [4],
|
|
99
|
+
"soft": [4],
|
|
78
100
|
"classList": [32]
|
|
79
101
|
}]);
|
|
80
102
|
function defineCustomElement$1() {
|