@mgdis/mg-components 4.2.1 → 5.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/loader.cjs.js +1 -1
- package/dist/cjs/{mg-badge_23.cjs.entry.js → mg-badge_24.cjs.entry.js} +2032 -42
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-modal.cjs.entry.js +1 -3
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -3
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -2
- package/dist/collection/components/atoms/mg-button/mg-button.css +106 -68
- package/dist/collection/components/atoms/mg-button/mg-button.js +51 -64
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +3 -0
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +4 -6
- package/dist/collection/components/molecules/inputs/MgInput.js +1 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +2 -3
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +15 -7
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +27 -2
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +1 -3
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -3
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +8 -7
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -4
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -8
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -3
- package/dist/collection/variables.css +6 -0
- package/dist/components/MgInput.js +1 -3
- package/dist/components/mg-badge2.js +1 -3
- package/dist/components/mg-button2.js +44 -13
- package/dist/components/mg-form.js +2 -3
- package/dist/components/mg-icon2.js +3 -0
- package/dist/components/mg-illustrated-message.js +12 -4
- package/dist/components/mg-input-title2.js +1 -3
- package/dist/components/mg-modal.js +1 -3
- package/dist/components/mg-pagination.js +4 -3
- package/dist/components/mg-panel.js +3 -5
- package/dist/components/mg-popover.js +9 -9
- package/dist/components/mg-tabs.js +1 -3
- package/dist/components/mg-tooltip2.js +6 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mg-badge_23.entry.js → mg-badge_24.entry.js} +2032 -43
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-modal.entry.js +1 -3
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-b60a4c53.entry.js +1 -0
- package/dist/mg-components/p-df947fa5.entry.js +1 -0
- package/dist/mg-components/variables.css +6 -0
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +2 -2
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +5 -1
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +19 -17
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +4 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +1 -0
- package/dist/types/components.d.ts +13 -29
- package/package.json +1 -1
- package/dist/cjs/mg-popover.cjs.entry.js +0 -171
- package/dist/cjs/popper-11d5f714.js +0 -1801
- package/dist/collection/variables.scss +0 -212
- package/dist/esm/mg-popover.entry.js +0 -167
- package/dist/esm/popper-f860750c.js +0 -1799
- package/dist/mg-components/p-25452f60.entry.js +0 -1
- package/dist/mg-components/p-a20fc541.entry.js +0 -1
- package/dist/mg-components/p-e08bc19a.entry.js +0 -1
- package/dist/mg-components/p-ec26fc38.js +0 -1
- package/dist/mg-components/variables.scss +0 -212
package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
.mg-illustrated-message {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
gap: 3em 7rem;
|
|
2
6
|
margin: auto;
|
|
3
|
-
padding:
|
|
7
|
+
padding: var(--mg-illustrated-message-padding-vertical) 1.5rem;
|
|
4
8
|
max-width: 47.5rem;
|
|
5
9
|
box-sizing: border-box;
|
|
6
10
|
text-align: center;
|
|
7
11
|
}
|
|
8
|
-
|
|
12
|
+
.mg-illustrated-message.mg-illustrated-message--horizontal {
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
align-items: center;
|
|
16
|
+
max-width: unset;
|
|
17
|
+
}
|
|
18
|
+
.mg-illustrated-message.mg-illustrated-message--horizontal .mg-illustrated-message__slots,
|
|
19
|
+
.mg-illustrated-message.mg-illustrated-message--horizontal .mg-illustrated-message__illustration {
|
|
20
|
+
max-width: 47.5rem;
|
|
21
|
+
}
|
|
9
22
|
.mg-illustrated-message__illustration {
|
|
10
23
|
max-height: 33.5rem;
|
|
11
24
|
}
|
|
@@ -21,17 +34,12 @@
|
|
|
21
34
|
.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small ::slotted([slot=illustration]) {
|
|
22
35
|
max-height: 6rem;
|
|
23
36
|
}
|
|
24
|
-
|
|
25
|
-
.mg-illustrated-message__title {
|
|
26
|
-
margin: 3rem 0 0;
|
|
27
|
-
}
|
|
28
37
|
.mg-illustrated-message__title ::slotted([slot=title]) {
|
|
29
38
|
margin: 0;
|
|
30
39
|
font-size: 2rem !important;
|
|
31
40
|
font-family: var(--font-family) !important;
|
|
32
41
|
font-weight: 400;
|
|
33
42
|
}
|
|
34
|
-
|
|
35
43
|
.mg-illustrated-message__details ::slotted([slot=details]) {
|
|
36
44
|
margin: 2rem 0 0;
|
|
37
45
|
}
|
package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js
CHANGED
|
@@ -6,6 +6,10 @@ export class MgIllustratedMessage {
|
|
|
6
6
|
* Define illustration size
|
|
7
7
|
*/
|
|
8
8
|
this.size = 'regular';
|
|
9
|
+
/**
|
|
10
|
+
* Define component orientation
|
|
11
|
+
*/
|
|
12
|
+
this.direction = 'vertical';
|
|
9
13
|
}
|
|
10
14
|
/*************
|
|
11
15
|
* Lifecycle *
|
|
@@ -31,10 +35,13 @@ export class MgIllustratedMessage {
|
|
|
31
35
|
* @returns {HTMLElement} HTML Element
|
|
32
36
|
*/
|
|
33
37
|
render() {
|
|
34
|
-
return (h("div", { class:
|
|
38
|
+
return (h("div", { class: {
|
|
39
|
+
'mg-illustrated-message': true,
|
|
40
|
+
'mg-illustrated-message--horizontal': this.direction === 'horizontal',
|
|
41
|
+
} }, h("div", { class: {
|
|
35
42
|
'mg-illustrated-message__illustration': true,
|
|
36
43
|
'mg-illustrated-message__illustration--small': this.size === 'small',
|
|
37
|
-
} }, h("slot", { name: "illustration" })), h("div", { class: "mg-illustrated-message__title" }, h("slot", { name: "title" })), h("div", { class: "mg-illustrated-message__details" }, h("slot", { name: "details" }))));
|
|
44
|
+
} }, h("slot", { name: "illustration" })), h("div", { class: "mg-illustrated-message__slots" }, h("div", { class: "mg-illustrated-message__title" }, h("slot", { name: "title" })), h("div", { class: "mg-illustrated-message__details" }, h("slot", { name: "details" })))));
|
|
38
45
|
}
|
|
39
46
|
static get is() { return "mg-illustrated-message"; }
|
|
40
47
|
static get encapsulation() { return "shadow"; }
|
|
@@ -67,6 +74,24 @@ export class MgIllustratedMessage {
|
|
|
67
74
|
"attribute": "size",
|
|
68
75
|
"reflect": false,
|
|
69
76
|
"defaultValue": "'regular'"
|
|
77
|
+
},
|
|
78
|
+
"direction": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"mutable": false,
|
|
81
|
+
"complexType": {
|
|
82
|
+
"original": "'vertical' | 'horizontal'",
|
|
83
|
+
"resolved": "\"horizontal\" | \"vertical\"",
|
|
84
|
+
"references": {}
|
|
85
|
+
},
|
|
86
|
+
"required": false,
|
|
87
|
+
"optional": false,
|
|
88
|
+
"docs": {
|
|
89
|
+
"tags": [],
|
|
90
|
+
"text": "Define component orientation"
|
|
91
|
+
},
|
|
92
|
+
"attribute": "direction",
|
|
93
|
+
"reflect": false,
|
|
94
|
+
"defaultValue": "'vertical'"
|
|
70
95
|
}
|
|
71
96
|
};
|
|
72
97
|
}
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
* @returns {HTMLElement} HTMLElement
|
|
14
14
|
*/
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
-
const Template = (args) => (h("div", null, h("mg-button", { controls: "identifier", haspopup: "dialog", onClick: () => {
|
|
16
|
+
const Template = (args) => (h("div", null, h("mg-button", { "aria-controls": "identifier", "aria-haspopup": "dialog", onClick: () => {
|
|
17
17
|
const mgModal = document.querySelector('mg-modal');
|
|
18
18
|
const isHide = mgModal.hide === true;
|
|
19
19
|
if (isHide) {
|
|
@@ -50,9 +50,7 @@ export class MgModal {
|
|
|
50
50
|
}
|
|
51
51
|
validateModalTitle(newValue) {
|
|
52
52
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
53
|
-
|
|
54
|
-
// throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
55
|
-
console.error('<mg-modal> prop "modalTitle" is required.');
|
|
53
|
+
throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
56
|
validateHide(newValue) {
|
|
@@ -64,10 +64,11 @@ export class MgPagination {
|
|
|
64
64
|
* Go to 'previous/next' page button handler
|
|
65
65
|
*
|
|
66
66
|
* @param {string} action navigation action
|
|
67
|
+
* @param {boolean} disabled button disable state
|
|
67
68
|
* @returns {void}
|
|
68
69
|
*/
|
|
69
|
-
this.handleGoToPage = (action) => {
|
|
70
|
-
this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
70
|
+
this.handleGoToPage = (action, disabled) => {
|
|
71
|
+
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
74
|
validateTotalPages(newValue) {
|
|
@@ -111,7 +112,7 @@ export class MgPagination {
|
|
|
111
112
|
render() {
|
|
112
113
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
113
114
|
// eslint-disable-next-line react/jsx-no-bind
|
|
114
|
-
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" })));
|
|
115
|
+
onClick: () => this.handleGoToPage(action, disabled), 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" })));
|
|
115
116
|
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
116
117
|
}
|
|
117
118
|
static get is() { return "mg-pagination"; }
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
* @returns {HTMLElement} HTMLElement
|
|
13
13
|
*/
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
const Template = (args) => (h("mg-panel", Object.assign({}, filterArgs(args)), h("div", null, "Content"), h("div", { slot: "header-right" }, h("mg-button", { variant: "secondary" }, h("mg-icon", { icon: "file-upload" }), " Upload"), h("mg-button", Object.assign({}, filterArgs({ isIcon: true }), { variant: "secondary", label: "delete" }), h("mg-icon", { icon: "trash" })))));
|
|
15
|
+
const Template = (args) => (h("mg-panel", Object.assign({}, filterArgs(args)), h("div", null, "Content"), h("div", { slot: "header-right", style: { width: '100%' } }, h("mg-badge", { label: "1", value: "1", style: { 'margin-right': 'auto' } }), h("mg-button", { variant: "secondary" }, h("mg-icon", { icon: "file-upload" }), " Upload"), h("mg-button", Object.assign({}, filterArgs({ isIcon: true }), { variant: "secondary", label: "delete" }), h("mg-icon", { icon: "trash" })))));
|
|
16
16
|
export const MgPanel = Template.bind({});
|
|
17
17
|
MgPanel.args = {
|
|
18
18
|
panelTitle: 'title',
|
|
@@ -23,20 +23,21 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.mg-panel__header-right {
|
|
26
|
+
padding-left: 0.3rem;
|
|
26
27
|
flex: 1 auto;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
.mg-panel__header-left mg-input-text {
|
|
30
31
|
flex-grow: 1;
|
|
32
|
+
margin-left: 0.3rem;
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
margin: 0 0.3rem 0 0;
|
|
34
|
+
.mg-panel__header-left mg-button + mg-button:not([slot=append-input]) {
|
|
35
|
+
margin-left: 0.3rem;
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
font-size: 1.4rem;
|
|
39
|
-
font-weight: 600;
|
|
37
|
+
|
|
38
|
+
.mg-panel__collapse-button-content {
|
|
39
|
+
--font-size: 1.4rem;
|
|
40
|
+
--mg-button-font-weight: 600;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
.mg-panel__content {
|
|
@@ -93,7 +93,7 @@ export class MgPanel {
|
|
|
93
93
|
* @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
|
|
94
94
|
*/
|
|
95
95
|
this.headerLeft = () => {
|
|
96
|
-
const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content`, disabled: this.expandToggleDisabled }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle));
|
|
96
|
+
const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled }, h("span", { class: "mg-panel__collapse-button-content" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle)));
|
|
97
97
|
if (this.titleEditable && !this.isEditing) {
|
|
98
98
|
return [
|
|
99
99
|
collapseButton(),
|
|
@@ -111,9 +111,7 @@ export class MgPanel {
|
|
|
111
111
|
}
|
|
112
112
|
validatePanelTitle(newValue) {
|
|
113
113
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
114
|
-
|
|
115
|
-
// throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
116
|
-
console.error('<mg-panel> prop "panelTitle" is required.');
|
|
114
|
+
throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
117
115
|
}
|
|
118
116
|
this.titleChange.emit(newValue);
|
|
119
117
|
}
|
|
@@ -51,7 +51,7 @@ mg-popover::slotted(*) {
|
|
|
51
51
|
left: -6px;
|
|
52
52
|
}
|
|
53
53
|
.mg-popover__title ::slotted([slot=title]) {
|
|
54
|
-
margin: 0 0 1rem;
|
|
55
|
-
font-size: var(--mg-popover-title-font-size);
|
|
54
|
+
margin: 0 0 1rem !important;
|
|
55
|
+
font-size: var(--mg-popover-title-font-size) !important;
|
|
56
56
|
font-weight: 600;
|
|
57
57
|
}
|
|
@@ -33,8 +33,7 @@ export class MgPopover {
|
|
|
33
33
|
* @returns {void}
|
|
34
34
|
*/
|
|
35
35
|
this.clickOutside = (event) => {
|
|
36
|
-
|
|
37
|
-
if (!this.disabled && ((_a = event.target.closest(`#${this.identifier}`)) === null || _a === void 0 ? void 0 : _a.parentElement.nodeName) !== 'MG-POPOVER') {
|
|
36
|
+
if (!this.disabled && event.target.closest(`mg-popover`) !== this.element) {
|
|
38
37
|
this.display = false;
|
|
39
38
|
}
|
|
40
39
|
};
|
|
@@ -106,8 +105,8 @@ export class MgPopover {
|
|
|
106
105
|
*/
|
|
107
106
|
componentDidLoad() {
|
|
108
107
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
109
|
-
const
|
|
110
|
-
if (
|
|
108
|
+
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
109
|
+
if (slottedTitleElement && !isTagName(slottedTitleElement, headingTags)) {
|
|
111
110
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
112
111
|
}
|
|
113
112
|
// Set close button id
|
|
@@ -115,9 +114,9 @@ export class MgPopover {
|
|
|
115
114
|
this.closeButtonId = `${this.identifier}-close-button`;
|
|
116
115
|
}
|
|
117
116
|
// Get popover content
|
|
118
|
-
this.popover = this.element.querySelector(`#${this.identifier}`);
|
|
119
|
-
//Get interactive element
|
|
120
|
-
const interactiveElement = this.element.
|
|
117
|
+
this.popover = this.element.shadowRoot.querySelector(`#${this.identifier}`);
|
|
118
|
+
//Get interactive element (first element without slot attribute)
|
|
119
|
+
const interactiveElement = this.element.querySelector(':not([slot])');
|
|
121
120
|
// Add aria attributes
|
|
122
121
|
interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
123
122
|
interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
@@ -154,7 +153,7 @@ export class MgPopover {
|
|
|
154
153
|
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 }))));
|
|
155
154
|
}
|
|
156
155
|
static get is() { return "mg-popover"; }
|
|
157
|
-
static get encapsulation() { return "
|
|
156
|
+
static get encapsulation() { return "shadow"; }
|
|
158
157
|
static get originalStyleUrls() {
|
|
159
158
|
return {
|
|
160
159
|
"$": ["mg-popover.scss"]
|
|
@@ -131,9 +131,7 @@ export class MgTabs {
|
|
|
131
131
|
}
|
|
132
132
|
validateLabel(newValue) {
|
|
133
133
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
134
|
-
|
|
135
|
-
// throw new Error('<mg-tabs> prop "label" is required.');
|
|
136
|
-
console.error('<mg-tabs> prop "label" is required.');
|
|
134
|
+
throw new Error('<mg-tabs> prop "label" is required.');
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
validateSize(newValue) {
|
|
@@ -173,6 +173,12 @@
|
|
|
173
173
|
--mg-panel-background: var(--color-info-h) var(--color-info-s) calc(var(--color-info-l) + 68%);
|
|
174
174
|
--mg-panel-content-padding: 1.5rem;
|
|
175
175
|
|
|
176
|
+
/*
|
|
177
|
+
<mg-illustrated-message>
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
--mg-illustrated-message-padding-vertical: 4rem;
|
|
181
|
+
|
|
176
182
|
/*
|
|
177
183
|
Layout
|
|
178
184
|
*/
|
|
@@ -51,9 +51,7 @@ const MgInput = (props, children, utils) => {
|
|
|
51
51
|
* Check required properties
|
|
52
52
|
*/
|
|
53
53
|
if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
|
|
54
|
-
|
|
55
|
-
// throw new Error('<mg-input> prop "identifier" is required.');
|
|
56
|
-
console.error('<mg-input> prop "identifier" is required.');
|
|
54
|
+
throw new Error('<mg-input> prop "identifier" is required.');
|
|
57
55
|
}
|
|
58
56
|
if (typeof props.label !== 'string' || props.label.trim() === '') {
|
|
59
57
|
throw new Error('<mg-input> prop "label" is required.');
|
|
@@ -34,9 +34,7 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
34
34
|
}
|
|
35
35
|
validateLabel(newValue) {
|
|
36
36
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
37
|
-
|
|
38
|
-
// throw new Error('<mg-badge> prop "label" is required.');
|
|
39
|
-
console.error('<mg-badge> prop "label" is required.');
|
|
37
|
+
throw new Error('<mg-badge> prop "label" is required.');
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
validateVariant(newValue, oldValue) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { C as ClassList } from './components.utils.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './mg-icon2.js';
|
|
4
4
|
|
|
@@ -7,16 +7,19 @@ import { d as defineCustomElement$1 } from './mg-icon2.js';
|
|
|
7
7
|
*/
|
|
8
8
|
const variants = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success'];
|
|
9
9
|
|
|
10
|
-
const mgButtonCss = "
|
|
10
|
+
const mgButtonCss = ":host{display:inline-block;vertical-align:middle;max-width:100%}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-button:not(.mg-button--disabled){outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:0.2rem}:host(:hover) .mg-button--flat:not(.mg-button--disabled),:host(:focus) .mg-button--flat:not(.mg-button--disabled),:host(:active) .mg-button--flat:not(.mg-button--disabled){background:hsla(var(--color-dark), 0.1)}.mg-button.mg-button--primary{border-color:hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-primary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--primary:not(.mg-button--disabled),:host(:focus) .mg-button--primary:not(.mg-button--disabled),:host(:active) .mg-button--primary:not(.mg-button--disabled){background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-button.mg-button--secondary{border-color:hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-secondary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--secondary:not(.mg-button--disabled),:host(:focus) .mg-button--secondary:not(.mg-button--disabled),:host(:active) .mg-button--secondary:not(.mg-button--disabled){background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-button.mg-button--danger{border-color:hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger:not(.mg-button--disabled),:host(:focus) .mg-button--danger:not(.mg-button--disabled),:host(:active) .mg-button--danger:not(.mg-button--disabled){background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-button.mg-button--danger-alt{border-color:hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-danger));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger-alt:not(.mg-button--disabled),:host(:focus) .mg-button--danger-alt:not(.mg-button--disabled),:host(:active) .mg-button--danger-alt:not(.mg-button--disabled){background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-button.mg-button--info{border-color:hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--info:not(.mg-button--disabled),:host(:focus) .mg-button--info:not(.mg-button--disabled),:host(:active) .mg-button--info:not(.mg-button--disabled){background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-button.mg-button--success{border-color:hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-dark));background:linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--success:not(.mg-button--disabled),:host(:focus) .mg-button--success:not(.mg-button--disabled),:host(:active) .mg-button--success:not(.mg-button--disabled){background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-button{position:relative;display:inline-flex;align-items:center;column-gap:0.6rem;padding:calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;min-height:var(--default-size);box-sizing:border-box;border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));cursor:pointer;background-image:none;border-top-width:var(--mg-button-border-top-width, 0.1rem);border-right-width:var(--mg-button-border-right-width, 0.1rem);border-bottom-width:var(--mg-button-border-bottom-width, 0.1rem);border-left-width:var(--mg-button-border-left-width, 0.1rem);border-style:solid;text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);touch-action:manipulation}.mg-button.mg-button--disabled{opacity:var(--mg-button-disabled-opacity);cursor:default}.mg-button.mg-button--icon{padding:0;justify-content:center;width:var(--default-size);height:var(--default-size);border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));font-size:var(--font-size);line-height:var(--font-size)}.mg-button.mg-button--flat{background:none;border:none}.mg-button.mg-button--loading>mg-icon:first-of-type{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.mg-button.mg-button--loading .mg-button__content{opacity:0}.mg-button mg-icon:only-child,.mg-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;line-height:1;margin:auto 0}.mg-button slot,.mg-button ::slotted(*:not(mg-icon)){text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);display:flex;align-items:center;column-gap:0.6rem}";
|
|
11
11
|
|
|
12
12
|
const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
13
13
|
constructor() {
|
|
14
14
|
super();
|
|
15
15
|
this.__registerHost();
|
|
16
|
+
this.__attachShadow();
|
|
16
17
|
/************
|
|
17
18
|
* Internal *
|
|
18
19
|
************/
|
|
19
20
|
this.onClickElementFn = null;
|
|
21
|
+
this.classDisabled = 'mg-button--disabled';
|
|
22
|
+
this.classLoading = 'mg-button--loading';
|
|
20
23
|
/**
|
|
21
24
|
* Define button variant
|
|
22
25
|
*/
|
|
@@ -51,11 +54,38 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
51
54
|
if (this.disabled)
|
|
52
55
|
event.stopPropagation();
|
|
53
56
|
// Used to prevent multi-click.
|
|
54
|
-
if (this.disableOnClick
|
|
57
|
+
else if (this.disableOnClick) {
|
|
55
58
|
this.loading = true;
|
|
56
59
|
this.disabled = true;
|
|
57
60
|
}
|
|
58
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Handle onKeyDown event
|
|
64
|
+
*
|
|
65
|
+
* @param {KeyboardEvent} event keyboard event
|
|
66
|
+
* @returns {void}
|
|
67
|
+
*/
|
|
68
|
+
this.handleKeydown = (event) => {
|
|
69
|
+
if (!this.disabled && event.key === ' ') {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Handle onKeyUp event
|
|
79
|
+
*
|
|
80
|
+
* @param {KeyboardEvent} event keyboard event
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
this.handleKeyup = (event) => {
|
|
84
|
+
if (!this.disabled && event.key === ' ') {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
87
|
+
}
|
|
88
|
+
};
|
|
59
89
|
}
|
|
60
90
|
validateVariant(newValue, oldValue) {
|
|
61
91
|
if (!variants.includes(newValue)) {
|
|
@@ -76,14 +106,21 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
76
106
|
}
|
|
77
107
|
// Manage if onclick
|
|
78
108
|
this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
|
|
109
|
+
// apply style
|
|
110
|
+
if (isDisabled) {
|
|
111
|
+
this.classList.add(this.classDisabled);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.classList.delete(this.classDisabled);
|
|
115
|
+
}
|
|
79
116
|
}
|
|
80
117
|
loadingHandler(newValue) {
|
|
81
118
|
// we add loading style if it newvalue is true else we remove it
|
|
82
119
|
if (newValue) {
|
|
83
|
-
this.classList.add(
|
|
120
|
+
this.classList.add(this.classLoading);
|
|
84
121
|
}
|
|
85
122
|
else {
|
|
86
|
-
this.classList.delete(
|
|
123
|
+
this.classList.delete(this.classLoading);
|
|
87
124
|
}
|
|
88
125
|
}
|
|
89
126
|
/**
|
|
@@ -109,10 +146,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
109
146
|
* @returns {HTMLElement} html element
|
|
110
147
|
*/
|
|
111
148
|
render() {
|
|
112
|
-
return (h("button",
|
|
113
|
-
// has stencil does not support form attribute on button, we set the attribute from the ref
|
|
114
|
-
// https://github.com/ionic-team/stencil/issues/2703#issuecomment-1050943715
|
|
115
|
-
ref: btn => this.form && btn.setAttribute('form', this.form) }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null))));
|
|
149
|
+
return (h(Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyUp: this.handleKeyup, onKeyDown: this.handleKeydown }, h("div", { class: this.classList.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
|
|
116
150
|
}
|
|
117
151
|
get element() { return this; }
|
|
118
152
|
static get watchers() { return {
|
|
@@ -121,7 +155,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
121
155
|
"loading": ["loadingHandler"]
|
|
122
156
|
}; }
|
|
123
157
|
static get style() { return mgButtonCss; }
|
|
124
|
-
}, [
|
|
158
|
+
}, [1, "mg-button", {
|
|
125
159
|
"variant": [1],
|
|
126
160
|
"identifier": [1],
|
|
127
161
|
"label": [1],
|
|
@@ -130,9 +164,6 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
130
164
|
"disabled": [1028],
|
|
131
165
|
"isIcon": [4, "is-icon"],
|
|
132
166
|
"disableOnClick": [4, "disable-on-click"],
|
|
133
|
-
"expanded": [4],
|
|
134
|
-
"controls": [1],
|
|
135
|
-
"haspopup": [8],
|
|
136
167
|
"loading": [32],
|
|
137
168
|
"classList": [32]
|
|
138
169
|
}]);
|
|
@@ -128,9 +128,8 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
128
|
*/
|
|
129
129
|
componentDidLoad() {
|
|
130
130
|
this.mgButtons.forEach(mgButton => {
|
|
131
|
-
// submit buttons should trigger form submition
|
|
132
|
-
|
|
133
|
-
if (['submit', null].includes(button.getAttribute('type'))) {
|
|
131
|
+
// submit buttons should trigger form submition;
|
|
132
|
+
if (['submit', null].includes(mgButton.getAttribute('type'))) {
|
|
134
133
|
mgButton.addEventListener('click', () => {
|
|
135
134
|
this.form.dispatchEvent(new CustomEvent('submit', { bubbles: true }));
|
|
136
135
|
});
|
|
@@ -52,6 +52,8 @@ const icons = {
|
|
|
52
52
|
'dashboard': () => h("path", { fill: "currentColor", d: "M1.67 8.7H7.3V1.67H1.67v7.04Zm0 5.63H7.3v-4.22H1.67v4.22Zm7.04 0h5.63V7.3H8.71v7.04Zm0-12.67v4.23h5.63V1.67H8.71Z" }),
|
|
53
53
|
'dashboard-outline': () => (h("path", { fill: "currentColor", d: "M13.33 2.67v2.22H9.7V2.67h3.63m-7.04 0V7.7H2.67V2.67H6.3m7.04 5.63v5.04H9.71V8.3h3.63M6.3 11.11v2.22H2.67v-2.22H6.3m8.03-9.44H8.7v4.22h5.63V1.67Zm-7.04 0H1.67v7.04H7.3V1.67Zm7.04 5.63H8.7v7.04h5.63V7.3Zm-7.04 2.81H1.67v4.22H7.3v-4.22Z" })),
|
|
54
54
|
'download': () => (h("path", { fill: "currentColor", d: "M6.4 2v4.1c0 .2-.1.3-.3.3H4c-.2 0-.3.1-.3.3 0 .1 0 .2.1.2l4 4c.1.1.3.1.4 0l4-4c.1-.1.1-.3 0-.4-.1-.1-.1-.1-.2-.1H9.9c-.2 0-.3-.1-.3-.3V2c0-.2-.1-.3-.3-.3H6.7c-.1 0-.3.1-.3.3zm7.9 11v1c0 .2-.1.3-.3.3H2c-.2 0-.3-.1-.3-.3v-1c0-.2.1-.3.3-.3h12c.2 0 .3.1.3.3z" })),
|
|
55
|
+
'ellipsis': () => (h("path", { fill: "currentColor", d: "M2.5 6.17A1.83 1.83 0 1 0 4.33 8c0-1.01-.82-1.83-1.83-1.83Zm11 0A1.83 1.83 0 1 0 15.33 8c0-1.01-.82-1.83-1.83-1.83Zm-5.5 0A1.83 1.83 0 1 0 9.83 8c0-1.01-.82-1.83-1.83-1.83Z" })),
|
|
56
|
+
'ellipsis-vertical': () => (h("path", { fill: "currentColor", d: "M6.17 13.5A1.83 1.83 0 1 0 8 11.67c-1.01 0-1.83.82-1.83 1.83Zm0-11A1.83 1.83 0 1 0 8 .67c-1.01 0-1.83.82-1.83 1.83Zm0 5.5A1.83 1.83 0 1 0 8 6.17c-1.01 0-1.83.82-1.83 1.83Z" })),
|
|
55
57
|
'euro': () => (h("path", { fill: "currentColor", d: "M13 13.14a.4.4 0 0 0-.47-.31A7.79 7.79 0 0 1 11 13a4.31 4.31 0 0 1-4-2.79h3.8a.41.41 0 0 0 .39-.31l.19-.9a.39.39 0 0 0-.3-.47H6.51a7.07 7.07 0 0 1 0-1.38h4.89a.4.4 0 0 0 .39-.31l.22-1a.4.4 0 0 0-.3-.47H7a4.2 4.2 0 0 1 3.92-2.45 6.57 6.57 0 0 1 1.26.14.41.41 0 0 0 .47-.29l.4-1.45a.4.4 0 0 0-.28-.48A9.43 9.43 0 0 0 11 .67a7.12 7.12 0 0 0-6.83 4.7h-1.1a.4.4 0 0 0-.4.39v1a.4.4 0 0 0 .4.39h.72a9.08 9.08 0 0 0 0 1.38h-.72a.39.39 0 0 0-.4.39v.93a.4.4 0 0 0 .4.39h1A7 7 0 0 0 11 15.3a8.7 8.7 0 0 0 2-.25.39.39 0 0 0 .3-.46l-.3-1.45Z" })),
|
|
56
58
|
'euro-circle': () => (h("path", { fill: "currentColor", d: "M8 .67C3.95.67.67 3.95.67 8S3.95 15.33 8 15.33s7.33-3.28 7.33-7.33S12.05.67 8 .67Zm2.27 11.4c-.38.09-.76.14-1.15.14a4.038 4.038 0 0 1-3.99-2.92h-.58c-.13 0-.23-.1-.23-.22v-.54c0-.12.11-.22.23-.22h.41a5.34 5.34 0 0 1 0-.8h-.41c-.13 0-.23-.1-.23-.22v-.58c0-.13.11-.22.23-.22h.63c.6-1.65 2.18-2.74 3.94-2.71.34 0 .68.03 1.02.1.12.03.19.16.16.28l-.23.84c-.03.12-.15.19-.27.17-.24-.05-.48-.08-.73-.08A2.42 2.42 0 0 0 6.81 6.5h2.71c.12.03.2.15.17.27l-.13.58c-.02.1-.12.18-.22.18H6.52c-.03.26-.03.53 0 .8h2.63c.12.03.2.15.17.27l-.11.52c-.03.1-.12.18-.22.18H6.8c.36.96 1.28 1.6 2.31 1.61.3 0 .59-.04.88-.1.12-.02.24.05.27.18l.17.84c.02.12-.05.24-.17.27v-.03Z" })),
|
|
57
59
|
'exclamation-circle': () => (h("path", { fill: "currentColor", d: "M8 15.33c4.05 0 7.33-3.28 7.33-7.33S12.05.67 8 .67.67 3.95.67 8 3.95 15.33 8 15.33Zm.95-3.3c0 .15-.12.27-.28.27h-1.4c-.15 0-.28-.12-.28-.27v-1.31c0-.15.12-.28.28-.28h1.4c.15 0 .28.12.28.28v1.31ZM7 3.96c0-.14.11-.25.25-.25H8.7c.14 0 .25.11.25.25v4.8c0 .14-.11.25-.25.25H7.25c-.14 0-.25-.11-.25-.25V3.95Z" })),
|
|
@@ -151,6 +153,7 @@ const icons = {
|
|
|
151
153
|
'user-group': () => (h("path", { fill: "currentColor", d: "M13.15 4.12c-.81-.01-1.47.65-1.48 1.46 0 .82.65 1.47 1.46 1.48s1.47-.65 1.48-1.46-.65-1.47-1.46-1.48Zm-10.04.01a1.47 1.47 0 0 0-1.58 1.59c.06.71.62 1.28 1.34 1.34.81.07 1.52-.53 1.59-1.34.06-.81-.54-1.52-1.35-1.59Zm7.36.39c-.22-.84-.87-1.51-1.71-1.75-1.36-.41-2.8.36-3.22 1.72-.18.61-.13 1.27.14 1.85.41.9 1.33 1.48 2.32 1.45 1.41.01 2.56-1.14 2.57-2.55 0-.24-.03-.49-.1-.72Zm-.71 4h-.19c-.99.49-2.14.49-3.13 0h-.19c-1.46 0-2.64 1.18-2.64 2.64v2.69c1.23.93 2.74 1.47 4.39 1.47s3.17-.55 4.4-1.48v-2.68c0-1.46-1.18-2.64-2.64-2.64Zm5.52.25a7.282 7.282 0 0 1-1.65 3.91c-.08.1-.16.19-.25.28-.08.09-.17.18-.25.27v-.55h.03v-.72s.01-.07 0-.1v-.66c.01-1.25-.66-2.4-1.76-3 .27-.26.63-.41 1-.41h1.51c.63.01 1.17.41 1.37.98ZM2.86 11.16v1.52h.01v.55l-.28-.31c-.08-.08-.15-.16-.22-.24A7.238 7.238 0 0 1 .74 8.86c.16-.62.72-1.07 1.4-1.07h1.47c.37-.01.73.12 1.01.37-1.1.6-1.77 1.75-1.76 3Z" })),
|
|
152
154
|
'user-plus': () => (h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
|
|
153
155
|
'user-question-outline': () => (h("path", { fill: "currentColor", d: "M5.23 11.14c.86-.66 1.01-1.9.35-2.75s-1.9-1.01-2.75-.35a1.96 1.96 0 0 0 0 3.1c-.72.42-1.16 1.2-1.16 2.03v.8c0 .2.17.37.37.37h3.98c.2 0 .37-.17.37-.37v-.8c0-.83-.44-1.61-1.16-2.03ZM2.81 9.59c0-.67.55-1.22 1.22-1.22s1.22.55 1.22 1.22-.55 1.22-1.22 1.22-1.22-.55-1.22-1.22Zm2.83 4H2.41v-.42c0-.89.72-1.62 1.62-1.62s1.62.72 1.62 1.62v.42h-.01Zm7.13-11.93H8c-.86 0-1.56.7-1.56 1.56v7.16c0 .21.17.37.37.37.08 0 .16-.03.22-.07l1.49-1.12h4.25c.86 0 1.56-.7 1.56-1.56V3.22c0-.86-.7-1.56-1.56-1.56Zm.82 6.33c0 .45-.37.82-.82.82H8.4a.41.41 0 0 0-.22.07l-1 .75V3.22c0-.45.37-.82.82-.82h4.77c.45 0 .82.37.82.82v4.77Zm-2.8-.42c0 .23-.18.41-.41.41s-.41-.18-.41-.41.18-.41.41-.41c.23 0 .41.18.41.41Zm-.41-4.34c-.83 0-1.5.67-1.5 1.5 0 .23.18.41.41.41s.41-.18.41-.41c0-.38.31-.68.69-.68.38 0 .68.31.68.69 0 .38-.31.68-.68.68-.23 0-.41.18-.41.41v.44c0 .23.18.41.41.41s.41-.18.41-.41v-.09c.8-.23 1.26-1.06 1.04-1.85-.18-.65-.77-1.09-1.44-1.09Z" })),
|
|
156
|
+
'user-shield-outline': () => (h("path", { fill: "currentColor", d: "M8 8.92c-1.5 0-2.72-1.22-2.72-2.72S6.5 3.48 8 3.48s2.72 1.22 2.72 2.72S9.5 8.92 8 8.92Zm0-4.64a1.92 1.92 0 1 0 .001 3.841A1.92 1.92 0 0 0 8 4.28Zm4.97-1.84L8.56.78C8.2.65 7.81.65 7.45.78L3.03 2.43C2.41 2.66 2 3.26 2 3.92V8c0 3.82 4.23 6.47 5.52 7.2.15.08.31.13.48.13s.33-.04.48-.13C9.78 14.48 14 11.82 14 8V3.92c0-.66-.41-1.25-1.03-1.48ZM8.08 14.5c-.05.03-.12.03-.17 0-.49-.28-2.12-1.24-3.4-2.68.62-.82 1.94-1.39 3.47-1.39s2.84.61 3.49 1.4c-1.29 1.43-2.9 2.39-3.39 2.67ZM13.19 8c0 1.2-.51 2.28-1.22 3.22-.83-.91-2.34-1.59-4-1.59s-3.16.64-3.98 1.58c-.7-.93-1.2-2.01-1.2-3.2V3.93c0-.33.21-.62.51-.74l4.43-1.66c.09-.03.18-.05.27-.05s.19.02.27.05l4.42 1.66c.3.11.51.41.51.73V8Z" })),
|
|
154
157
|
'users': () => (h("path", { fill: "currentColor", d: "M12,8.76h-.2a5.24,5.24,0,0,1-3.93,0H7.61a3.05,3.05,0,0,0-3.3,2.75v.69a1.28,1.28,0,0,0,1.38,1.14H14a1.27,1.27,0,0,0,1.37-1.14v-.69A3.07,3.07,0,0,0,12,8.75Zm-6.4-.32A2,2,0,0,0,4.31,8H2.48A1.69,1.69,0,0,0,.65,9.53v.76a.85.85,0,0,0,.91.76H3.45A3.58,3.58,0,0,1,5.61,8.44ZM9.81,2.66A2.65,2.65,0,1,1,7.16,5.31h0A2.65,2.65,0,0,1,9.81,2.66ZM3.31,4.18A1.51,1.51,0,1,1,1.8,5.69,1.51,1.51,0,0,1,3.31,4.18Z" })),
|
|
155
158
|
'wallet': () => (h("path", { fill: "currentColor", d: "M13.88 5H3a.43.43 0 0 1-.46-.38.43.43 0 0 1 .46-.43h11a.43.43 0 0 0 .46-.38A1.28 1.28 0 0 0 13 2.67H2.5A1.7 1.7 0 0 0 .67 4.19v7.62a1.7 1.7 0 0 0 1.83 1.52h11.38a1.32 1.32 0 0 0 1.45-1.14V6.1A1.33 1.33 0 0 0 13.88 5Zm-1.21 5.29a1.1 1.1 0 1 1 1.1-1.1 1.1 1.1 0 0 1-1.1 1.05Z" })),
|
|
156
159
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { i as isTagName } from './components.utils.js';
|
|
3
3
|
|
|
4
|
-
const mgIllustratedMessageCss = ".mg-illustrated-message{margin:auto;padding:
|
|
4
|
+
const mgIllustratedMessageCss = ".mg-illustrated-message{display:flex;flex-direction:column;justify-content:center;gap:3em 7rem;margin:auto;padding:var(--mg-illustrated-message-padding-vertical) 1.5rem;max-width:47.5rem;box-sizing:border-box;text-align:center}.mg-illustrated-message.mg-illustrated-message--horizontal{flex-direction:row;flex-wrap:wrap;align-items:center;max-width:unset}.mg-illustrated-message.mg-illustrated-message--horizontal .mg-illustrated-message__slots,.mg-illustrated-message.mg-illustrated-message--horizontal .mg-illustrated-message__illustration{max-width:47.5rem}.mg-illustrated-message__illustration{max-height:33.5rem}.mg-illustrated-message__illustration ::slotted([slot=illustration]){width:auto;height:auto;max-width:100%;max-height:33.5rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small{max-height:6rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small ::slotted([slot=illustration]){max-height:6rem}.mg-illustrated-message__title ::slotted([slot=title]){margin:0;font-size:2rem !important;font-family:var(--font-family) !important;font-weight:400}.mg-illustrated-message__details ::slotted([slot=details]){margin:2rem 0 0}";
|
|
5
5
|
|
|
6
6
|
const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -12,6 +12,10 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
|
12
12
|
* Define illustration size
|
|
13
13
|
*/
|
|
14
14
|
this.size = 'regular';
|
|
15
|
+
/**
|
|
16
|
+
* Define component orientation
|
|
17
|
+
*/
|
|
18
|
+
this.direction = 'vertical';
|
|
15
19
|
}
|
|
16
20
|
/*************
|
|
17
21
|
* Lifecycle *
|
|
@@ -37,15 +41,19 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
|
37
41
|
* @returns {HTMLElement} HTML Element
|
|
38
42
|
*/
|
|
39
43
|
render() {
|
|
40
|
-
return (h("div", { class:
|
|
44
|
+
return (h("div", { class: {
|
|
45
|
+
'mg-illustrated-message': true,
|
|
46
|
+
'mg-illustrated-message--horizontal': this.direction === 'horizontal',
|
|
47
|
+
} }, h("div", { class: {
|
|
41
48
|
'mg-illustrated-message__illustration': true,
|
|
42
49
|
'mg-illustrated-message__illustration--small': this.size === 'small',
|
|
43
|
-
} }, h("slot", { name: "illustration" })), h("div", { class: "mg-illustrated-message__title" }, h("slot", { name: "title" })), h("div", { class: "mg-illustrated-message__details" }, h("slot", { name: "details" }))));
|
|
50
|
+
} }, h("slot", { name: "illustration" })), h("div", { class: "mg-illustrated-message__slots" }, h("div", { class: "mg-illustrated-message__title" }, h("slot", { name: "title" })), h("div", { class: "mg-illustrated-message__details" }, h("slot", { name: "details" })))));
|
|
44
51
|
}
|
|
45
52
|
get element() { return this; }
|
|
46
53
|
static get style() { return mgIllustratedMessageCss; }
|
|
47
54
|
}, [1, "mg-illustrated-message", {
|
|
48
|
-
"size": [1]
|
|
55
|
+
"size": [1],
|
|
56
|
+
"direction": [1]
|
|
49
57
|
}]);
|
|
50
58
|
function defineCustomElement$1() {
|
|
51
59
|
if (typeof customElements === "undefined") {
|
|
@@ -20,9 +20,7 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
20
20
|
}
|
|
21
21
|
validateIdentifier(newValue) {
|
|
22
22
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
23
|
-
|
|
24
|
-
// throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
25
|
-
console.error('<mg-input-title> prop "identifier" is required.');
|
|
23
|
+
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
/*************
|
|
@@ -60,9 +60,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
60
60
|
}
|
|
61
61
|
validateModalTitle(newValue) {
|
|
62
62
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
63
|
-
|
|
64
|
-
// throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
65
|
-
console.error('<mg-modal> prop "modalTitle" is required.');
|
|
63
|
+
throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
validateHide(newValue) {
|
|
@@ -81,10 +81,11 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
81
81
|
* Go to 'previous/next' page button handler
|
|
82
82
|
*
|
|
83
83
|
* @param {string} action navigation action
|
|
84
|
+
* @param {boolean} disabled button disable state
|
|
84
85
|
* @returns {void}
|
|
85
86
|
*/
|
|
86
|
-
this.handleGoToPage = (action) => {
|
|
87
|
-
this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
87
|
+
this.handleGoToPage = (action, disabled) => {
|
|
88
|
+
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
validateTotalPages(newValue) {
|
|
@@ -128,7 +129,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
128
129
|
render() {
|
|
129
130
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
130
131
|
// eslint-disable-next-line react/jsx-no-bind
|
|
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
|
+
onClick: () => this.handleGoToPage(action, disabled), 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
133
|
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
133
134
|
}
|
|
134
135
|
get element() { return this; }
|