@mgdis/mg-components 4.2.1 → 5.1.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_27.cjs.entry.js} +2590 -121
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -3
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +1 -2
- package/dist/collection/components/atoms/mg-button/mg-button.css +113 -67
- package/dist/collection/components/atoms/mg-button/mg-button.js +89 -64
- package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +18 -0
- package/dist/collection/components/atoms/mg-card/mg-card.css +7 -0
- package/dist/collection/components/atoms/mg-card/mg-card.js +26 -0
- package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +18 -0
- package/dist/collection/components/atoms/mg-divider/mg-divider.css +9 -0
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +57 -0
- 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/doc/mg-tooltip.stories.js +0 -5
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -20
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -7
- package/dist/collection/components/molecules/inputs/MgInput.js +1 -3
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +1 -0
- package/dist/collection/components/molecules/mg-details/mg-details.css +29 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +26 -4
- 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.css +2 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +53 -7
- 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 +12 -20
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -4
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -5
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +3 -3
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +10 -10
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -3
- package/dist/collection/utils/components.utils.js +10 -6
- package/dist/collection/variables.css +22 -1
- package/dist/components/MgInput.js +1 -3
- package/dist/components/components.utils.js +11 -7
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/mg-badge2.js +1 -3
- package/dist/components/mg-button2.js +63 -13
- package/dist/components/mg-card.d.ts +11 -0
- package/dist/components/mg-card.js +42 -0
- package/dist/components/mg-details.js +8 -3
- package/dist/components/mg-divider.d.ts +11 -0
- package/dist/components/mg-divider.js +51 -0
- 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 +54 -8
- package/dist/components/mg-pagination.js +4 -3
- package/dist/components/mg-panel.js +3 -5
- package/dist/components/mg-popover.js +11 -10
- package/dist/components/mg-tabs.js +1 -3
- package/dist/components/mg-tooltip2.js +7 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mg-badge_23.entry.js → mg-badge_27.entry.js} +2538 -73
- package/dist/esm/mg-components.js +1 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-e131701a.entry.js +1 -0
- package/dist/mg-components/variables.css +22 -1
- 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 +25 -17
- package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +6 -0
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +11 -0
- package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +6 -0
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +15 -0
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -8
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +1 -1
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +4 -0
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +4 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +8 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +1 -0
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -6
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
- package/dist/types/components.d.ts +64 -31
- package/dist/types/utils/components.utils.d.ts +7 -3
- package/package.json +4 -3
- package/dist/cjs/index-179621c8.js +0 -244
- package/dist/cjs/mg-modal.cjs.entry.js +0 -130
- package/dist/cjs/mg-popover.cjs.entry.js +0 -171
- package/dist/cjs/popper-11d5f714.js +0 -1801
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -20
- package/dist/collection/variables.scss +0 -212
- package/dist/esm/index-7efedd97.js +0 -238
- package/dist/esm/mg-modal.entry.js +0 -126
- 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-5f89600c.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/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -8
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
.mg-panel {
|
|
2
2
|
background-color: hsl(var(--mg-panel-background));
|
|
3
3
|
border-radius: var(--mg-panel-border-radius);
|
|
4
|
-
box-shadow: var(--box-shadow);
|
|
4
|
+
box-shadow: var(--mg-panel-box-shadow);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
6
|
.mg-panel__header {
|
|
8
7
|
display: flex;
|
|
9
8
|
flex-wrap: wrap;
|
|
@@ -11,38 +10,31 @@
|
|
|
11
10
|
padding: 0 1rem 0 0.3rem;
|
|
12
11
|
align-items: flex-start;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
.mg-panel__header-left,
|
|
16
|
-
.mg-panel__header-right {
|
|
13
|
+
.mg-panel__header-left, .mg-panel__header-right {
|
|
17
14
|
display: flex;
|
|
18
15
|
margin: 0.3rem 0;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
.mg-panel__header-left--full {
|
|
22
|
-
flex: 1 1 auto;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
17
|
.mg-panel__header-right {
|
|
18
|
+
padding-left: 0.3rem;
|
|
26
19
|
flex: 1 auto;
|
|
27
20
|
}
|
|
28
|
-
|
|
29
21
|
.mg-panel__header-left mg-input-text {
|
|
30
22
|
flex-grow: 1;
|
|
23
|
+
margin-left: 0.3rem;
|
|
31
24
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
.mg-panel__header-left mg-button + mg-button:not([slot=append-input]) {
|
|
26
|
+
margin-left: 0.3rem;
|
|
27
|
+
}
|
|
28
|
+
.mg-panel__header-left.mg-panel__header-left--full {
|
|
29
|
+
flex: 1 1 auto;
|
|
35
30
|
}
|
|
36
|
-
.mg-
|
|
37
|
-
font-
|
|
38
|
-
font-
|
|
39
|
-
font-weight: 600;
|
|
31
|
+
.mg-panel__collapse-button-content {
|
|
32
|
+
--font-size: 1.4rem;
|
|
33
|
+
--mg-button-font-weight: 600;
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
.mg-panel__content {
|
|
43
36
|
padding: var(--mg-panel-content-padding);
|
|
44
37
|
}
|
|
45
|
-
|
|
46
38
|
.mg-panel ::slotted([slot=header-right]) {
|
|
47
39
|
display: flex;
|
|
48
40
|
flex-wrap: wrap;
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import { filterArgs } from '../../../../../.storybook/utils';
|
|
3
|
-
import { placements } from '../mg-popover.conf';
|
|
4
3
|
export default {
|
|
5
4
|
component: 'mg-popover',
|
|
6
5
|
title: 'Molecules/mg-popover',
|
|
@@ -11,11 +10,7 @@ export default {
|
|
|
11
10
|
},
|
|
12
11
|
argTypes: {
|
|
13
12
|
placement: {
|
|
14
|
-
options: placements,
|
|
15
13
|
control: { type: 'select' },
|
|
16
|
-
table: {
|
|
17
|
-
defaultValue: { summary: 'bottom' },
|
|
18
|
-
},
|
|
19
14
|
},
|
|
20
15
|
},
|
|
21
16
|
};
|
|
@@ -8,7 +8,7 @@ mg-popover::slotted(*) {
|
|
|
8
8
|
.mg-popover {
|
|
9
9
|
display: none;
|
|
10
10
|
padding: 1.5rem;
|
|
11
|
-
z-index:
|
|
11
|
+
z-index: 1000;
|
|
12
12
|
border-radius: 0.5rem;
|
|
13
13
|
background-color: hsl(var(--mg-popover-background-color));
|
|
14
14
|
box-shadow: var(--box-shadow);
|
|
@@ -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,15 +114,16 @@ 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}`);
|
|
124
123
|
// Create popperjs popover
|
|
125
124
|
this.popper = createPopper(interactiveElement, this.popover, {
|
|
126
125
|
placement: this.placement,
|
|
126
|
+
strategy: 'fixed',
|
|
127
127
|
modifiers: [
|
|
128
128
|
{
|
|
129
129
|
name: 'offset',
|
|
@@ -151,10 +151,10 @@ export class MgPopover {
|
|
|
151
151
|
* @returns {HTMLElement} HTML Element
|
|
152
152
|
*/
|
|
153
153
|
render() {
|
|
154
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" },
|
|
154
|
+
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 }))));
|
|
155
155
|
}
|
|
156
156
|
static get is() { return "mg-popover"; }
|
|
157
|
-
static get encapsulation() { return "
|
|
157
|
+
static get encapsulation() { return "shadow"; }
|
|
158
158
|
static get originalStyleUrls() {
|
|
159
159
|
return {
|
|
160
160
|
"$": ["mg-popover.scss"]
|
|
@@ -194,7 +194,7 @@ export class MgPopover {
|
|
|
194
194
|
"references": {
|
|
195
195
|
"Placement": {
|
|
196
196
|
"location": "import",
|
|
197
|
-
"path": "
|
|
197
|
+
"path": "@popperjs/core"
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
},
|
|
@@ -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) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param {number} length ID length
|
|
6
6
|
* @returns {string} ID
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export const createID = (prefix = '', length = 10) => {
|
|
9
9
|
let ID = '';
|
|
10
10
|
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
11
11
|
const charsLength = chars.length;
|
|
@@ -13,7 +13,7 @@ export function createID(prefix = '', length = 10) {
|
|
|
13
13
|
ID += chars.charAt(Math.floor(Math.random() * charsLength));
|
|
14
14
|
}
|
|
15
15
|
return (prefix !== '' ? `${prefix}-` : '') + ID;
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
/**
|
|
18
18
|
* Class to manage component classlist
|
|
19
19
|
* Set() are not working when imported in project
|
|
@@ -69,9 +69,9 @@ export class ClassList {
|
|
|
69
69
|
* @param {string[]} items items to check
|
|
70
70
|
* @returns {boolean} all items are string
|
|
71
71
|
*/
|
|
72
|
-
export
|
|
72
|
+
export const allItemsAreString = (items) => {
|
|
73
73
|
return items && items.every(item => typeof item === 'string');
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
75
|
/**
|
|
76
76
|
* Check if element is a heading
|
|
77
77
|
*
|
|
@@ -79,6 +79,10 @@ export function allItemsAreString(items) {
|
|
|
79
79
|
* @param {string[]} tagNames allowed tag names list
|
|
80
80
|
* @returns {boolean} element is a heading
|
|
81
81
|
*/
|
|
82
|
-
export
|
|
82
|
+
export const isTagName = (element, tagNames) => {
|
|
83
83
|
return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Focusable elements query selector
|
|
87
|
+
*/
|
|
88
|
+
export const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
|
|
@@ -168,11 +168,32 @@
|
|
|
168
168
|
/*
|
|
169
169
|
<mg-panel>
|
|
170
170
|
*/
|
|
171
|
-
|
|
172
171
|
--mg-panel-border-radius: 0.5rem;
|
|
173
172
|
--mg-panel-background: var(--color-info-h) var(--color-info-s) calc(var(--color-info-l) + 68%);
|
|
173
|
+
--mg-panel-box-shadow: var(--box-shadow);
|
|
174
174
|
--mg-panel-content-padding: 1.5rem;
|
|
175
175
|
|
|
176
|
+
/*
|
|
177
|
+
<mg-illustrated-message>
|
|
178
|
+
*/
|
|
179
|
+
--mg-illustrated-message-padding-vertical: 4rem;
|
|
180
|
+
|
|
181
|
+
/*
|
|
182
|
+
<mg-card>
|
|
183
|
+
*/
|
|
184
|
+
--mg-card-padding: 1.6rem;
|
|
185
|
+
--mg-card-border-radius: 0.5rem;
|
|
186
|
+
--mg-card-background: hsl(var(--color-light));
|
|
187
|
+
--mg-card-border: 0.1rem solid hsla(var(--color-dark), 5%);
|
|
188
|
+
--mg-card-box-shadow: var(--box-shadow);
|
|
189
|
+
|
|
190
|
+
/*
|
|
191
|
+
<mg-divider>
|
|
192
|
+
*/
|
|
193
|
+
--mg-divider-background-color: hsla(var(--color-dark), 15%);
|
|
194
|
+
--mg-divider-thickness: 0.1rem;
|
|
195
|
+
--mg-divider-vertical-spacing: 4rem;
|
|
196
|
+
|
|
176
197
|
/*
|
|
177
198
|
Layout
|
|
178
199
|
*/
|
|
@@ -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.');
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param {number} length ID length
|
|
6
6
|
* @returns {string} ID
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
const createID = (prefix = '', length = 10) => {
|
|
9
9
|
let ID = '';
|
|
10
10
|
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
11
11
|
const charsLength = chars.length;
|
|
@@ -13,7 +13,7 @@ function createID(prefix = '', length = 10) {
|
|
|
13
13
|
ID += chars.charAt(Math.floor(Math.random() * charsLength));
|
|
14
14
|
}
|
|
15
15
|
return (prefix !== '' ? `${prefix}-` : '') + ID;
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
/**
|
|
18
18
|
* Class to manage component classlist
|
|
19
19
|
* Set() are not working when imported in project
|
|
@@ -69,9 +69,9 @@ class ClassList {
|
|
|
69
69
|
* @param {string[]} items items to check
|
|
70
70
|
* @returns {boolean} all items are string
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
const allItemsAreString = (items) => {
|
|
73
73
|
return items && items.every(item => typeof item === 'string');
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
75
|
/**
|
|
76
76
|
* Check if element is a heading
|
|
77
77
|
*
|
|
@@ -79,8 +79,12 @@ function allItemsAreString(items) {
|
|
|
79
79
|
* @param {string[]} tagNames allowed tag names list
|
|
80
80
|
* @returns {boolean} element is a heading
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
const isTagName = (element, tagNames) => {
|
|
83
83
|
return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Focusable elements query selector
|
|
87
|
+
*/
|
|
88
|
+
const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
|
|
85
89
|
|
|
86
|
-
export { ClassList as C, allItemsAreString as a, createID as c, isTagName as i };
|
|
90
|
+
export { ClassList as C, allItemsAreString as a, createID as c, focusableElements as f, isTagName as i };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* MgComponents custom elements */
|
|
2
2
|
export { MgBadge as MgBadge } from '../types/components/atoms/mg-badge/mg-badge';
|
|
3
3
|
export { MgButton as MgButton } from '../types/components/atoms/mg-button/mg-button';
|
|
4
|
+
export { MgCard as MgCard } from '../types/components/atoms/mg-card/mg-card';
|
|
4
5
|
export { MgCharacterLeft as MgCharacterLeft } from '../types/components/atoms/mg-character-left/mg-character-left';
|
|
5
6
|
export { MgDetails as MgDetails } from '../types/components/molecules/mg-details/mg-details';
|
|
7
|
+
export { MgDivider as MgDivider } from '../types/components/atoms/mg-divider/mg-divider';
|
|
6
8
|
export { MgForm as MgForm } from '../types/components/molecules/mg-form/mg-form';
|
|
7
9
|
export { MgIcon as MgIcon } from '../types/components/atoms/mg-icon/mg-icon';
|
|
8
10
|
export { MgIllustratedMessage as MgIllustratedMessage } from '../types/components/molecules/mg-illustrated-message/mg-illustrated-message';
|
package/dist/components/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
2
|
export { MgBadge, defineCustomElement as defineCustomElementMgBadge } from './mg-badge.js';
|
|
3
3
|
export { MgButton, defineCustomElement as defineCustomElementMgButton } from './mg-button.js';
|
|
4
|
+
export { MgCard, defineCustomElement as defineCustomElementMgCard } from './mg-card.js';
|
|
4
5
|
export { MgCharacterLeft, defineCustomElement as defineCustomElementMgCharacterLeft } from './mg-character-left.js';
|
|
5
6
|
export { MgDetails, defineCustomElement as defineCustomElementMgDetails } from './mg-details.js';
|
|
7
|
+
export { MgDivider, defineCustomElement as defineCustomElementMgDivider } from './mg-divider.js';
|
|
6
8
|
export { MgForm, defineCustomElement as defineCustomElementMgForm } from './mg-form.js';
|
|
7
9
|
export { MgIcon, defineCustomElement as defineCustomElementMgIcon } from './mg-icon.js';
|
|
8
10
|
export { MgIllustratedMessage, defineCustomElement as defineCustomElementMgIllustratedMessage } from './mg-illustrated-message.js';
|
|
@@ -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,20 +7,28 @@ 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)}:host([full-width]){display:block}.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--full-width{display:flex;justify-content:center}.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';
|
|
23
|
+
this.classFullWidth = 'mg-button--full-width';
|
|
20
24
|
/**
|
|
21
25
|
* Define button variant
|
|
22
26
|
*/
|
|
23
27
|
this.variant = variants[0]; // Primary
|
|
28
|
+
/**
|
|
29
|
+
* Set button to full-width
|
|
30
|
+
*/
|
|
31
|
+
this.fullWidth = false;
|
|
24
32
|
/**
|
|
25
33
|
* Define if button is round.
|
|
26
34
|
* Used for icon button.
|
|
@@ -51,11 +59,38 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
51
59
|
if (this.disabled)
|
|
52
60
|
event.stopPropagation();
|
|
53
61
|
// Used to prevent multi-click.
|
|
54
|
-
if (this.disableOnClick
|
|
62
|
+
else if (this.disableOnClick) {
|
|
55
63
|
this.loading = true;
|
|
56
64
|
this.disabled = true;
|
|
57
65
|
}
|
|
58
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Handle onKeyDown event
|
|
69
|
+
*
|
|
70
|
+
* @param {KeyboardEvent} event keyboard event
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
73
|
+
this.handleKeydown = (event) => {
|
|
74
|
+
if (!this.disabled && event.key === ' ') {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
}
|
|
77
|
+
else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Handle onKeyUp event
|
|
84
|
+
*
|
|
85
|
+
* @param {KeyboardEvent} event keyboard event
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
88
|
+
this.handleKeyup = (event) => {
|
|
89
|
+
if (!this.disabled && event.key === ' ') {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
59
94
|
}
|
|
60
95
|
validateVariant(newValue, oldValue) {
|
|
61
96
|
if (!variants.includes(newValue)) {
|
|
@@ -68,6 +103,17 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
68
103
|
this.classList.add(`mg-button--${newValue}`);
|
|
69
104
|
}
|
|
70
105
|
}
|
|
106
|
+
validateFullWidth(newValue) {
|
|
107
|
+
if (newValue && this.isIcon) {
|
|
108
|
+
throw new Error('<mg-button> prop "fullWidth" cannot be used with prop "isIcon".');
|
|
109
|
+
}
|
|
110
|
+
else if (newValue) {
|
|
111
|
+
this.classList.add(this.classFullWidth);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.classList.delete(this.classFullWidth);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
71
117
|
disabledHandler(isDisabled) {
|
|
72
118
|
// Remove loading when enable
|
|
73
119
|
// Will be set back onclick
|
|
@@ -76,14 +122,21 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
76
122
|
}
|
|
77
123
|
// Manage if onclick
|
|
78
124
|
this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
|
|
125
|
+
// apply style
|
|
126
|
+
if (isDisabled) {
|
|
127
|
+
this.classList.add(this.classDisabled);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
this.classList.delete(this.classDisabled);
|
|
131
|
+
}
|
|
79
132
|
}
|
|
80
133
|
loadingHandler(newValue) {
|
|
81
134
|
// we add loading style if it newvalue is true else we remove it
|
|
82
135
|
if (newValue) {
|
|
83
|
-
this.classList.add(
|
|
136
|
+
this.classList.add(this.classLoading);
|
|
84
137
|
}
|
|
85
138
|
else {
|
|
86
|
-
this.classList.delete(
|
|
139
|
+
this.classList.delete(this.classLoading);
|
|
87
140
|
}
|
|
88
141
|
}
|
|
89
142
|
/**
|
|
@@ -93,6 +146,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
93
146
|
*/
|
|
94
147
|
componentWillLoad() {
|
|
95
148
|
this.validateVariant(this.variant);
|
|
149
|
+
this.validateFullWidth(this.fullWidth);
|
|
96
150
|
if (this.isIcon) {
|
|
97
151
|
this.classList.add(`mg-button--icon`);
|
|
98
152
|
if (typeof this.label !== 'string' || this.label.trim() === '') {
|
|
@@ -109,30 +163,26 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
109
163
|
* @returns {HTMLElement} html element
|
|
110
164
|
*/
|
|
111
165
|
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))));
|
|
166
|
+
return (h(Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "full-width": this.fullWidth, "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
167
|
}
|
|
117
168
|
get element() { return this; }
|
|
118
169
|
static get watchers() { return {
|
|
119
170
|
"variant": ["validateVariant"],
|
|
171
|
+
"fullWidth": ["validateFullWidth"],
|
|
120
172
|
"disabled": ["disabledHandler"],
|
|
121
173
|
"loading": ["loadingHandler"]
|
|
122
174
|
}; }
|
|
123
175
|
static get style() { return mgButtonCss; }
|
|
124
|
-
}, [
|
|
176
|
+
}, [1, "mg-button", {
|
|
125
177
|
"variant": [1],
|
|
126
178
|
"identifier": [1],
|
|
127
179
|
"label": [1],
|
|
128
180
|
"type": [1],
|
|
181
|
+
"fullWidth": [1028, "full-width"],
|
|
129
182
|
"form": [1025],
|
|
130
183
|
"disabled": [1028],
|
|
131
184
|
"isIcon": [4, "is-icon"],
|
|
132
185
|
"disableOnClick": [4, "disable-on-click"],
|
|
133
|
-
"expanded": [4],
|
|
134
|
-
"controls": [1],
|
|
135
|
-
"haspopup": [8],
|
|
136
186
|
"loading": [32],
|
|
137
187
|
"classList": [32]
|
|
138
188
|
}]);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MgCard extends Components.MgCard, HTMLElement {}
|
|
4
|
+
export const MgCard: {
|
|
5
|
+
prototype: MgCard;
|
|
6
|
+
new (): MgCard;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const mgCardCss = ".mg-card{padding:var(--mg-card-padding);border-radius:var(--mg-card-border-radius);background:var(--mg-card-background);border:var(--mg-card-border);box-shadow:var(--mg-card-box-shadow)}";
|
|
4
|
+
|
|
5
|
+
const MgCard$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
}
|
|
11
|
+
/*************
|
|
12
|
+
* Lifecycle *
|
|
13
|
+
*************/
|
|
14
|
+
/**
|
|
15
|
+
* Render
|
|
16
|
+
*
|
|
17
|
+
* @returns {HTMLElement} HTML Element
|
|
18
|
+
*/
|
|
19
|
+
render() {
|
|
20
|
+
return (h("div", { class: "mg-card" }, h("slot", null)));
|
|
21
|
+
}
|
|
22
|
+
static get style() { return mgCardCss; }
|
|
23
|
+
}, [1, "mg-card"]);
|
|
24
|
+
function defineCustomElement$1() {
|
|
25
|
+
if (typeof customElements === "undefined") {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const components = ["mg-card"];
|
|
29
|
+
components.forEach(tagName => { switch (tagName) {
|
|
30
|
+
case "mg-card":
|
|
31
|
+
if (!customElements.get(tagName)) {
|
|
32
|
+
customElements.define(tagName, MgCard$1);
|
|
33
|
+
}
|
|
34
|
+
break;
|
|
35
|
+
} });
|
|
36
|
+
}
|
|
37
|
+
defineCustomElement$1();
|
|
38
|
+
|
|
39
|
+
const MgCard = MgCard$1;
|
|
40
|
+
const defineCustomElement = defineCustomElement$1;
|
|
41
|
+
|
|
42
|
+
export { MgCard, defineCustomElement };
|