@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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
import { BadgeType } from "./components/atoms/mg-badge/mg-badge.conf";
|
|
9
|
-
import { ButtonType } from "./components/atoms/mg-button/mg-button.conf";
|
|
9
|
+
import { ButtonType, VariantType } from "./components/atoms/mg-button/mg-button.conf";
|
|
10
10
|
import { CheckboxValue } from "./components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf";
|
|
11
11
|
import { Width } from "./components/molecules/inputs/MgInput.conf";
|
|
12
12
|
import { RadioOption } from "./components/molecules/inputs/mg-input-radio/mg-input-radio.conf";
|
|
@@ -35,10 +35,6 @@ export namespace Components {
|
|
|
35
35
|
"variant": string;
|
|
36
36
|
}
|
|
37
37
|
interface MgButton {
|
|
38
|
-
/**
|
|
39
|
-
* Prop to set aria-controls on button element
|
|
40
|
-
*/
|
|
41
|
-
"controls": string;
|
|
42
38
|
/**
|
|
43
39
|
* Option to set input disable on click, in order to prevent multi-click. Parent component have to remove the attribute 'disabled' when the process ends.
|
|
44
40
|
*/
|
|
@@ -47,18 +43,10 @@ export namespace Components {
|
|
|
47
43
|
* Disable button
|
|
48
44
|
*/
|
|
49
45
|
"disabled": boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Prop to set aria-expanded on button element
|
|
52
|
-
*/
|
|
53
|
-
"expanded": boolean;
|
|
54
46
|
/**
|
|
55
47
|
* Define form id to attach button with. If this attribute is not set, the <button> is associated with its ancestor <form> element.
|
|
56
48
|
*/
|
|
57
49
|
"form": string;
|
|
58
|
-
/**
|
|
59
|
-
* Option to set aria-haspopup The aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity.
|
|
60
|
-
*/
|
|
61
|
-
"haspopup": boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
62
50
|
/**
|
|
63
51
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
64
52
|
*/
|
|
@@ -72,13 +60,13 @@ export namespace Components {
|
|
|
72
60
|
*/
|
|
73
61
|
"label": string;
|
|
74
62
|
/**
|
|
75
|
-
* Define button type
|
|
63
|
+
* Define button type
|
|
76
64
|
*/
|
|
77
65
|
"type": ButtonType;
|
|
78
66
|
/**
|
|
79
67
|
* Define button variant
|
|
80
68
|
*/
|
|
81
|
-
"variant":
|
|
69
|
+
"variant": VariantType;
|
|
82
70
|
}
|
|
83
71
|
interface MgCharacterLeft {
|
|
84
72
|
/**
|
|
@@ -158,6 +146,10 @@ export namespace Components {
|
|
|
158
146
|
"variant": string;
|
|
159
147
|
}
|
|
160
148
|
interface MgIllustratedMessage {
|
|
149
|
+
/**
|
|
150
|
+
* Define component orientation
|
|
151
|
+
*/
|
|
152
|
+
"direction": 'vertical' | 'horizontal';
|
|
161
153
|
/**
|
|
162
154
|
* Define illustration size
|
|
163
155
|
*/
|
|
@@ -1285,10 +1277,6 @@ declare namespace LocalJSX {
|
|
|
1285
1277
|
"variant"?: string;
|
|
1286
1278
|
}
|
|
1287
1279
|
interface MgButton {
|
|
1288
|
-
/**
|
|
1289
|
-
* Prop to set aria-controls on button element
|
|
1290
|
-
*/
|
|
1291
|
-
"controls"?: string;
|
|
1292
1280
|
/**
|
|
1293
1281
|
* Option to set input disable on click, in order to prevent multi-click. Parent component have to remove the attribute 'disabled' when the process ends.
|
|
1294
1282
|
*/
|
|
@@ -1297,18 +1285,10 @@ declare namespace LocalJSX {
|
|
|
1297
1285
|
* Disable button
|
|
1298
1286
|
*/
|
|
1299
1287
|
"disabled"?: boolean;
|
|
1300
|
-
/**
|
|
1301
|
-
* Prop to set aria-expanded on button element
|
|
1302
|
-
*/
|
|
1303
|
-
"expanded"?: boolean;
|
|
1304
1288
|
/**
|
|
1305
1289
|
* Define form id to attach button with. If this attribute is not set, the <button> is associated with its ancestor <form> element.
|
|
1306
1290
|
*/
|
|
1307
1291
|
"form"?: string;
|
|
1308
|
-
/**
|
|
1309
|
-
* Option to set aria-haspopup The aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity.
|
|
1310
|
-
*/
|
|
1311
|
-
"haspopup"?: boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
1312
1292
|
/**
|
|
1313
1293
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
1314
1294
|
*/
|
|
@@ -1322,13 +1302,13 @@ declare namespace LocalJSX {
|
|
|
1322
1302
|
*/
|
|
1323
1303
|
"label"?: string;
|
|
1324
1304
|
/**
|
|
1325
|
-
* Define button type
|
|
1305
|
+
* Define button type
|
|
1326
1306
|
*/
|
|
1327
1307
|
"type"?: ButtonType;
|
|
1328
1308
|
/**
|
|
1329
1309
|
* Define button variant
|
|
1330
1310
|
*/
|
|
1331
|
-
"variant"?:
|
|
1311
|
+
"variant"?: VariantType;
|
|
1332
1312
|
}
|
|
1333
1313
|
interface MgCharacterLeft {
|
|
1334
1314
|
/**
|
|
@@ -1415,6 +1395,10 @@ declare namespace LocalJSX {
|
|
|
1415
1395
|
"variant"?: string;
|
|
1416
1396
|
}
|
|
1417
1397
|
interface MgIllustratedMessage {
|
|
1398
|
+
/**
|
|
1399
|
+
* Define component orientation
|
|
1400
|
+
*/
|
|
1401
|
+
"direction"?: 'vertical' | 'horizontal';
|
|
1418
1402
|
/**
|
|
1419
1403
|
* Define illustration size
|
|
1420
1404
|
*/
|
package/package.json
CHANGED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-94497267.js');
|
|
6
|
-
const index$1 = require('./index-179621c8.js');
|
|
7
|
-
const popper = require('./popper-11d5f714.js');
|
|
8
|
-
|
|
9
|
-
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show].sc-mg-popover{display:block}.mg-popover.sc-mg-popover mg-button.sc-mg-popover{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover__arrow.sc-mg-popover,.mg-popover__arrow.sc-mg-popover::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover__arrow.sc-mg-popover{visibility:hidden}.mg-popover__arrow.sc-mg-popover::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{bottom:-6px}.mg-popover[data-popper-placement^=bottom].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{top:-6px}.mg-popover[data-popper-placement^=left].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{right:-6px}.mg-popover[data-popper-placement^=right].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{left:-6px}.mg-popover__title.sc-mg-popover-s>[slot=title],.mg-popover__title .sc-mg-popover-s>[slot=title]{margin:0 0 1rem;font-size:var(--mg-popover-title-font-size);font-weight:600}";
|
|
10
|
-
|
|
11
|
-
const MgPopover = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.displayChange = index.createEvent(this, "display-change", 7);
|
|
15
|
-
this.closeButtonId = '';
|
|
16
|
-
/**
|
|
17
|
-
* Sets an `id` attribute.
|
|
18
|
-
* Needed by the input for accessibility `aria-decribedby`.
|
|
19
|
-
*/
|
|
20
|
-
this.identifier = index$1.createID('mg-popover');
|
|
21
|
-
/**
|
|
22
|
-
* Popover placement
|
|
23
|
-
*/
|
|
24
|
-
this.placement = 'bottom';
|
|
25
|
-
/**
|
|
26
|
-
* Define if popover has a cross button
|
|
27
|
-
*/
|
|
28
|
-
this.closeButton = false;
|
|
29
|
-
/**
|
|
30
|
-
* Display popover
|
|
31
|
-
*/
|
|
32
|
-
this.display = false;
|
|
33
|
-
/**
|
|
34
|
-
* Disable popover
|
|
35
|
-
*/
|
|
36
|
-
this.disabled = false;
|
|
37
|
-
/**
|
|
38
|
-
* Check if clicked outside of component
|
|
39
|
-
*
|
|
40
|
-
* @param {MouseEvent} event mouse event
|
|
41
|
-
* @returns {void}
|
|
42
|
-
*/
|
|
43
|
-
this.clickOutside = (event) => {
|
|
44
|
-
var _a;
|
|
45
|
-
if (!this.disabled && ((_a = event.target.closest(`#${this.identifier}`)) === null || _a === void 0 ? void 0 : _a.parentElement.nodeName) !== 'MG-POPOVER') {
|
|
46
|
-
this.display = false;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Show popover
|
|
51
|
-
*
|
|
52
|
-
* @returns {void}
|
|
53
|
-
*/
|
|
54
|
-
this.show = () => {
|
|
55
|
-
// Make the popover visible
|
|
56
|
-
this.popover.setAttribute('data-show', '');
|
|
57
|
-
// Enable the event listeners
|
|
58
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
59
|
-
// Update its position
|
|
60
|
-
this.popper.update();
|
|
61
|
-
// hide when click outside
|
|
62
|
-
// setTimeout is used to prevent event to trigger after creation
|
|
63
|
-
setTimeout(() => {
|
|
64
|
-
document.addEventListener('click', this.clickOutside, false);
|
|
65
|
-
}, 0);
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Hide popover
|
|
69
|
-
*
|
|
70
|
-
* @returns {void}
|
|
71
|
-
*/
|
|
72
|
-
this.hide = () => {
|
|
73
|
-
// Hide the popover
|
|
74
|
-
this.popover.removeAttribute('data-show');
|
|
75
|
-
// Disable the event listeners
|
|
76
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
77
|
-
// Remove event listener
|
|
78
|
-
document.removeEventListener('click', this.clickOutside, false);
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Handle action for close button
|
|
82
|
-
*
|
|
83
|
-
* @returns {void}
|
|
84
|
-
*/
|
|
85
|
-
this.handleCloseButton = () => {
|
|
86
|
-
this.display = false;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
handleDisplay(newValue) {
|
|
90
|
-
if (newValue) {
|
|
91
|
-
this.show();
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
this.hide();
|
|
95
|
-
}
|
|
96
|
-
this.displayChange.emit(newValue);
|
|
97
|
-
}
|
|
98
|
-
/*************
|
|
99
|
-
* Lifecycle *
|
|
100
|
-
*************/
|
|
101
|
-
/**
|
|
102
|
-
* Check if component props are well configured on init
|
|
103
|
-
*
|
|
104
|
-
* @returns {void} timeout
|
|
105
|
-
*/
|
|
106
|
-
componentWillLoad() {
|
|
107
|
-
// Get locales
|
|
108
|
-
this.messages = index$1.initLocales(this.element).messages;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Check if component props are well configured on init
|
|
112
|
-
*
|
|
113
|
-
* @returns {void}
|
|
114
|
-
*/
|
|
115
|
-
componentDidLoad() {
|
|
116
|
-
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
117
|
-
const slotedTitleElement = this.element.querySelector('[slot="title"]');
|
|
118
|
-
if (slotedTitleElement && !index$1.isTagName(slotedTitleElement, headingTags)) {
|
|
119
|
-
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
120
|
-
}
|
|
121
|
-
// Set close button id
|
|
122
|
-
if (this.closeButton) {
|
|
123
|
-
this.closeButtonId = `${this.identifier}-close-button`;
|
|
124
|
-
}
|
|
125
|
-
// Get popover content
|
|
126
|
-
this.popover = this.element.querySelector(`#${this.identifier}`);
|
|
127
|
-
//Get interactive element
|
|
128
|
-
const interactiveElement = this.element.firstElementChild;
|
|
129
|
-
// Add aria attributes
|
|
130
|
-
interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
131
|
-
interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
132
|
-
// Create popperjs popover
|
|
133
|
-
this.popper = popper.createPopper(interactiveElement, this.popover, {
|
|
134
|
-
placement: this.placement,
|
|
135
|
-
modifiers: [
|
|
136
|
-
{
|
|
137
|
-
name: 'offset',
|
|
138
|
-
options: {
|
|
139
|
-
offset: [0, 10],
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
});
|
|
144
|
-
// Add events to toggle display
|
|
145
|
-
interactiveElement.addEventListener('click', () => {
|
|
146
|
-
if (!this.disabled)
|
|
147
|
-
this.display = !this.display;
|
|
148
|
-
});
|
|
149
|
-
// Add events to hide popover
|
|
150
|
-
this.element.addEventListener('keydown', e => {
|
|
151
|
-
if (!this.disabled && e.code === 'Escape')
|
|
152
|
-
this.display = false;
|
|
153
|
-
});
|
|
154
|
-
this.handleDisplay(this.display);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Render
|
|
158
|
-
*
|
|
159
|
-
* @returns {HTMLElement} HTML Element
|
|
160
|
-
*/
|
|
161
|
-
render() {
|
|
162
|
-
return (index.h(index.Host, null, index.h("slot", null), index.h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, index.h("mg-icon", { icon: "cross" }))), index.h("div", { class: "mg-popover__title" }, index.h("slot", { name: "title" })), index.h("slot", { name: "content" }), index.h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
163
|
-
}
|
|
164
|
-
get element() { return index.getElement(this); }
|
|
165
|
-
static get watchers() { return {
|
|
166
|
-
"display": ["handleDisplay"]
|
|
167
|
-
}; }
|
|
168
|
-
};
|
|
169
|
-
MgPopover.style = mgPopoverCss;
|
|
170
|
-
|
|
171
|
-
exports.mg_popover = MgPopover;
|